private void setTrackListPadding ( ) { mPlaylistRecyclerView . getViewTreeObserver ( ) . addOnPreDrawListener ( new ViewTreeObserver . OnPreDrawListener ( ) { @ Override public boolean onPreDraw ( ) { mPlaylistRecyclerView . getViewTreeObserver ( ) . removeOnPreDrawListener ( this ) ; int headerListHeight = getResources ( ) . getDimensionPixelOffset ( R . dimen . playback_view_height ) ; mPlaylistRecyclerView . setPadding ( 0 , mPlaylistRecyclerView . getHeight ( ) - headerListHeight , 0 , 0 ) ; mPlaylistRecyclerView . setAdapter ( mPlaylistAdapter ) ; // attach the dismiss gesture. new SwipeToDismissGesture . Builder ( SwipeToDismissDirection . HORIZONTAL ) . on ( mPlaylistRecyclerView ) . apply ( new DismissStrategy ( ) ) . backgroundColor ( getResources ( ) . getColor ( R . color . grey ) ) . build ( ) ; // hide if current play playlist is empty. if ( mPlaylistTracks . isEmpty ( ) ) { mPlaybackView . setTranslationY ( headerListHeight ) ; } return true ; } } ) ; }
Used to position the track list at the bottom of the screen .