diff options
author | Tony Huang <tonyychuang@google.com> | 2020-05-14 06:17:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-05-14 06:17:21 +0000 |
commit | a08db2de291dc771b55e9bf3cacc51a6d2b2bc35 (patch) | |
tree | 7fbed9ca4fa7b3a65036e7ed4cab60c7990bc0fe | |
parent | c06c034ac771e9b1bc2a8da9490f794d067095a6 (diff) | |
parent | 413e9313133daa482d0fa3188573d5e311ff6fb9 (diff) |
Merge "Set allowTouches after the fling animation end" into rvc-dev
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java index 046837346d3a..e302fd73d785 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java @@ -815,6 +815,7 @@ public class PipTouchHandler { private class DefaultPipTouchGesture extends PipTouchGesture { private final Point mStartPosition = new Point(); private final PointF mDelta = new PointF(); + private boolean mShouldHideMenuAfterFling; @Override public void onDown(PipTouchState touchState) { @@ -892,21 +893,17 @@ public class PipTouchHandler { final float velocity = PointF.length(vel.x, vel.y); if (touchState.isDragging()) { - Runnable endAction = null; if (mMenuState != MENU_STATE_NONE) { // If the menu is still visible, then just poke the menu so that // it will timeout after the user stops touching it mMenuController.showMenu(mMenuState, mMotionHelper.getBounds(), true /* allowMenuTimeout */, willResizeMenu()); - } else { - // If the menu is not visible, then we can still be showing the activity for the - // dismiss overlay, so just finish it after the animation completes - endAction = mMenuController::hideMenu; } + mShouldHideMenuAfterFling = mMenuState == MENU_STATE_NONE; mMotionHelper.flingToSnapTarget(vel.x, vel.y, PipTouchHandler.this::updateDismissFraction /* updateAction */, - endAction /* endAction */); + this::flingEndAction /* endAction */); } else if (mTouchState.isDoubleTap()) { // Expand to fullscreen if this is a double tap // the PiP should be frozen until the transition ends @@ -927,6 +924,15 @@ public class PipTouchHandler { } return true; } + + private void flingEndAction() { + mTouchState.setAllowTouches(true); + if (mShouldHideMenuAfterFling) { + // If the menu is not visible, then we can still be showing the activity for the + // dismiss overlay, so just finish it after the animation completes + mMenuController.hideMenu(); + } + } }; /** |