diff options
Diffstat (limited to 'libs')
3 files changed, 16 insertions, 14 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java index 4b118f121767..a57eee83ef59 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java @@ -212,8 +212,8 @@ public class PhonePipMenuController implements PipMenuController { } @Nullable - Size getEstimatedMenuSize() { - return mPipMenuView == null ? null : mPipMenuView.getEstimatedMenuSize(); + Size getEstimatedMinMenuSize() { + return mPipMenuView == null ? null : mPipMenuView.getEstimatedMinMenuSize(); } /** diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java index 48942b604a8d..2df3e2ec1f81 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java @@ -367,15 +367,17 @@ public class PipMenuView extends FrameLayout { } /** - * @return estimated {@link Size} for which the width is based on number of actions and - * height based on the height of expand button + top and bottom action bar. + * @return Estimated minimum {@link Size} to hold the actions. + * See also {@link #updateActionViews(Rect)} */ - Size getEstimatedMenuSize() { - final int pipActionSize = mContext.getResources().getDimensionPixelSize( - R.dimen.pip_action_size); - final int width = mActions.size() * pipActionSize; - final int height = pipActionSize * 2 + mContext.getResources().getDimensionPixelSize( - R.dimen.pip_expand_action_size); + Size getEstimatedMinMenuSize() { + final int pipActionSize = getResources().getDimensionPixelSize(R.dimen.pip_action_size); + // the minimum width would be (2 * pipActionSize) since we have settings and dismiss button + // on the top action container. + final int width = Math.max(2, mActions.size()) * pipActionSize; + final int height = getResources().getDimensionPixelSize(R.dimen.pip_expand_action_size) + + getResources().getDimensionPixelSize(R.dimen.pip_action_padding) + + getResources().getDimensionPixelSize(R.dimen.pip_expand_container_edge_margin); return new Size(width, height); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java index bb6704333050..bc6bf7bff5a7 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java @@ -931,14 +931,14 @@ public class PipTouchHandler { if (!mEnableResize) { return false; } - final Size estimatedMenuSize = mMenuController.getEstimatedMenuSize(); - if (estimatedMenuSize == null) { + final Size estimatedMinMenuSize = mMenuController.getEstimatedMinMenuSize(); + if (estimatedMinMenuSize == null) { Log.wtf(TAG, "Failed to get estimated menu size"); return false; } final Rect currentBounds = mPipBoundsState.getBounds(); - return currentBounds.width() < estimatedMenuSize.getWidth() - || currentBounds.height() < estimatedMenuSize.getHeight(); + return currentBounds.width() < estimatedMinMenuSize.getWidth() + || currentBounds.height() < estimatedMinMenuSize.getHeight(); } /** |