Buggy code:
public class MusicPlayer extends AppCompatActivity { public static final String ACTION_GET_PLAY_STATE = "get_play_state" ; public static final String ACTION_GET_SEEK_VALUE = "gte_seek_value" ; public static final String ACTION_GET_PLAYING_LIST = "get_playing_list" ; public static int mainColor ; private Toolbar toolbar ; private String songPath ; private String songName ; private String songDesc ; private String albumName ; private String songArt ; private TextView songNameView ; private TextView songArtistView ; private TextView currentTimeHolder ; private TextView totalTimeHolder ; private long albumId ; private NestedScrollView playerNestedScroll ; private SharedPreferences settingsPref ; private RecyclerView rv ; private LinearLayout detailHolder ; private CollapsingToolbarLayout collapsingToolbarLayout ; private ImageView playButton ; private ImageView rewindButton ; private ImageView nextButton ; private ImageView shuffleButton ; private ImageView header ; private PaperSeekBar seekBar ; private int duration ; private int currentDuration ; private boolean musicStoped ; private BroadcastReceiver musicPlayer = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { } } ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; settingsPref = PreferenceManager . getDefaultSharedPreferences ( getBaseContext ( ) ) ; if ( settingsPref . getBoolean ( "pref_album_status_trans" , true ) ) { if ( ( VERSION . SDK_INT ) >= 21 ) { getWindow ( ) . setStatusBarColor ( TRANSPARENT ) ; } } else { if ( ( VERSION . SDK_INT ) >= 21 ) { Window w = getWindow ( ) ; w . setFlags ( FLAG_TRANSLUCENT_STATUS , FLAG_TRANSLUCENT_STATUS ) ; } } <START_BUG> if ( settingsPref . getBoolean ( "pref_album_nav_trans" , false ) ) { <END_BUG> if ( ( VERSION . SDK_INT ) >= 21 ) { getWindow ( ) . getDecorView ( ) . setSystemUiVisibility ( SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION ) ; getWindow ( ) . setNavigationBarColor ( TRANSPARENT ) ; } } setContentView ( activity_player ) ; IntentFilter filter = new IntentFilter ( ) ; filter . addAction ( MusicPlayer . ACTION_GET_SEEK_VALUE ) ; filter . addAction ( MusicPlayer . ACTION_GET_PLAY_STATE ) ; filter . addAction ( MusicPlayer . ACTION_GET_PLAYING_LIST ) ; registerReceiver ( musicPlayer , filter ) ; if ( ( VERSION . SDK_INT ) >= ( VERSION_CODES . LOLLIPOP ) ) getWindow ( ) . setEnterTransition ( new Fade ( ) ) ; songPath = getIntent ( ) . getStringExtra ( "songPath" ) ; songName = getIntent ( ) . getStringExtra ( "songName" ) ; songDesc = getIntent ( ) . getStringExtra ( "songDesc" ) ; albumId = getIntent ( ) . getLongExtra ( "songAlbumId" , 0 ) ; albumName = getIntent ( ) . getStringExtra ( "songAlbumName" ) ; duration = getIntent ( ) . getIntExtra ( "songDuration" , 0 ) ; currentDuration = getIntent ( ) . getIntExtra ( "songCurrTime" , 0 ) ; init ( ) ; setButtons ( ) ; updateSeeker ( ) ; setSupportActionBar ( ( ( Toolbar ) ( findViewById ( toolbar_player ) ) ) ) ; getSupportActionBar ( ) . setDisplayHomeAsUpEnabled ( true ) ; Cursor cursor = getContentResolver ( ) . query ( EXTERNAL_CONTENT_URI , new String [ ] { Albums . _ID , Albums . ALBUM_ART } , ( ( Albums . _ID ) + "=?" ) , new String [ ] { String . valueOf ( albumId ) } , null ) ; if ( cursor . moveToFirst ( ) ) { songArt = cursor . getString ( cursor . getColumnIndex ( ALBUM_ART ) ) ; } BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = false ; options . inPreferredConfig = Config . RGB_565 ; options . inDither = true ; Drawable artWork = new android . graphics . drawable . BitmapDrawable ( BitmapFactory . decodeFile ( songArt , options ) ) ; ( ( ImageView ) ( findViewById ( R . id . header ) ) ) . setImageDrawable ( artWork ) ; songNameView . setText ( songName ) ; songArtistView . setText ( songDesc ) ; if ( ( songArt ) != null ) { Palette . generateAsync ( BitmapFactory . decodeFile ( songArt , options ) , new Palette . PaletteAsyncListener ( ) { @ Override public void onGenerated ( final Palette palette ) { try { MusicPlayer . mainColor = palette . getDarkVibrantSwatch ( ) . getRgb ( ) ; if ( ( VERSION . SDK_INT ) >= 21 ) { ActivityManager . TaskDescription taskDescription = new ActivityManager . TaskDescription ( getResources ( ) . getString ( app_name ) , BitmapFactory . decodeResource ( getResources ( ) , ic_launcher ) , palette . getDarkVibrantSwatch ( ) . getRgb ( ) ) ; setTaskDescription ( taskDescription ) ; } new com . architjn . acjmusicplayer . task . ColorAnimateAlbumView ( MusicPlayer . this , detailHolder , palette ) . execute ( ) ; } catch ( NullPointerException e ) { e . printStackTrace ( ) ; detailHolder . setBackgroundColor ( MusicPlayer . mainColor ) ; } finally { collapsingToolbarLayout . setContentScrimColor ( MusicPlayer . mainColor ) ; } } } ) ; } else { header . setImageResource ( default_artwork_dark ) ; } } private void updateSeeker ( ) { } private void setButtons ( ) { } private void init ( ) { } @ Override protected void onPause ( ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public void onResume ( ) { } @ Override public void onBackPressed ( ) { } }

Fix:
if ( settingsPref . getBoolean ( "pref_nav_trans" , false ) ) {