Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7361f8d authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Adjust the estimated minimum size of PiP menu" into sc-dev

parents 4f3e9493 0dc09244
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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();
    }

    /**
+10 −8
Original line number Diff line number Diff line
@@ -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);
    }

+4 −4
Original line number Diff line number Diff line
@@ -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();
    }

    /**