Merge "More minor menu changes" into sc-dev

This commit is contained in:
Winson Chung
2021-04-01 06:22:11 +00:00
committed by Android (Google) Code Review

View File

@@ -782,7 +782,6 @@ public class PipTouchHandler {
private final Point mStartPosition = new Point(); private final Point mStartPosition = new Point();
private final PointF mDelta = new PointF(); private final PointF mDelta = new PointF();
private boolean mShouldHideMenuAfterFling; private boolean mShouldHideMenuAfterFling;
private float mDownSavedFraction = -1f;
@Override @Override
public void onDown(PipTouchState touchState) { public void onDown(PipTouchState touchState) {
@@ -796,7 +795,6 @@ public class PipTouchHandler {
mMovementWithinDismiss = touchState.getDownTouchPosition().y mMovementWithinDismiss = touchState.getDownTouchPosition().y
>= mPipBoundsState.getMovementBounds().bottom; >= mPipBoundsState.getMovementBounds().bottom;
mMotionHelper.setSpringingToTouch(false); mMotionHelper.setSpringingToTouch(false);
mDownSavedFraction = mPipBoundsAlgorithm.getSnapFraction(mPipBoundsState.getBounds());
// If the menu is still visible then just poke the menu // If the menu is still visible then just poke the menu
// so that it will timeout after the user stops touching it // so that it will timeout after the user stops touching it
@@ -867,9 +865,12 @@ public class PipTouchHandler {
if (mEnableStash && shouldStash(vel, getPossiblyMotionBounds())) { if (mEnableStash && shouldStash(vel, getPossiblyMotionBounds())) {
mMotionHelper.stashToEdge(vel.x, vel.y, this::stashEndAction /* endAction */); mMotionHelper.stashToEdge(vel.x, vel.y, this::stashEndAction /* endAction */);
} else { } else {
mPipUiEventLogger.log( if (mPipBoundsState.isStashed()) {
PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_STASH_UNSTASHED); // Reset stashed state if previously stashed
mPipBoundsState.setStashed(STASH_TYPE_NONE); mPipUiEventLogger.log(
PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_STASH_UNSTASHED);
mPipBoundsState.setStashed(STASH_TYPE_NONE);
}
mMotionHelper.flingToSnapTarget(vel.x, vel.y, mMotionHelper.flingToSnapTarget(vel.x, vel.y,
this::flingEndAction /* endAction */); this::flingEndAction /* endAction */);
} }
@@ -896,19 +897,19 @@ public class PipTouchHandler {
mMotionHelper.expandLeavePip(); mMotionHelper.expandLeavePip();
} }
} else if (mMenuState != MENU_STATE_FULL) { } else if (mMenuState != MENU_STATE_FULL) {
if (!mTouchState.isWaitingForDoubleTap()) { if (mPipBoundsState.isStashed()) {
if (mPipBoundsState.isStashed()) { // Unstash immediately if stashed, and don't wait for the double tap timeout
animateToUnStashedState(); animateToUnStashedState();
mPipUiEventLogger.log( mPipUiEventLogger.log(
PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_STASH_UNSTASHED); PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_STASH_UNSTASHED);
mPipBoundsState.setStashed(STASH_TYPE_NONE); mPipBoundsState.setStashed(STASH_TYPE_NONE);
} else { mTouchState.removeDoubleTapTimeoutCallback();
// User has stalled long enough for this not to be a drag or a double tap, } else if (!mTouchState.isWaitingForDoubleTap()) {
// just expand the menu // User has stalled long enough for this not to be a drag or a double tap,
mMenuController.showMenu(MENU_STATE_FULL, mPipBoundsState.getBounds(), // just expand the menu
true /* allowMenuTimeout */, willResizeMenu(), mMenuController.showMenu(MENU_STATE_FULL, mPipBoundsState.getBounds(),
shouldShowResizeHandle()); true /* allowMenuTimeout */, willResizeMenu(),
} shouldShowResizeHandle());
} else { } else {
// Next touch event _may_ be the second tap for the double-tap, schedule a // Next touch event _may_ be the second tap for the double-tap, schedule a
// fallback runnable to trigger the menu if no touch event occurs before the // fallback runnable to trigger the menu if no touch event occurs before the
@@ -916,7 +917,6 @@ public class PipTouchHandler {
mTouchState.scheduleDoubleTapTimeoutCallback(); mTouchState.scheduleDoubleTapTimeoutCallback();
} }
} }
mDownSavedFraction = -1f;
return true; return true;
} }
@@ -932,6 +932,7 @@ public class PipTouchHandler {
PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_STASH_RIGHT); PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_STASH_RIGHT);
mPipBoundsState.setStashed(STASH_TYPE_RIGHT); mPipBoundsState.setStashed(STASH_TYPE_RIGHT);
} }
mMenuController.hideMenu();
} }
private void flingEndAction() { private void flingEndAction() {