Upgrade AndroidSlidingUpPanel to 3.3.0

This commit is contained in:
Andrew Rabert 2017-03-05 01:30:37 -05:00
parent e5c9a7b566
commit 1fcdf57248
2 changed files with 33 additions and 43 deletions

View File

@ -39,7 +39,7 @@ dependencies {
compile 'com.android.support:mediarouter-v7:23.4.+' compile 'com.android.support:mediarouter-v7:23.4.+'
compile 'com.android.support:recyclerview-v7:23.4.+' compile 'com.android.support:recyclerview-v7:23.4.+'
compile 'com.android.support:design: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-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-servlet', version:'8.1.16.v20140903'
compile group: 'org.eclipse.jetty', name: 'jetty-client', version:'8.1.16.v20140903' compile group: 'org.eclipse.jetty', name: 'jetty-client', version:'8.1.16.v20140903'

View File

@ -43,6 +43,7 @@ import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.sothree.slidinguppanel.SlidingUpPanelLayout.PanelState;
import com.sothree.slidinguppanel.SlidingUpPanelLayout; import com.sothree.slidinguppanel.SlidingUpPanelLayout;
import java.io.File; import java.io.File;
@ -193,52 +194,41 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
} }
@Override @Override
public void onPanelCollapsed(View panel) { public void onPanelStateChanged(View panel, PanelState previousState, PanelState newState) {
isPanelClosing = false; if (newState == PanelState.COLLAPSED) {
if(bottomBar.getVisibility() == View.GONE) { isPanelClosing = false;
bottomBar.setVisibility(View.VISIBLE); if(bottomBar.getVisibility() == View.GONE) {
nowPlayingToolbar.setVisibility(View.GONE); bottomBar.setVisibility(View.VISIBLE);
nowPlayingFragment.setPrimaryFragment(false); nowPlayingToolbar.setVisibility(View.GONE);
setSupportActionBar(mainToolbar); nowPlayingFragment.setPrimaryFragment(false);
recreateSpinner(); setSupportActionBar(mainToolbar);
} recreateSpinner();
} }
} else if (newState == PanelState.EXPANDED) {
isPanelClosing = false;
currentFragment.stopActionMode();
@Override // Disable custom view before switching
public void onPanelExpanded(View panel) { getSupportActionBar().setDisplayShowCustomEnabled(false);
isPanelClosing = false; getSupportActionBar().setDisplayShowTitleEnabled(true);
currentFragment.stopActionMode();
// Disable custom view before switching bottomBar.setVisibility(View.GONE);
getSupportActionBar().setDisplayShowCustomEnabled(false); nowPlayingToolbar.setVisibility(View.VISIBLE);
getSupportActionBar().setDisplayShowTitleEnabled(true); setSupportActionBar(nowPlayingToolbar);
bottomBar.setVisibility(View.GONE); if(secondaryFragment == null) {
nowPlayingToolbar.setVisibility(View.VISIBLE); nowPlayingFragment.setPrimaryFragment(true);
setSupportActionBar(nowPlayingToolbar); } else {
secondaryFragment.setPrimaryFragment(true);
}
if(secondaryFragment == null) { drawerToggle.setDrawerIndicatorEnabled(false);
nowPlayingFragment.setPrimaryFragment(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
} else { }
secondaryFragment.setPrimaryFragment(true); }
}
drawerToggle.setDrawerIndicatorEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public void onPanelAnchored(View panel) {
}
@Override
public void onPanelHidden(View panel) {
}
}; };
slideUpPanel.setPanelSlideListener(panelSlideListener); slideUpPanel.addPanelSlideListener(panelSlideListener);
if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD)) { if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD)) {
// Post this later so it actually runs // 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()) { if(savedInstanceState.getInt(Constants.MAIN_SLIDE_PANEL_STATE, -1) == SlidingUpPanelLayout.PanelState.EXPANDED.hashCode()) {
panelSlideListener.onPanelExpanded(null); panelSlideListener.onPanelStateChanged(null, null, PanelState.EXPANDED);
} }
} }