Hide slide if we are switching to FullPlaybackActivity due to a click
This commit is contained in:
parent
526adda336
commit
ffb2c1332a
@ -425,6 +425,8 @@ public class LibraryActivity
|
||||
*/
|
||||
public void openPlaybackActivity()
|
||||
{
|
||||
if (mSlidingView.isExpanded())
|
||||
mSlidingView.hideSlideDelayed();
|
||||
startActivity(new Intent(this, FullPlaybackActivity.class));
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,10 @@ public class SlidingView extends FrameLayout
|
||||
* TRUE if we started to move this view
|
||||
*/
|
||||
private boolean mDidScroll = false;
|
||||
/**
|
||||
* TRUE if we have to hide the slide on visibility changes
|
||||
*/
|
||||
private boolean mDelayedHide = false;
|
||||
/**
|
||||
* Reference to the gesture detector
|
||||
*/
|
||||
@ -140,6 +144,14 @@ public class SlidingView extends FrameLayout
|
||||
setExpansionStage(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as hideSlide(), but will fire after we are not
|
||||
* visible anymore
|
||||
*/
|
||||
public void hideSlideDelayed() {
|
||||
mDelayedHide = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the slide is fully hidden
|
||||
*/
|
||||
@ -147,6 +159,13 @@ public class SlidingView extends FrameLayout
|
||||
return mCurrentStage == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the slide is fully expanded
|
||||
*/
|
||||
public boolean isExpanded() {
|
||||
return mCurrentStage == (mStages.size()-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms to the new expansion state
|
||||
*
|
||||
@ -154,6 +173,8 @@ public class SlidingView extends FrameLayout
|
||||
*/
|
||||
private void setExpansionStage(int stage) {
|
||||
mCurrentStage = stage;
|
||||
mDelayedHide = false;
|
||||
|
||||
int pxOff = mStages.get(stage);
|
||||
this
|
||||
.animate()
|
||||
@ -255,6 +276,13 @@ public class SlidingView extends FrameLayout
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onWindowVisibilityChanged(int state) {
|
||||
super.onWindowVisibilityChanged(state);
|
||||
if (state == View.GONE && mDelayedHide) {
|
||||
hideSlide();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event){
|
||||
|
Loading…
x
Reference in New Issue
Block a user