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 be.brol | |
| import android.os.Binder | |
| import android.os.Bundle | |
| import android.support.v4.app.BundleCompat | |
| import android.support.v4.app.Fragment | |
| /** | |
| * Eases the Fragment.newInstance ceremony by marking the fragment's args with this delegate | |
| * Just write the property in newInstance and read it like any other property after the fragment has been created |
| import android.text.SpannableStringBuilder; | |
| import java.util.ArrayDeque; | |
| import java.util.Deque; | |
| import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE; | |
| /** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */ | |
| public class Truss { | |
| private final SpannableStringBuilder builder; | |
| private final Deque<Span> stack; |
| public ColorFilter duotoneColorFilter(@ColorInt int colorBlack, @ColorInt int colorWhite, float contrast) { | |
| ColorMatrix cm = new ColorMatrix(); | |
| ColorMatrix cmBlackWhite = new ColorMatrix(); | |
| float lumR = 0.2125f; | |
| float lumG = 0.7154f; | |
| float lumB = 0.0721f; | |
| float[] blackWhiteArray = new float[]{ | |
| lumR, lumG, lumB, 0, 0, | |
| lumR, lumG, lumB, 0, 0, |
You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.
The RecyclerView should use a LinearLayoutManager.
You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)
This is a porting of the class SimpleSectionedListAdapter provided by Google
Example: