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

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

Update tiling handle color from outlineVariant to overviewBackground

Flag: com.android.window.flags.enable_tile_resizing
Test: on device testing of color, and flickr test will be added.
Bug: 406868616
Change-Id: Ie9835e84bf52d9a7e43705158c633e61f217a19e
parent 78a65802
Loading
Loading
Loading
Loading
+24 −22
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.wm.shell.windowdecor.tiling

import android.content.Context
import android.content.res.Configuration
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Rect
@@ -28,7 +27,7 @@ import android.view.PointerIcon
import android.view.View
import android.view.ViewConfiguration
import android.widget.FrameLayout
import androidx.compose.ui.graphics.toArgb
import com.android.internal.R as InternalR
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags
import com.android.wm.shell.R
@@ -94,13 +93,14 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion
        callback = dividerMoveCallback
        this.dividerBounds.set(dividerBounds)
        this.isDarkMode = isDarkMode
        paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb()
        paint.color = getDividerColor()
        handle.setIsLeftRightSplit(true)
        handle.setColor(getTilingHandleColor(isDarkMode), /* invalidateView= */ false)
        handle.alpha = HANDLE_ALPHA
        corners.setIsLeftRightSplit(true)
        corners.setRadiusResource(
            com.android.wm.shell.shared.R.dimen.desktop_windowing_freeform_rounded_corner_radius)
            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
@@ -116,15 +116,16 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion
    fun onUiModeChange(isDarkMode: Boolean) {
        this.isDarkMode = isDarkMode
        handle.setColor(getTilingHandleColor(isDarkMode), /* invalidateView= */ true)
        paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb()
        paint.color = getDividerColor()
        corners.setRoundCornerColor(paint.color, /* invalidateView= */ true)
        invalidate()
    }

    fun onTaskInfoChange() {
        decorThemeUtil = DecorThemeUtil(context)
        if (paint.color != decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb()) {
            paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb()
        val newColor = getDividerColor()
        if (paint.color != newColor) {
            paint.color = newColor
            corners.setRoundCornerColor(paint.color, /* invalidateView= */ true)
            invalidate()
        }
@@ -139,10 +140,7 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion
            resources.getDimensionPixelSize(R.dimen.docked_stack_divider_lift_elevation)
        setOnTouchListener(this)
        setWillNotDraw(false)
        val isDarkMode =
            context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK ==
                Configuration.UI_MODE_NIGHT_YES
        paint.color = decorThemeUtil.getColorScheme(isDarkMode).outlineVariant.toArgb()
        paint.color = getDividerColor()
        paint.isAntiAlias = true
        paint.style = Paint.Style.FILL
    }
@@ -177,6 +175,9 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion
            .start()
    }

    private fun getDividerColor(): Int =
        context.resources.getColor(InternalR.color.customColorOverviewBackground, context.theme)

    /**
     * Retrieves the tiling handle background color based on the current dark mode status.
     *
@@ -184,7 +185,8 @@ class TilingDividerView : FrameLayout, View.OnTouchListener, DragDetector.Motion
     * @return The integer color value for the tiling handle background.
     */
    private fun getTilingHandleColor(isDarkMode: Boolean): Int {
        val colorResId = if (isDarkMode) {
        val colorResId =
            if (isDarkMode) {
                R.color.tiling_handle_background_dark
            } else {
                R.color.tiling_handle_background_light