This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Make the first {@link RecyclerView.ViewHolder} has parallax effect. | |
| */ | |
| public class ParallaxRecyclerView extends ECRecyclerView { | |
| private static final String TAG = ParallaxRecyclerView.class.getSimpleName(); | |
| private static final float DEFAULT_PARALLAX_MULTIPLIER = 0.5f; | |
| private float mParallaxMultiplier = DEFAULT_PARALLAX_MULTIPLIER; | |
| private OnParallaxScrollListener mParallaxScrollListener; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * SpacingDividerItemDecoration is a {@link RecyclerView.ItemDecoration} that can add space divider | |
| * between items of a {@link android.support.v7.widget.LinearLayoutManager}. It supports both {@link #HORIZONTAL} | |
| * and {@link #VERTICAL} orientations. | |
| */ | |
| public class SpacingDividerItemDecoration extends RecyclerView.ItemDecoration { | |
| @IntDef({HORIZONTAL, VERTICAL}) | |
| @Retention(RetentionPolicy.SOURCE) | |
| public @interface OrientationMode {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Class intended to support multiple click areas for a {@link View}. | |
| */ | |
| public abstract class ClickAreaHelper implements View.OnTouchListener, View.OnClickListener, View.OnLongClickListener { | |
| private OnClickAreaListener mOnClickAreaListener; | |
| private OnLongClickAreaListener mOnLongClickAreaListener; | |
| private View mView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ToolbarOffsetChangedListener implements AppBarLayout.OnOffsetChangedListener { | |
| private static final String TAG = "ToolbarOffsetChangedListener"; | |
| private Toolbar toolbar; | |
| private Drawable[] icons; | |
| /** | |
| * 觸發開始改變顏色的 offset [0, - AppBar's height] | |
| */ | |
| private int verticalOffsetTrigger = -1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @see <a href="https://medium.com/androiddevelopers/windows-insets-fragment-transitions-9024b239a436">Windows Insets + Fragment Transitions</a> | |
| */ | |
| public class DispatchWindowInsetsToAllChildrenListener implements OnApplyWindowInsetsListener { | |
| @Override | |
| public WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat windowInsetsCompat) { | |
| boolean consumed = false; | |
| if (view instanceof ViewGroup) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Rule to be used in tests that display a Toast with class name and method name when each test starting. | |
| * | |
| * ``` | |
| * @RunWith(AndroidJUnit4::class) | |
| * class FooTest { | |
| * | |
| * @get:Rule | |
| * val testNameToastRule = TestNameToastRule() | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object RecyclerViewUtils { | |
| fun <VH : RecyclerView.ViewHolder> scrollToHolderWithFallback( | |
| recyclerViewMatcher: Matcher<View>, | |
| viewHolderMatcher: Matcher<VH>, | |
| failureViewAction: ViewAction, | |
| maxRetryCount: Int | |
| ) { | |
| var count = maxRetryCount |