/** * Register a RecyclerView to the current MaterialViewPagerAnimator Listen to * RecyclerView.OnScrollListener so give to $[onScrollListener] your RecyclerView.OnScrollListener * if you already use one For loadmore or anything else * * @param activity current context * @param recyclerView the scrollable * @param onScrollListener use it if you want to get a callback of the RecyclerView */ public static void registerRecyclerView( Activity activity, RecyclerView recyclerView, RecyclerView.OnScrollListener onScrollListener) { if (activity != null && hashMap.containsKey(activity)) { MaterialViewPagerAnimator animator = hashMap.get(activity); if (animator != null) { animator.registerRecyclerView(recyclerView, onScrollListener); } } }