From 1fcdf57248ce8c361c7b3903e1b9507a54ba1b81 Mon Sep 17 00:00:00 2001 From: Andrew Rabert Date: Sun, 5 Mar 2017 01:30:37 -0500 Subject: [PATCH] Upgrade AndroidSlidingUpPanel to 3.3.0 --- app/build.gradle | 2 +- .../activity/SubsonicFragmentActivity.java | 74 ++++++++----------- 2 files changed, 33 insertions(+), 43 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 09740bf..7a255e3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,7 +39,7 @@ dependencies { compile 'com.android.support:mediarouter-v7:23.4.+' compile 'com.android.support:recyclerview-v7:23.4.+' compile 'com.android.support:design:23.4.+' - compile 'com.sothree.slidinguppanel:library:3.0.0' + compile 'com.sothree.slidinguppanel:library:3.3.0' compile group: 'org.eclipse.jetty', name: 'jetty-server', version:'8.1.16.v20140903' compile group: 'org.eclipse.jetty', name: 'jetty-servlet', version:'8.1.16.v20140903' compile group: 'org.eclipse.jetty', name: 'jetty-client', version:'8.1.16.v20140903' diff --git a/app/src/main/java/net/nullsum/audinaut/activity/SubsonicFragmentActivity.java b/app/src/main/java/net/nullsum/audinaut/activity/SubsonicFragmentActivity.java index 8d47635..c97a9c4 100644 --- a/app/src/main/java/net/nullsum/audinaut/activity/SubsonicFragmentActivity.java +++ b/app/src/main/java/net/nullsum/audinaut/activity/SubsonicFragmentActivity.java @@ -43,6 +43,7 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; +import com.sothree.slidinguppanel.SlidingUpPanelLayout.PanelState; import com.sothree.slidinguppanel.SlidingUpPanelLayout; import java.io.File; @@ -193,52 +194,41 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo } - @Override - public void onPanelCollapsed(View panel) { - isPanelClosing = false; - if(bottomBar.getVisibility() == View.GONE) { - bottomBar.setVisibility(View.VISIBLE); - nowPlayingToolbar.setVisibility(View.GONE); - nowPlayingFragment.setPrimaryFragment(false); - setSupportActionBar(mainToolbar); - recreateSpinner(); - } - } + @Override + public void onPanelStateChanged(View panel, PanelState previousState, PanelState newState) { + if (newState == PanelState.COLLAPSED) { + isPanelClosing = false; + if(bottomBar.getVisibility() == View.GONE) { + bottomBar.setVisibility(View.VISIBLE); + nowPlayingToolbar.setVisibility(View.GONE); + nowPlayingFragment.setPrimaryFragment(false); + setSupportActionBar(mainToolbar); + recreateSpinner(); + } + } else if (newState == PanelState.EXPANDED) { + isPanelClosing = false; + currentFragment.stopActionMode(); - @Override - public void onPanelExpanded(View panel) { - isPanelClosing = false; - currentFragment.stopActionMode(); + // Disable custom view before switching + getSupportActionBar().setDisplayShowCustomEnabled(false); + getSupportActionBar().setDisplayShowTitleEnabled(true); - // Disable custom view before switching - getSupportActionBar().setDisplayShowCustomEnabled(false); - getSupportActionBar().setDisplayShowTitleEnabled(true); + bottomBar.setVisibility(View.GONE); + nowPlayingToolbar.setVisibility(View.VISIBLE); + setSupportActionBar(nowPlayingToolbar); - bottomBar.setVisibility(View.GONE); - nowPlayingToolbar.setVisibility(View.VISIBLE); - setSupportActionBar(nowPlayingToolbar); + if(secondaryFragment == null) { + nowPlayingFragment.setPrimaryFragment(true); + } else { + secondaryFragment.setPrimaryFragment(true); + } - if(secondaryFragment == null) { - nowPlayingFragment.setPrimaryFragment(true); - } else { - secondaryFragment.setPrimaryFragment(true); - } - - drawerToggle.setDrawerIndicatorEnabled(false); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - } - - @Override - public void onPanelAnchored(View panel) { - - } - - @Override - public void onPanelHidden(View panel) { - - } + drawerToggle.setDrawerIndicatorEnabled(false); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + } + } }; - slideUpPanel.setPanelSlideListener(panelSlideListener); + slideUpPanel.addPanelSlideListener(panelSlideListener); if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD)) { // Post this later so it actually runs @@ -482,7 +472,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo } if(savedInstanceState.getInt(Constants.MAIN_SLIDE_PANEL_STATE, -1) == SlidingUpPanelLayout.PanelState.EXPANDED.hashCode()) { - panelSlideListener.onPanelExpanded(null); + panelSlideListener.onPanelStateChanged(null, null, PanelState.EXPANDED); } }