Hide the PIP menu on double tap to resize
Bug: 178391622 Test: enter PIP, tap once to show menu, tap twice to resize - verify the menu is hidden immediately before the window is resized Change-Id: Ic6d973e38377d55524ff8e2224969d57698a7495
This commit is contained in:
@@ -375,17 +375,29 @@ public class PhonePipMenuController implements PipMenuController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the menu activity.
|
||||
* Hides the menu view.
|
||||
*/
|
||||
public void hideMenu() {
|
||||
hideMenu(true /* animate */, true /* resize */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the menu view.
|
||||
*
|
||||
* @param animate whether to animate the menu fadeout
|
||||
* @param resize whether or not to resize the PiP with the state change
|
||||
*/
|
||||
public void hideMenu(boolean animate, boolean resize) {
|
||||
final boolean isMenuVisible = isMenuVisible();
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "hideMenu() state=" + mMenuState
|
||||
+ " isMenuVisible=" + isMenuVisible
|
||||
+ " animate=" + animate
|
||||
+ " resize=" + resize
|
||||
+ " callers=\n" + Debug.getCallers(5, " "));
|
||||
}
|
||||
if (isMenuVisible) {
|
||||
mPipMenuView.hideMenu();
|
||||
mPipMenuView.hideMenu(animate, resize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,6 @@ public class PipMenuView extends FrameLayout {
|
||||
private static final boolean ENABLE_RESIZE_HANDLE = false;
|
||||
|
||||
private int mMenuState;
|
||||
private boolean mResize = true;
|
||||
private boolean mAllowMenuTimeout = true;
|
||||
private boolean mAllowTouches = true;
|
||||
|
||||
@@ -329,16 +328,21 @@ public class PipMenuView extends FrameLayout {
|
||||
hideMenu(null);
|
||||
}
|
||||
|
||||
void hideMenu(boolean animate, boolean resize) {
|
||||
hideMenu(null, true /* notifyMenuVisibility */, animate, resize);
|
||||
}
|
||||
|
||||
void hideMenu(Runnable animationEndCallback) {
|
||||
hideMenu(animationEndCallback, true /* notifyMenuVisibility */, true /* animate */);
|
||||
hideMenu(animationEndCallback, true /* notifyMenuVisibility */, true /* animate */,
|
||||
true /* resize */);
|
||||
}
|
||||
|
||||
private void hideMenu(final Runnable animationFinishedRunnable, boolean notifyMenuVisibility,
|
||||
boolean animate) {
|
||||
boolean animate, boolean resize) {
|
||||
if (mMenuState != MENU_STATE_NONE) {
|
||||
cancelDelayedHide();
|
||||
if (notifyMenuVisibility) {
|
||||
notifyMenuStateChange(MENU_STATE_NONE, mResize, null);
|
||||
notifyMenuStateChange(MENU_STATE_NONE, resize, null);
|
||||
}
|
||||
mMenuContainerAnimator = new AnimatorSet();
|
||||
ObjectAnimator menuAnim = ObjectAnimator.ofFloat(mMenuContainer, View.ALPHA,
|
||||
@@ -469,7 +473,8 @@ public class PipMenuView extends FrameLayout {
|
||||
private void expandPip() {
|
||||
// Do not notify menu visibility when hiding the menu, the controller will do this when it
|
||||
// handles the message
|
||||
hideMenu(mController::onPipExpand, false /* notifyMenuVisibility */, true /* animate */);
|
||||
hideMenu(mController::onPipExpand, false /* notifyMenuVisibility */, true /* animate */,
|
||||
true /* resize */);
|
||||
}
|
||||
|
||||
private void dismissPip() {
|
||||
@@ -479,7 +484,8 @@ public class PipMenuView extends FrameLayout {
|
||||
final boolean animate = mMenuState != MENU_STATE_CLOSE;
|
||||
// Do not notify menu visibility when hiding the menu, the controller will do this when it
|
||||
// handles the message
|
||||
hideMenu(mController::onPipDismiss, false /* notifyMenuVisibility */, animate);
|
||||
hideMenu(mController::onPipDismiss, false /* notifyMenuVisibility */, animate,
|
||||
true /* resize */);
|
||||
}
|
||||
|
||||
private void showSettings() {
|
||||
|
||||
@@ -876,6 +876,9 @@ public class PipTouchHandler {
|
||||
< mPipBoundsState.getMaxSize().x
|
||||
&& mPipBoundsState.getBounds().height()
|
||||
< mPipBoundsState.getMaxSize().y;
|
||||
if (mMenuController.isMenuVisible()) {
|
||||
mMenuController.hideMenu(false /* animate */, false /* resize */);
|
||||
}
|
||||
if (toExpand) {
|
||||
mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds());
|
||||
animateToMaximizedState(null);
|
||||
|
||||
Reference in New Issue
Block a user