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

Commit ccb979d4 authored by Omar Elmekkawy's avatar Omar Elmekkawy Committed by Android (Google) Code Review
Browse files

Merge "Fixing tiling divider rounded corners and spec colors" into main

parents 0401f6e4 d86df12d
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line 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_light">#11000000</color>
    <color name="desktop_mode_caption_button_on_hover_dark">#11FFFFFF</color>
    <color name="desktop_mode_caption_button_on_hover_dark">#11FFFFFF</color>
    <color name="desktop_mode_caption_button">#00000000</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>
</resources>
+34 −1
Original line number Original line Diff line number Diff line
@@ -80,7 +80,19 @@ public class DividerHandleView extends View {
    private int mHoveringWidth;
    private int mHoveringWidth;
    private int mHoveringHeight;
    private int mHoveringHeight;
    private boolean mIsLeftRightSplit;
    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) {
    public DividerHandleView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
        mPaint.setColor(getResources().getColor(R.color.docked_divider_handle, null));
        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;
        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 */
    /** sets whether it's a left/right or top/bottom split */
    public void setIsLeftRightSplit(boolean isLeftRightSplit) {
    public void setIsLeftRightSplit(boolean isLeftRightSplit) {
        mIsLeftRightSplit = isLeftRightSplit;
        mIsLeftRightSplit = isLeftRightSplit;
+47 −2
Original line number Original line Diff line number Diff line
@@ -47,15 +47,17 @@ public class DividerRoundedCorner extends View {
    private InvertedRoundedCornerDrawInfo mBottomLeftCorner;
    private InvertedRoundedCornerDrawInfo mBottomLeftCorner;
    private InvertedRoundedCornerDrawInfo mBottomRightCorner;
    private InvertedRoundedCornerDrawInfo mBottomRightCorner;
    private boolean mIsLeftRightSplit;
    private boolean mIsLeftRightSplit;
    private boolean mIsSplitScreen;


    public DividerRoundedCorner(Context context, @Nullable AttributeSet attrs) {
    public DividerRoundedCorner(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
        mDividerWidth = getResources().getDimensionPixelSize(R.dimen.split_divider_bar_width);
        mDividerWidth = getResources().getDimensionPixelSize(R.dimen.split_divider_bar_width);
        mDividerBarBackground = new Paint();
        mDividerBarBackground = new Paint();
        mDividerBarBackground.setColor(
        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.setFlags(Paint.ANTI_ALIAS_FLAG);
        mDividerBarBackground.setStyle(Paint.Style.FILL);
        mDividerBarBackground.setStyle(Paint.Style.FILL);
        mIsSplitScreen = false;
    }
    }


    @Override
    @Override
@@ -98,8 +100,42 @@ public class DividerRoundedCorner extends View {
        return false;
        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.
     * Set whether the rounded corner is for a left/right split.
     *
     * @param isLeftRightSplit whether it's a left/right split or top/bottom split.
     * @param isLeftRightSplit whether it's a left/right split or top/bottom split.
     */
     */
    public void setIsLeftRightSplit(boolean isLeftRightSplit) {
    public void setIsLeftRightSplit(boolean isLeftRightSplit) {
@@ -123,7 +159,16 @@ public class DividerRoundedCorner extends View {
            mCornerPosition = cornerPosition;
            mCornerPosition = cornerPosition;


            final RoundedCorner roundedCorner = getDisplay().getRoundedCorner(cornerPosition);
            final RoundedCorner roundedCorner = getDisplay().getRoundedCorner(cornerPosition);
            if (mIsSplitScreen) {
                mRadius = roundedCorner == null ? 0 : roundedCorner.getRadius();
                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
            // Starts with a filled square, and then subtracting out a circle from the appropriate
            // corner.
            // corner.
+1 −0
Original line number Original line Diff line number Diff line
@@ -558,6 +558,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
        } else {
        } else {
            decoration.relayout(taskInfo, taskInfo.isFocused, decoration.mExclusionRegion);
            decoration.relayout(taskInfo, taskInfo.isFocused, decoration.mExclusionRegion);
        }
        }
        mDesktopTilingDecorViewModel.onTaskInfoChange(taskInfo);
        mActivityOrientationChangeHandler.ifPresent(handler ->
        mActivityOrientationChangeHandler.ifPresent(handler ->
                handler.handleActivityOrientationChange(oldTaskInfo, taskInfo));
                handler.handleActivityOrientationChange(oldTaskInfo, taskInfo));
    }
    }
+4 −0
Original line number Original line Diff line number Diff line
@@ -137,6 +137,10 @@ class DesktopTilingDecorViewModel(
        }
        }
    }
    }


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

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