aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-07-07 19:13:03 -0700
committerScott Jackson <daneren2005@gmail.com>2015-07-07 19:13:03 -0700
commit4676b6ab68acd6d601958b1b4df45953b8dd090b (patch)
treebecc6629b012b90f709f3e931a6b7c8be50b8196 /app
parentd1f764cf95fbd4d1bb6c051f3f26e074f4fff646 (diff)
downloaddsub-4676b6ab68acd6d601958b1b4df45953b8dd090b.tar.gz
dsub-4676b6ab68acd6d601958b1b4df45953b8dd090b.tar.bz2
dsub-4676b6ab68acd6d601958b1b4df45953b8dd090b.zip
Fix panel state when rotating with panel expanded
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java13
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
2 files changed, 10 insertions, 4 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 0e9101f8..276a89d0 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -90,12 +90,12 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
private Handler handler = new Handler();
private SlidingUpPanelLayout slideUpPanel;
+ private SlidingUpPanelLayout.PanelSlideListener panelSlideListener;
private NowPlayingFragment nowPlayingFragment;
private Toolbar mainToolbar;
private Toolbar nowPlayingToolbar;
private ScheduledExecutorService executorService;
- private View slideUpFrame;
private View bottomBar;
private ImageView coverArtView;
private TextView trackView;
@@ -201,7 +201,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
}
slideUpPanel = (SlidingUpPanelLayout) findViewById(R.id.slide_up_panel);
- slideUpPanel.setPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
+ panelSlideListener = new SlidingUpPanelLayout.PanelSlideListener() {
@Override
public void onPanelSlide(View panel, float slideOffset) {
@@ -248,7 +248,8 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
public void onPanelHidden(View panel) {
}
- });
+ };
+ slideUpPanel.setPanelSlideListener(panelSlideListener);
if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD)) {
// Post this later so it actually runs
@@ -260,7 +261,6 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
}, 200);
}
- slideUpFrame = findViewById(R.id.slide_up_frame);
bottomBar = findViewById(R.id.bottom_bar);
mainToolbar = (Toolbar) findViewById(R.id.main_toolbar);
nowPlayingToolbar = (Toolbar) findViewById(R.id.now_playing_toolbar);
@@ -451,6 +451,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
savedInstanceState.putString(Constants.MAIN_NOW_PLAYING, nowPlayingFragment.getTag());
+ savedInstanceState.putInt(Constants.MAIN_SLIDE_PANEL_STATE, slideUpPanel.getPanelState().hashCode());
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
@@ -462,6 +463,10 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
if(drawerToggle != null && backStack.size() > 0) {
drawerToggle.setDrawerIndicatorEnabled(false);
}
+
+ if(savedInstanceState.getInt(Constants.MAIN_SLIDE_PANEL_STATE, -1) == SlidingUpPanelLayout.PanelState.EXPANDED.hashCode()) {
+ panelSlideListener.onPanelExpanded(null);
+ }
}
@Override
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
index 6252d0e4..95fabc23 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
@@ -173,6 +173,7 @@ public final class Constants {
public static final String MAIN_BACK_STACK = "backStackIds";
public static final String MAIN_BACK_STACK_SIZE = "backStackIdsSize";
public static final String MAIN_NOW_PLAYING = "nowPlayingId";
+ public static final String MAIN_SLIDE_PANEL_STATE = "slidePanelState";
public static final String FRAGMENT_LIST = "fragmentList";
public static final String FRAGMENT_LIST2 = "fragmentList2";
public static final String FRAGMENT_EXTRA = "fragmentExtra";