handle back button for slide

This commit is contained in:
Adrian Ulrich 2016-03-27 18:15:43 +02:00
parent 48fc99ac42
commit 6824ee229b
3 changed files with 24 additions and 6 deletions

View File

@ -456,11 +456,16 @@ public class FullPlaybackActivity extends PlaybackActivity
public boolean onKeyUp(int keyCode, KeyEvent event)
{
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
setControlsVisible(!mControlsVisible);
mHandler.sendEmptyMessage(MSG_SAVE_CONTROLS);
return true;
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
setControlsVisible(!mControlsVisible);
mHandler.sendEmptyMessage(MSG_SAVE_CONTROLS);
return true;
case KeyEvent.KEYCODE_BACK:
if (mSlidingView.isHidden() == false) {
mSlidingView.hideSlide();
return true;
}
}
return super.onKeyUp(keyCode, event);

View File

@ -281,8 +281,14 @@ public class LibraryActivity
case KeyEvent.KEYCODE_BACK:
Limiter limiter = mPagerAdapter.getCurrentLimiter();
if (mBottomBarControls.showSearch(false))
if (mSlidingView.isHidden() == false) {
mSlidingView.hideSlide();
break;
}
if (mBottomBarControls.showSearch(false)) {
break;
}
if (limiter != null) {
int pos = -1;

View File

@ -136,6 +136,13 @@ public class SlidingView extends FrameLayout
setExpansionStage(0);
}
/**
* Returns true if the slide is fully hidden
*/
public boolean isHidden() {
return mCurrentStage == 0;
}
/**
* Transforms to the new expansion state
*