Fix NPE when trying to use context before onCreate() is called;
This commit is contained in:
parent
900370b1b4
commit
b02e8ed6a0
1 changed files with 18 additions and 6 deletions
|
|
@ -79,18 +79,21 @@ public class MusicControllerActivity extends AbsFabActivity {
|
||||||
private int lastTextColor = -2;
|
private int lastTextColor = -2;
|
||||||
private Thread progressViewsUpdateThread;
|
private Thread progressViewsUpdateThread;
|
||||||
|
|
||||||
private final boolean opaqueStatusBar = PreferenceUtils.getInstance(this).opaqueStatusbarNowPlaying();
|
private boolean opaqueStatusBar;
|
||||||
private final boolean opaqueToolBar = opaqueStatusBar && PreferenceUtils.getInstance(this).opaqueToolbarNowPlaying();
|
private boolean opaqueToolBar;
|
||||||
private final boolean forceSquareAlbumArt = PreferenceUtils.getInstance(this).forceAlbumArtSquared();
|
private boolean forceSquareAlbumArt;
|
||||||
private final boolean largerTitleBox = PreferenceUtils.getInstance(this).largerTitleBoxNowPlaying();
|
private boolean largerTitleBox;
|
||||||
private final boolean alternativeProgressSlider = PreferenceUtils.getInstance(this).alternativeProgressSliderNowPlaying();
|
private boolean alternativeProgressSlider;
|
||||||
private final boolean showPlaybackControllerCard = PreferenceUtils.getInstance(this).playbackControllerCardNowPlaying();
|
private boolean showPlaybackControllerCard;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
setStatusBarTransparent();
|
setStatusBarTransparent();
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
initAppeareanceVars();
|
||||||
|
|
||||||
setContentView(alternativeProgressSlider ? R.layout.activity_music_controller_alternative_progress_slider : R.layout.activity_music_controller);
|
setContentView(alternativeProgressSlider ? R.layout.activity_music_controller_alternative_progress_slider : R.layout.activity_music_controller);
|
||||||
|
|
||||||
initViews();
|
initViews();
|
||||||
|
|
@ -140,6 +143,15 @@ public class MusicControllerActivity extends AbsFabActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initAppeareanceVars() {
|
||||||
|
opaqueStatusBar = PreferenceUtils.getInstance(this).opaqueStatusbarNowPlaying();
|
||||||
|
opaqueToolBar = opaqueStatusBar && PreferenceUtils.getInstance(this).opaqueToolbarNowPlaying();
|
||||||
|
forceSquareAlbumArt = PreferenceUtils.getInstance(this).forceAlbumArtSquared();
|
||||||
|
largerTitleBox = PreferenceUtils.getInstance(this).largerTitleBoxNowPlaying();
|
||||||
|
alternativeProgressSlider = PreferenceUtils.getInstance(this).alternativeProgressSliderNowPlaying();
|
||||||
|
showPlaybackControllerCard = PreferenceUtils.getInstance(this).playbackControllerCardNowPlaying();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue