fix back button behavior
This commit is contained in:
parent
54414e1a4f
commit
bd9676c139
@ -458,7 +458,7 @@ public class FullPlaybackActivity extends SlidingPlaybackActivity
|
||||
mHandler.sendEmptyMessage(MSG_SAVE_CONTROLS);
|
||||
return true;
|
||||
case KeyEvent.KEYCODE_BACK:
|
||||
if (mSlidingView.isHidden() == false) {
|
||||
if (mSlidingView.isShrinkable()) {
|
||||
mSlidingView.hideSlide();
|
||||
return true;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class LibraryActivity
|
||||
case KeyEvent.KEYCODE_BACK:
|
||||
Limiter limiter = mPagerAdapter.getCurrentLimiter();
|
||||
|
||||
if (mSlidingView.isHidden() == false) {
|
||||
if (mSlidingView.isShrinkable()) {
|
||||
mSlidingView.hideSlide();
|
||||
break;
|
||||
}
|
||||
@ -439,7 +439,7 @@ public class LibraryActivity
|
||||
*/
|
||||
public void openPlaybackActivity()
|
||||
{
|
||||
if (mSlidingView.isExpanded())
|
||||
if (mSlidingView.isShrinkable())
|
||||
mSlidingView.hideSlideDelayed();
|
||||
startActivity(new Intent(this, FullPlaybackActivity.class));
|
||||
}
|
||||
@ -784,7 +784,7 @@ public class LibraryActivity
|
||||
menu.findItem(MENU_GO_HOME).setVisible(
|
||||
adapter != null &&
|
||||
adapter.getMediaType() == MediaUtils.TYPE_FILE &&
|
||||
!mSlidingView.isExpanded());
|
||||
(!mSlidingView.isShrinkable() || !mSlidingView.isFullyExpanded()));
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
@ -164,19 +164,27 @@ public class SlidingView extends FrameLayout
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the slide is fully hidden
|
||||
* Returns true if the slide is in its smallest stage
|
||||
*/
|
||||
public boolean isHidden() {
|
||||
public boolean isMinimized() {
|
||||
return mCurrentStage == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the slide is fully expanded
|
||||
*/
|
||||
public boolean isExpanded() {
|
||||
public boolean isFullyExpanded() {
|
||||
return mCurrentStage == (mStages.size()-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the slide can be minimized, that is:
|
||||
* It is not always visible and NOT in stage 0.
|
||||
*/
|
||||
public boolean isShrinkable() {
|
||||
return !mSliderAlwaysExpanded && !isMinimized();
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms to the new expansion state
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user