Prevent now playing from closing during resume

This commit is contained in:
Andrew Rabert 2018-07-03 17:44:09 -04:00
parent 2054ce5427
commit d3a317dc9e
1 changed files with 4 additions and 1 deletions

View File

@ -70,6 +70,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
private SlidingUpPanelLayout slideUpPanel; private SlidingUpPanelLayout slideUpPanel;
private SlidingUpPanelLayout.PanelSlideListener panelSlideListener; private SlidingUpPanelLayout.PanelSlideListener panelSlideListener;
private boolean isPanelClosing = false; private boolean isPanelClosing = false;
private boolean resuming = false;
private NowPlayingFragment nowPlayingFragment; private NowPlayingFragment nowPlayingFragment;
private SubsonicFragment secondaryFragment; private SubsonicFragment secondaryFragment;
private Toolbar mainToolbar; private Toolbar mainToolbar;
@ -342,6 +343,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
@Override @Override
public void onResume() { public void onResume() {
resuming = true;
super.onResume(); super.onResume();
if (getIntent().hasExtra(Constants.INTENT_EXTRA_VIEW_ALBUM)) { if (getIntent().hasExtra(Constants.INTENT_EXTRA_VIEW_ALBUM)) {
@ -365,6 +367,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
UserUtil.seedCurrentUser(this); UserUtil.seedCurrentUser(this);
createAccount(); createAccount();
runWhenServiceAvailable(() -> getDownloadService().addOnSongChangedListener(SubsonicFragmentActivity.this)); runWhenServiceAvailable(() -> getDownloadService().addOnSongChangedListener(SubsonicFragmentActivity.this));
resuming = false;
} }
@Override @Override
@ -489,7 +492,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
protected void drawerItemSelected(String fragmentType) { protected void drawerItemSelected(String fragmentType) {
super.drawerItemSelected(fragmentType); super.drawerItemSelected(fragmentType);
if (isNowPlayingOpen()) { if (isNowPlayingOpen() && !resuming) {
closeNowPlaying(); closeNowPlaying();
} }
} }