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

Commit d86df12d authored by Omar Elmekkawy's avatar Omar Elmekkawy
Browse files

Fixing tiling divider rounded corners and spec colors

This CL updates the divider/handle/rounded corner colors for the tiling
divider to match the design spec.

It also updates the rounded corner radius from being device dependent to
constant radius based on the latest design decisions.

Flag: com.android.window.flags.enable_tile_resizing

Test: unit tests and on device testing

Bug: 379664865, 382445299
Change-Id: Icbd67406ab266918d58756bba3b6212fe340649d
parent 7256f3b4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -68,4 +68,8 @@
    <color name="desktop_mode_caption_button_on_hover_light">#11000000</color>
    <color name="desktop_mode_caption_button_on_hover_dark">#11FFFFFF</color>
    <color name="desktop_mode_caption_button">#00000000</color>
    <color name="tiling_divider_background_light">#C9C7B6</color>
    <color name="tiling_divider_background_dark">#4A4739</color>
    <color name="tiling_handle_background_light">#000000</color>
    <color name="tiling_handle_background_dark">#FFFFFF</color>
</resources>
+34 −1
Original line number Diff line number Diff line
@@ -80,7 +80,19 @@ public class DividerHandleView extends View {
    private int mHoveringWidth;
    private int mHoveringHeight;
    private boolean mIsLeftRightSplit;
    private boolean mIsSplitScreen;

    /**
     * Notifies the divider of ui mode change.
     *
     * @param isDarkMode Whether the mode is ui dark mode.
     */
    public void onUiModeChange(boolean isDarkMode) {
        if (!mIsSplitScreen) {
            mPaint.setColor(getTilingHandleColor(isDarkMode));
            invalidate();
        }
    }
    public DividerHandleView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        mPaint.setColor(getResources().getColor(R.color.docked_divider_handle, null));
@@ -103,6 +115,27 @@ public class DividerHandleView extends View {
        mHoveringHeight = mHeight > mWidth ? ((int) (mHeight * 1.5f)) : mHeight;
    }

    /**
     * Used by tiling infrastructure to specify display light/dark mode and
     * whether handle colors should be overridden on display mode change in case
     * of non split screen.
     * @param isSplitScreen Whether the divider is used by split screen or tiling.
     * @param isDarkMode Whether the mode is ui dark mode.
     */
    public void setup(boolean isSplitScreen, boolean isDarkMode) {
        mIsSplitScreen = isSplitScreen;
        if (!mIsSplitScreen) {
            mPaint.setColor(getTilingHandleColor(isDarkMode));
            setAlpha(.9f);
        }
    }

    private int getTilingHandleColor(Boolean isDarkMode) {
        return isDarkMode ? getResources().getColor(
                R.color.tiling_handle_background_dark, null /* theme */) : getResources().getColor(
                R.color.tiling_handle_background_light, null /* theme */);
    }

    /** sets whether it's a left/right or top/bottom split */
    public void setIsLeftRightSplit(boolean isLeftRightSplit) {
        mIsLeftRightSplit = isLeftRightSplit;
+47 −2
Original line number Diff line number Diff line
@@ -47,15 +47,17 @@ public class DividerRoundedCorner extends View {
    private InvertedRoundedCornerDrawInfo mBottomLeftCorner;
    private InvertedRoundedCornerDrawInfo mBottomRightCorner;
    private boolean mIsLeftRightSplit;
    private boolean mIsSplitScreen;

    public DividerRoundedCorner(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        mDividerWidth = getResources().getDimensionPixelSize(R.dimen.split_divider_bar_width);
        mDividerBarBackground = new Paint();
        mDividerBarBackground.setColor(
                getResources().getColor(R.color.split_divider_background, null));
                getResources().getColor(R.color.split_divider_background, null /* theme */));
        mDividerBarBackground.setFlags(Paint.ANTI_ALIAS_FLAG);
        mDividerBarBackground.setStyle(Paint.Style.FILL);
        mIsSplitScreen = false;
    }

    @Override
@@ -98,8 +100,42 @@ public class DividerRoundedCorner extends View {
        return false;
    }

    /**
     * Used by tiling infrastructure to specify display light/dark mode and
     * whether handle colors should be overridden on display mode change in case
     * of non split screen.
     *
     * @param isSplitScreen Whether the divider is used by split screen or tiling.
     * @param isDarkMode    Whether the mode is ui dark mode.
     */
    public void setup(boolean isSplitScreen, boolean isDarkMode) {
        mIsSplitScreen = isSplitScreen;
        if (!isSplitScreen) {
            mDividerBarBackground.setColor(getTilingHandleColor(isDarkMode));
        }
    }

    /**
     * Notifies the divider of ui mode change.
     *
     * @param isDarkMode Whether the mode is ui dark mode.
     */
    public void onUiModeChange(boolean isDarkMode) {
        if (!mIsSplitScreen) {
            mDividerBarBackground.setColor(getTilingHandleColor(isDarkMode));
            invalidate();
        }
    }

    private int getTilingHandleColor(boolean isDarkMode) {
        return isDarkMode ? getResources().getColor(
                R.color.tiling_divider_background_dark, null /* theme */) : getResources().getColor(
                R.color.tiling_divider_background_light, null /* theme */);
    }

    /**
     * Set whether the rounded corner is for a left/right split.
     *
     * @param isLeftRightSplit whether it's a left/right split or top/bottom split.
     */
    public void setIsLeftRightSplit(boolean isLeftRightSplit) {
@@ -123,7 +159,16 @@ public class DividerRoundedCorner extends View {
            mCornerPosition = cornerPosition;

            final RoundedCorner roundedCorner = getDisplay().getRoundedCorner(cornerPosition);
            if (mIsSplitScreen) {
                mRadius = roundedCorner == null ? 0 : roundedCorner.getRadius();
            } else {
                mRadius = mContext
                        .getResources()
                        .getDimensionPixelSize(
                                com.android.wm.shell.shared.R.dimen
                                        .desktop_windowing_freeform_rounded_corner_radius);
            }


            // Starts with a filled square, and then subtracting out a circle from the appropriate
            // corner.
+1 −0
Original line number Diff line number Diff line
@@ -556,6 +556,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
        } else {
            decoration.relayout(taskInfo, taskInfo.isFocused, decoration.mExclusionRegion);
        }
        mDesktopTilingDecorViewModel.onTaskInfoChange(taskInfo);
        mActivityOrientationChangeHandler.ifPresent(handler ->
                handler.handleActivityOrientationChange(oldTaskInfo, taskInfo));
    }
+4 −0
Original line number Diff line number Diff line
@@ -136,6 +136,10 @@ class DesktopTilingDecorViewModel(
        }
    }

    fun onTaskInfoChange(taskInfo: RunningTaskInfo) {
        tilingTransitionHandlerByDisplayId.get(taskInfo.displayId)?.onTaskInfoChange(taskInfo)
    }

    override fun onDisplayChange(
        displayId: Int,
        fromRotation: Int,
Loading