Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerHandleView.java +11 −28 Original line number Diff line number Diff line Loading @@ -80,19 +80,7 @@ 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)); Loading @@ -116,24 +104,19 @@ public class DividerHandleView extends View { } /** * 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. * Sets the color for the divider handle view. * Optionally invalidates the view to trigger a redraw if the change should be * reflected immediately. * * @param color The ARGB color to set for the divider handle view. * @param invalidateView True if the view should be invalidated * to redraw with the new color, false otherwise. */ public void setup(boolean isSplitScreen, boolean isDarkMode) { mIsSplitScreen = isSplitScreen; if (!mIsSplitScreen) { mPaint.setColor(getTilingHandleColor(isDarkMode)); setAlpha(.9f); } public void setColor(int color, boolean invalidateView) { mPaint.setColor(color); if (invalidateView) { invalidate(); } 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 */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerRoundedCorner.java +20 −37 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.util.AttributeSet; import android.view.RoundedCorner; import android.view.View; import androidx.annotation.DimenRes; import androidx.annotation.Nullable; import com.android.wm.shell.R; Loading @@ -47,7 +48,7 @@ public class DividerRoundedCorner extends View { private InvertedRoundedCornerDrawInfo mBottomLeftCorner; private InvertedRoundedCornerDrawInfo mBottomRightCorner; private boolean mIsLeftRightSplit; private boolean mIsSplitScreen; @DimenRes private int mRadiusResourceId = 0; public DividerRoundedCorner(Context context, @Nullable AttributeSet attrs) { super(context, attrs); Loading @@ -57,7 +58,6 @@ public class DividerRoundedCorner extends View { getResources().getColor(R.color.split_divider_background, null /* theme */)); mDividerBarBackground.setFlags(Paint.ANTI_ALIAS_FLAG); mDividerBarBackground.setStyle(Paint.Style.FILL); mIsSplitScreen = false; } @Override Loading Loading @@ -101,40 +101,28 @@ public class DividerRoundedCorner extends View { } /** * 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. * Sets the resource ID for the radius. This resource ID can be used to retrieve * dimension values for the radius from the application's resources. * If {@code radiusResId} is 0, the display's default round corner will be used. * * @param isSplitScreen Whether the divider is used by split screen or tiling. * @param color Rounded corner color. * @param radiusResId The resource ID of the radius dimension. */ public void setup(boolean isSplitScreen, int color) { mIsSplitScreen = isSplitScreen; if (!isSplitScreen) { mDividerBarBackground.setColor(color); } public void setRadiusResource(@DimenRes int radiusResId) { mRadiusResourceId = radiusResId; } /** * Notifies the divider of ui mode change and provides a new color. * Sets the color for the rounded corners of the divider bar background. * Optionally invalidates the view to trigger a redraw if the change should be * reflected immediately. * * @param color The new divider rounded corner color. * @param cornerColor The ARGB color to set for the rounded corners. * @param invalidateView True if the view should be invalidated * to redraw with the new color, false otherwise. */ public void onUiModeChange(int color) { if (!mIsSplitScreen) { mDividerBarBackground.setColor(color); invalidate(); } } /** * Notifies rounded corner view of color change. * * @param color The new divider rounded corner color. */ public void onCornerColorChange(int color) { if (!mIsSplitScreen) { mDividerBarBackground.setColor(color); public void setRoundCornerColor(int cornerColor, boolean invalidateView) { mDividerBarBackground.setColor(cornerColor); if (invalidateView) { invalidate(); } } Loading Loading @@ -164,18 +152,13 @@ public class DividerRoundedCorner extends View { InvertedRoundedCornerDrawInfo(@RoundedCorner.Position int cornerPosition) { mCornerPosition = cornerPosition; if (mRadiusResourceId == 0) { 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); mRadius = mContext.getResources().getDimensionPixelSize(mRadiusResourceId); } // Starts with a filled square, and then subtracting out a circle from the appropriate // corner. final Path square = new Path(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/tiling/TilingDividerView.kt +24 −5 Original line number Diff line number Diff line Loading @@ -96,9 +96,12 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion this.isDarkMode = isDarkMode paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb() handle.setIsLeftRightSplit(true) handle.setup(/* isSplitScreen= */ false, isDarkMode) handle.setColor(getTilingHandleColor(isDarkMode), /* invalidateView = */ false) handle.alpha = HANDLE_ALPHA corners.setIsLeftRightSplit(true) corners.setup(/* isSplitScreen= */ false, paint.color) corners.setRadiusResource( com.android.wm.shell.shared.R.dimen.desktop_windowing_freeform_rounded_corner_radius) corners.setRoundCornerColor(paint.color, /* invalidateView = */ false) handleRegionHeight = handleRegionSize.height handleRegionWidth = handleRegionSize.width initHandleYCoordinates() Loading @@ -112,9 +115,9 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion fun onUiModeChange(isDarkMode: Boolean) { this.isDarkMode = isDarkMode handle.onUiModeChange(isDarkMode) handle.setColor(getTilingHandleColor(isDarkMode), /* invalidateView = */ true) paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb() corners.onUiModeChange(paint.color) corners.setRoundCornerColor(paint.color, /* invalidateView = */ true) invalidate() } Loading @@ -122,7 +125,7 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion decorThemeUtil = DecorThemeUtil(context) if (paint.color != decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb()) { paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb() corners.onCornerColorChange(paint.color) corners.setRoundCornerColor(paint.color, /* invalidateView = */ true) invalidate() } } Loading Loading @@ -174,6 +177,21 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion .start() } /** * Retrieves the tiling handle background color based on the current dark mode status. * * @param isDarkMode A boolean indicating whether dark mode is currently active. * @return The integer color value for the tiling handle background. */ private fun getTilingHandleColor(isDarkMode: Boolean): Int { val colorResId = if (isDarkMode) { R.color.tiling_handle_background_dark } else { R.color.tiling_handle_background_light } return resources.getColor(colorResId, /* theme = */ null) } private fun releaseTouching() { handle.setTouching(false, true) handle Loading Loading @@ -284,6 +302,7 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion companion object { const val TOUCH_ANIMATION_DURATION: Long = 150 const val TOUCH_RELEASE_ANIMATION_DURATION: Long = 200 const val HANDLE_ALPHA = 0.9f private val TAG = TilingDividerView::class.java.simpleName } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerHandleView.java +11 −28 Original line number Diff line number Diff line Loading @@ -80,19 +80,7 @@ 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)); Loading @@ -116,24 +104,19 @@ public class DividerHandleView extends View { } /** * 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. * Sets the color for the divider handle view. * Optionally invalidates the view to trigger a redraw if the change should be * reflected immediately. * * @param color The ARGB color to set for the divider handle view. * @param invalidateView True if the view should be invalidated * to redraw with the new color, false otherwise. */ public void setup(boolean isSplitScreen, boolean isDarkMode) { mIsSplitScreen = isSplitScreen; if (!mIsSplitScreen) { mPaint.setColor(getTilingHandleColor(isDarkMode)); setAlpha(.9f); } public void setColor(int color, boolean invalidateView) { mPaint.setColor(color); if (invalidateView) { invalidate(); } 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 */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerRoundedCorner.java +20 −37 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.util.AttributeSet; import android.view.RoundedCorner; import android.view.View; import androidx.annotation.DimenRes; import androidx.annotation.Nullable; import com.android.wm.shell.R; Loading @@ -47,7 +48,7 @@ public class DividerRoundedCorner extends View { private InvertedRoundedCornerDrawInfo mBottomLeftCorner; private InvertedRoundedCornerDrawInfo mBottomRightCorner; private boolean mIsLeftRightSplit; private boolean mIsSplitScreen; @DimenRes private int mRadiusResourceId = 0; public DividerRoundedCorner(Context context, @Nullable AttributeSet attrs) { super(context, attrs); Loading @@ -57,7 +58,6 @@ public class DividerRoundedCorner extends View { getResources().getColor(R.color.split_divider_background, null /* theme */)); mDividerBarBackground.setFlags(Paint.ANTI_ALIAS_FLAG); mDividerBarBackground.setStyle(Paint.Style.FILL); mIsSplitScreen = false; } @Override Loading Loading @@ -101,40 +101,28 @@ public class DividerRoundedCorner extends View { } /** * 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. * Sets the resource ID for the radius. This resource ID can be used to retrieve * dimension values for the radius from the application's resources. * If {@code radiusResId} is 0, the display's default round corner will be used. * * @param isSplitScreen Whether the divider is used by split screen or tiling. * @param color Rounded corner color. * @param radiusResId The resource ID of the radius dimension. */ public void setup(boolean isSplitScreen, int color) { mIsSplitScreen = isSplitScreen; if (!isSplitScreen) { mDividerBarBackground.setColor(color); } public void setRadiusResource(@DimenRes int radiusResId) { mRadiusResourceId = radiusResId; } /** * Notifies the divider of ui mode change and provides a new color. * Sets the color for the rounded corners of the divider bar background. * Optionally invalidates the view to trigger a redraw if the change should be * reflected immediately. * * @param color The new divider rounded corner color. * @param cornerColor The ARGB color to set for the rounded corners. * @param invalidateView True if the view should be invalidated * to redraw with the new color, false otherwise. */ public void onUiModeChange(int color) { if (!mIsSplitScreen) { mDividerBarBackground.setColor(color); invalidate(); } } /** * Notifies rounded corner view of color change. * * @param color The new divider rounded corner color. */ public void onCornerColorChange(int color) { if (!mIsSplitScreen) { mDividerBarBackground.setColor(color); public void setRoundCornerColor(int cornerColor, boolean invalidateView) { mDividerBarBackground.setColor(cornerColor); if (invalidateView) { invalidate(); } } Loading Loading @@ -164,18 +152,13 @@ public class DividerRoundedCorner extends View { InvertedRoundedCornerDrawInfo(@RoundedCorner.Position int cornerPosition) { mCornerPosition = cornerPosition; if (mRadiusResourceId == 0) { 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); mRadius = mContext.getResources().getDimensionPixelSize(mRadiusResourceId); } // Starts with a filled square, and then subtracting out a circle from the appropriate // corner. final Path square = new Path(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/tiling/TilingDividerView.kt +24 −5 Original line number Diff line number Diff line Loading @@ -96,9 +96,12 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion this.isDarkMode = isDarkMode paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb() handle.setIsLeftRightSplit(true) handle.setup(/* isSplitScreen= */ false, isDarkMode) handle.setColor(getTilingHandleColor(isDarkMode), /* invalidateView = */ false) handle.alpha = HANDLE_ALPHA corners.setIsLeftRightSplit(true) corners.setup(/* isSplitScreen= */ false, paint.color) corners.setRadiusResource( com.android.wm.shell.shared.R.dimen.desktop_windowing_freeform_rounded_corner_radius) corners.setRoundCornerColor(paint.color, /* invalidateView = */ false) handleRegionHeight = handleRegionSize.height handleRegionWidth = handleRegionSize.width initHandleYCoordinates() Loading @@ -112,9 +115,9 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion fun onUiModeChange(isDarkMode: Boolean) { this.isDarkMode = isDarkMode handle.onUiModeChange(isDarkMode) handle.setColor(getTilingHandleColor(isDarkMode), /* invalidateView = */ true) paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb() corners.onUiModeChange(paint.color) corners.setRoundCornerColor(paint.color, /* invalidateView = */ true) invalidate() } Loading @@ -122,7 +125,7 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion decorThemeUtil = DecorThemeUtil(context) if (paint.color != decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb()) { paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb() corners.onCornerColorChange(paint.color) corners.setRoundCornerColor(paint.color, /* invalidateView = */ true) invalidate() } } Loading Loading @@ -174,6 +177,21 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion .start() } /** * Retrieves the tiling handle background color based on the current dark mode status. * * @param isDarkMode A boolean indicating whether dark mode is currently active. * @return The integer color value for the tiling handle background. */ private fun getTilingHandleColor(isDarkMode: Boolean): Int { val colorResId = if (isDarkMode) { R.color.tiling_handle_background_dark } else { R.color.tiling_handle_background_light } return resources.getColor(colorResId, /* theme = */ null) } private fun releaseTouching() { handle.setTouching(false, true) handle Loading Loading @@ -284,6 +302,7 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion companion object { const val TOUCH_ANIMATION_DURATION: Long = 150 const val TOUCH_RELEASE_ANIMATION_DURATION: Long = 200 const val HANDLE_ALPHA = 0.9f private val TAG = TilingDividerView::class.java.simpleName } }