Instead of the verbose setOnClickListener:
RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));Observable
.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)| package com.filipkowicz.headeritemdecorator | |
| /* | |
| solution based on - based on Sevastyan answer on StackOverflow | |
| changes: | |
| - take to account views offsets | |
| - transformed to Kotlin | |
| - now works on viewHolders |
| package com.saber.customstickyheader; | |
| import android.graphics.Color; | |
| import android.support.annotation.NonNull; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| import android.widget.TextView; |
| public class AndroidApplication extends MultiDexApplication { | |
| public static final String TAG = AndroidApplication.class.getSimpleName(); | |
| @Override | |
| public void onCreate() { | |
| super.onCreate(); | |
| registerComponentCallbacks(new ComponentCallback()); | |
| } | |
| private class ComponentCallback implements ComponentCallbacks2 { |
| package com.example.name; | |
| import android.content.Context; | |
| import android.graphics.Rect; | |
| import android.graphics.drawable.Drawable; | |
| import android.net.Uri; | |
| import android.text.Html; | |
| import android.view.View; | |
| import android.widget.TextView; |
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
| public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
| private int previousTotal = 0; // The total number of items in the dataset after the last load | |
| private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
| private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
| int firstVisibleItem, visibleItemCount, totalItemCount; |
| public class MyModule extends AbstractModule { | |
| @Override | |
| void configure() { | |
| bind(String.class).annotatedWith(UserAgent.class).to(UserAgentProvider.class); | |
| } | |
| } | |
| public class MyComponent { | |
| String userAgent; |