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

Commit ba29461f authored by Jorge Gil's avatar Jorge Gil Committed by Automerger Merge Worker
Browse files

Merge "Replace View elevation with SC#setShadowRadius in handle menu" into...

Merge "Replace View elevation with SC#setShadowRadius in handle menu" into tm-qpr-dev am: 8de511ee am: ea977723 am: 00ae3889

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21651280



Change-Id: I5b0cf787ea24d02d9a07a2927121fc9e00b8b869
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2a95246b 00ae3889
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,6 +17,6 @@
<shape android:shape="rectangle"
       xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@android:color/white" />
    <corners android:radius="20dp" />
    <corners android:radius="@dimen/caption_menu_corner_radius" />
    <stroke android:width="1dp" android:color="#b3b3b3"/>
</shape>
+0 −1
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/desktop_mode_decor_menu_background"
    android:elevation="@dimen/caption_menu_elevation"
    android:divider="?android:attr/dividerHorizontal"
    android:showDividers="middle"
    android:dividerPadding="18dip">
+5 −1
Original line number Diff line number Diff line
@@ -370,6 +370,10 @@

    <dimen name="freeform_resize_corner">44dp</dimen>

    <dimen name="caption_menu_elevation">4dp</dimen>
    <!-- The radius of the caption menu shadow. -->
    <dimen name="caption_menu_shadow_radius">4dp</dimen>

    <!-- The radius of the caption menu corners. -->
    <dimen name="caption_menu_corner_radius">20dp</dimen>

</resources>
+7 −8
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
    private boolean mDesktopActive;
    private AdditionalWindow mHandleMenu;
    private final int mHandleMenuWidthId = R.dimen.freeform_decor_caption_menu_width;
    private final int mHandleMenuShadowRadiusId = R.dimen.caption_menu_shadow_radius;
    private final int mHandleMenuCornerRadiusId = R.dimen.caption_menu_corner_radius;
    private PointF mHandleMenuPosition = new PointF();

    DesktopModeWindowDecoration(
@@ -353,19 +355,16 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                .windowConfiguration.getBounds().width();
        final int menuWidth = loadDimensionPixelSize(resources, mHandleMenuWidthId);
        final int menuHeight = loadDimensionPixelSize(resources, mCaptionMenuHeightId);

        // Elevation gives the appearance of a changed x/y coordinate; this is to fix that
        int elevationOffset = 2 * loadDimensionPixelSize(resources,
                R.dimen.caption_menu_elevation);
        final int shadowRadius = loadDimensionPixelSize(resources, mHandleMenuShadowRadiusId);
        final int cornerRadius = loadDimensionPixelSize(resources, mHandleMenuCornerRadiusId);

        final int x = mRelayoutParams.mCaptionX + (captionWidth / 2) - (menuWidth / 2)
                - mResult.mDecorContainerOffsetX - elevationOffset;
        final int y =
                mRelayoutParams.mCaptionY - mResult.mDecorContainerOffsetY - elevationOffset;
                - mResult.mDecorContainerOffsetX;
        final int y = mRelayoutParams.mCaptionY - mResult.mDecorContainerOffsetY;
        mHandleMenuPosition.set(x, y);
        String namePrefix = "Caption Menu";
        mHandleMenu = addWindow(R.layout.desktop_mode_decor_handle_menu, namePrefix, t, x, y,
                menuWidth, menuHeight, 2 * elevationOffset);
                menuWidth, menuHeight, shadowRadius, cornerRadius);
        mSyncQueue.runInSync(transaction -> {
            transaction.merge(t);
            t.close();
+8 −6
Original line number Diff line number Diff line
@@ -391,11 +391,12 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>
     * @param yPos y position of new window
     * @param width width of new window
     * @param height height of new window
     * @param cropPadding padding to add to window crop to ensure shadows display properly
     * @return
     * @param shadowRadius radius of the shadow of the new window
     * @param cornerRadius radius of the corners of the new window
     * @return the {@link AdditionalWindow} that was added.
     */
    AdditionalWindow addWindow(int layoutId, String namePrefix, SurfaceControl.Transaction t,
            int xPos, int yPos, int width, int height, int cropPadding) {
            int xPos, int yPos, int width, int height, int shadowRadius, int cornerRadius) {
        final SurfaceControl.Builder builder = mSurfaceControlBuilderSupplier.get();
        SurfaceControl windowSurfaceControl = builder
                .setName(namePrefix + " of Task=" + mTaskInfo.taskId)
@@ -404,9 +405,10 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>
                .build();
        View v = LayoutInflater.from(mDecorWindowContext).inflate(layoutId, null);

        t.setPosition(
                windowSurfaceControl, xPos, yPos)
                .setWindowCrop(windowSurfaceControl, width + cropPadding, height + cropPadding)
        t.setPosition(windowSurfaceControl, xPos, yPos)
                .setWindowCrop(windowSurfaceControl, width, height)
                .setShadowRadius(windowSurfaceControl, shadowRadius)
                .setCornerRadius(windowSurfaceControl, cornerRadius)
                .show(windowSurfaceControl);
        final WindowManager.LayoutParams lp =
                new WindowManager.LayoutParams(width, height,
Loading