Loading libs/WindowManager/Shell/res/drawable/desktop_mode_maximize_menu_layout_background.xml +1 −0 Original line number Diff line number Diff line Loading @@ -20,5 +20,6 @@ android:shape="rectangle"> <corners android:radius="@dimen/desktop_mode_maximize_menu_buttons_outline_radius"/> <solid android:color="?androidprv:attr/materialColorSurfaceContainerLow"/> <stroke android:width="1dp" android:color="?androidprv:attr/materialColorOutlineVariant"/> </shape> No newline at end of file libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_maximize_menu.xml +7 −15 Original line number Diff line number Diff line Loading @@ -31,23 +31,15 @@ android:layout_height="wrap_content" android:orientation="vertical"> <FrameLayout android:id="@+id/maximize_menu_maximize_button_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/desktop_mode_maximize_menu_layout_background" android:padding="4dp" android:layout_marginRight="8dp" android:layout_marginBottom="4dp" android:alpha="0"> <Button android:layout_width="94dp" android:layout_height="60dp" android:id="@+id/maximize_menu_maximize_button" style="?android:attr/buttonBarButtonStyle" android:layout_width="86dp" android:layout_height="@dimen/desktop_mode_maximize_menu_button_height" android:background="@drawable/desktop_mode_maximize_menu_button_background" android:stateListAnimator="@null"/> </FrameLayout> android:stateListAnimator="@null" android:layout_marginRight="8dp" android:layout_marginBottom="4dp" android:alpha="0"/> <TextView android:id="@+id/maximize_menu_maximize_window_text" Loading libs/WindowManager/Shell/res/values/dimen.xml +6 −0 Original line number Diff line number Diff line Loading @@ -482,6 +482,12 @@ <!-- The radius of the layout outline around the maximize menu buttons. --> <dimen name="desktop_mode_maximize_menu_buttons_outline_radius">6dp</dimen> <!-- The stroke width of the outline around the maximize menu buttons. --> <dimen name="desktop_mode_maximize_menu_buttons_outline_stroke">1dp</dimen> <!-- The radius of the inner fill of the maximize menu buttons. --> <dimen name="desktop_mode_maximize_menu_buttons_fill_radius">4dp</dimen> <!-- The padding between the outline and fill of the maximize menu buttons. --> <dimen name="desktop_mode_maximize_menu_buttons_fill_padding">4dp</dimen> <!-- The corner radius of the maximize menu. --> <dimen name="desktop_mode_maximize_menu_corner_radius">8dp</dimen> Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt +445 −157 File changed.Preview size limit exceeded, changes collapsed. Show changes libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ThemeUtils.kt +35 −0 Original line number Diff line number Diff line Loading @@ -15,11 +15,16 @@ */ package com.android.wm.shell.windowdecor.common import android.annotation.ColorInt import android.annotation.IntRange import android.app.ActivityManager.RunningTaskInfo import android.content.Context import android.content.res.Configuration import android.content.res.Configuration.UI_MODE_NIGHT_MASK import android.graphics.Color import androidx.compose.material3.ColorScheme import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme /** The theme of a window decoration. */ internal enum class Theme { LIGHT, DARK } Loading @@ -30,10 +35,31 @@ internal fun Theme.isLight(): Boolean = this == Theme.LIGHT /** Whether a [Theme] is dark. */ internal fun Theme.isDark(): Boolean = this == Theme.DARK /** Returns a copy of the color with its [alpha] component replaced with the given value. */ @ColorInt internal fun @receiver:ColorInt Int.withAlpha(@IntRange(from = 0, to = 255) alpha: Int): Int = Color.argb( alpha, Color.red(this), Color.green(this), Color.blue(this) ) /** Common opacity values used in window decoration views. */ const val OPACITY_100 = 255 const val OPACITY_11 = 28 const val OPACITY_12 = 31 const val OPACITY_15 = 38 const val OPACITY_40 = 102 const val OPACITY_55 = 140 const val OPACITY_65 = 166 /** * Utility class for determining themes based on system settings and app's [RunningTaskInfo]. */ internal class DecorThemeUtil(private val context: Context) { private val lightColors = dynamicLightColorScheme(context) private val darkColors = dynamicDarkColorScheme(context) private val systemTheme: Theme get() = if ((context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK) == Loading @@ -56,4 +82,13 @@ internal class DecorThemeUtil(private val context: Context) { Theme.LIGHT } } /** * Returns the [ColorScheme] to use to style window decorations based on the given * [RunningTaskInfo]. */ fun getColorScheme(task: RunningTaskInfo): ColorScheme = when (getAppTheme(task)) { Theme.LIGHT -> lightColors Theme.DARK -> darkColors } } Loading
libs/WindowManager/Shell/res/drawable/desktop_mode_maximize_menu_layout_background.xml +1 −0 Original line number Diff line number Diff line Loading @@ -20,5 +20,6 @@ android:shape="rectangle"> <corners android:radius="@dimen/desktop_mode_maximize_menu_buttons_outline_radius"/> <solid android:color="?androidprv:attr/materialColorSurfaceContainerLow"/> <stroke android:width="1dp" android:color="?androidprv:attr/materialColorOutlineVariant"/> </shape> No newline at end of file
libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_maximize_menu.xml +7 −15 Original line number Diff line number Diff line Loading @@ -31,23 +31,15 @@ android:layout_height="wrap_content" android:orientation="vertical"> <FrameLayout android:id="@+id/maximize_menu_maximize_button_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/desktop_mode_maximize_menu_layout_background" android:padding="4dp" android:layout_marginRight="8dp" android:layout_marginBottom="4dp" android:alpha="0"> <Button android:layout_width="94dp" android:layout_height="60dp" android:id="@+id/maximize_menu_maximize_button" style="?android:attr/buttonBarButtonStyle" android:layout_width="86dp" android:layout_height="@dimen/desktop_mode_maximize_menu_button_height" android:background="@drawable/desktop_mode_maximize_menu_button_background" android:stateListAnimator="@null"/> </FrameLayout> android:stateListAnimator="@null" android:layout_marginRight="8dp" android:layout_marginBottom="4dp" android:alpha="0"/> <TextView android:id="@+id/maximize_menu_maximize_window_text" Loading
libs/WindowManager/Shell/res/values/dimen.xml +6 −0 Original line number Diff line number Diff line Loading @@ -482,6 +482,12 @@ <!-- The radius of the layout outline around the maximize menu buttons. --> <dimen name="desktop_mode_maximize_menu_buttons_outline_radius">6dp</dimen> <!-- The stroke width of the outline around the maximize menu buttons. --> <dimen name="desktop_mode_maximize_menu_buttons_outline_stroke">1dp</dimen> <!-- The radius of the inner fill of the maximize menu buttons. --> <dimen name="desktop_mode_maximize_menu_buttons_fill_radius">4dp</dimen> <!-- The padding between the outline and fill of the maximize menu buttons. --> <dimen name="desktop_mode_maximize_menu_buttons_fill_padding">4dp</dimen> <!-- The corner radius of the maximize menu. --> <dimen name="desktop_mode_maximize_menu_corner_radius">8dp</dimen> Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt +445 −157 File changed.Preview size limit exceeded, changes collapsed. Show changes
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ThemeUtils.kt +35 −0 Original line number Diff line number Diff line Loading @@ -15,11 +15,16 @@ */ package com.android.wm.shell.windowdecor.common import android.annotation.ColorInt import android.annotation.IntRange import android.app.ActivityManager.RunningTaskInfo import android.content.Context import android.content.res.Configuration import android.content.res.Configuration.UI_MODE_NIGHT_MASK import android.graphics.Color import androidx.compose.material3.ColorScheme import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme /** The theme of a window decoration. */ internal enum class Theme { LIGHT, DARK } Loading @@ -30,10 +35,31 @@ internal fun Theme.isLight(): Boolean = this == Theme.LIGHT /** Whether a [Theme] is dark. */ internal fun Theme.isDark(): Boolean = this == Theme.DARK /** Returns a copy of the color with its [alpha] component replaced with the given value. */ @ColorInt internal fun @receiver:ColorInt Int.withAlpha(@IntRange(from = 0, to = 255) alpha: Int): Int = Color.argb( alpha, Color.red(this), Color.green(this), Color.blue(this) ) /** Common opacity values used in window decoration views. */ const val OPACITY_100 = 255 const val OPACITY_11 = 28 const val OPACITY_12 = 31 const val OPACITY_15 = 38 const val OPACITY_40 = 102 const val OPACITY_55 = 140 const val OPACITY_65 = 166 /** * Utility class for determining themes based on system settings and app's [RunningTaskInfo]. */ internal class DecorThemeUtil(private val context: Context) { private val lightColors = dynamicLightColorScheme(context) private val darkColors = dynamicDarkColorScheme(context) private val systemTheme: Theme get() = if ((context.resources.configuration.uiMode and UI_MODE_NIGHT_MASK) == Loading @@ -56,4 +82,13 @@ internal class DecorThemeUtil(private val context: Context) { Theme.LIGHT } } /** * Returns the [ColorScheme] to use to style window decorations based on the given * [RunningTaskInfo]. */ fun getColorScheme(task: RunningTaskInfo): ColorScheme = when (getAppTheme(task)) { Theme.LIGHT -> lightColors Theme.DARK -> darkColors } }