private void initPagerAnimator ( ) { final SimpleTracker gridTracker = new SimpleTracker ( ) { @ Override public View getViewAt ( int pos ) { RecyclerView . ViewHolder holder = views . grid . findViewHolderForLayoutPosition ( pos ) ; return holder == null ? null : PhotoListAdapter . getImage ( holder ) ; } } ; final SimpleTracker pagerTracker = new SimpleTracker ( ) { @ Override public View getViewAt ( int pos ) { RecyclePagerAdapter . ViewHolder holder = pagerAdapter . getViewHolder ( pos ) ; return holder == null ? null : PhotoPagerAdapter . getImage ( holder ) ; } } ; listAnimator = GestureTransitions . from ( views . grid , gridTracker ) . into ( views . pager , pagerTracker ) ; // Setting up and animating image transition listAnimator . addPositionUpdateListener ( this :: applyFullPagerState ) ; }
Initializing grid - to - pager animation .