private void setTrack ( SoundCloudTrack track ) { if ( track == null ) { mTitle . setText ( "" ) ; mArtwork . setImageDrawable ( null ) ; mPlayPause . setImageResource ( R . drawable . ic_play_white ) ; mSeekBar . setProgress ( 0 ) ; String none = String . format ( getResources ( ) . getString ( R . string . playback_view_time ) , 0 , 0 ) ; mCurrentTime . setText ( none ) ; mDuration . setText ( none ) ; } else { Picasso . with ( getContext ( ) ) . load ( SoundCloudArtworkHelper . getArtworkUrl ( track , SoundCloudArtworkHelper . XLARGE ) ) . fit ( ) . centerCrop ( ) . placeholder ( R . color . grey ) . into ( mArtwork ) ; mTitle . setText ( Html . fromHtml ( String . format ( getResources ( ) . getString ( R . string . playback_view_title ) , track . getArtist ( ) , track . getTitle ( ) ) ) ) ; mPlayPause . setImageResource ( R . drawable . ic_pause_white ) ; if ( getTranslationY ( ) != 0 ) { this . animate ( ) . translationY ( 0 ) ; } mSeekBar . setMax ( ( ( int ) track . getDurationInMilli ( ) ) ) ; String none = String . format ( getResources ( ) . getString ( R . string . playback_view_time ) , 0 , 0 ) ; int [ ] secondMinute = getSecondMinutes ( track . getDurationInMilli ( ) ) ; String duration = String . format ( getResources ( ) . getString ( R . string . playback_view_time ) , secondMinute [ 0 ] , secondMinute [ 1 ] ) ; mCurrentTime . setText ( none ) ; mDuration . setText ( duration ) ; } }
Set the current played track .