Merge "Expand PIP to the normal size when menu actions don't fit" into sc-dev
This commit is contained in:
@@ -667,7 +667,9 @@ public class PipTouchHandler {
|
|||||||
// we store back to this snap fraction. Otherwise, we'll reset the snap
|
// we store back to this snap fraction. Otherwise, we'll reset the snap
|
||||||
// fraction and snap to the closest edge.
|
// fraction and snap to the closest edge.
|
||||||
if (resize) {
|
if (resize) {
|
||||||
animateToExpandedState(callback);
|
// PIP is too small to show the menu actions and thus needs to be resized to a
|
||||||
|
// size that can fit them all. Resize to the default size.
|
||||||
|
animateToNormalSize(callback);
|
||||||
}
|
}
|
||||||
} else if (menuState == MENU_STATE_NONE && mMenuState == MENU_STATE_FULL) {
|
} else if (menuState == MENU_STATE_NONE && mMenuState == MENU_STATE_FULL) {
|
||||||
// Try and restore the PiP to the closest edge, using the saved snap fraction
|
// Try and restore the PiP to the closest edge, using the saved snap fraction
|
||||||
@@ -721,22 +723,13 @@ public class PipTouchHandler {
|
|||||||
callback);
|
callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animateToMinimizedState() {
|
private void animateToNormalSize(Runnable callback) {
|
||||||
animateToUnexpandedState(new Rect(0, 0, mPipBoundsState.getMinSize().x,
|
|
||||||
mPipBoundsState.getMinSize().y));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void animateToExpandedState(Runnable callback) {
|
|
||||||
mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds());
|
mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds());
|
||||||
final Rect currentBounds = mPipBoundsState.getBounds();
|
final Rect normalBounds = new Rect(mPipBoundsState.getNormalBounds());
|
||||||
final Rect expandedBounds = mPipBoundsState.getExpandedBounds();
|
|
||||||
Rect finalExpandedBounds = new Rect(expandedBounds.width() > expandedBounds.width()
|
|
||||||
&& expandedBounds.height() > expandedBounds.height()
|
|
||||||
? currentBounds : expandedBounds);
|
|
||||||
Rect restoredMovementBounds = new Rect();
|
Rect restoredMovementBounds = new Rect();
|
||||||
mPipBoundsAlgorithm.getMovementBounds(finalExpandedBounds,
|
mPipBoundsAlgorithm.getMovementBounds(normalBounds,
|
||||||
mInsetBounds, restoredMovementBounds, mIsImeShowing ? mImeHeight : 0);
|
mInsetBounds, restoredMovementBounds, mIsImeShowing ? mImeHeight : 0);
|
||||||
mSavedSnapFraction = mMotionHelper.animateToExpandedState(finalExpandedBounds,
|
mSavedSnapFraction = mMotionHelper.animateToExpandedState(normalBounds,
|
||||||
mPipBoundsState.getMovementBounds(), restoredMovementBounds, callback);
|
mPipBoundsState.getMovementBounds(), restoredMovementBounds, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user