Loading libs/WindowManager/Shell/res/layout/desktop_header_maximize_menu_button_progress_indicator_layout.xml 0 → 100644 +34 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="44dp" android:layout_height="40dp" android:importantForAccessibility="noHideDescendants"> <ProgressBar android:id="@+id/progress_bar" style="?android:attr/progressBarStyleHorizontal" android:progressDrawable="@drawable/circular_progress" android:layout_width="32dp" android:layout_height="32dp" android:indeterminate="false" android:layout_marginHorizontal="6dp" android:layout_marginVertical="4dp" android:visibility="invisible"/> </FrameLayout> libs/WindowManager/Shell/res/layout/maximize_menu_button.xml +6 −13 Original line number Original line Diff line number Diff line Loading @@ -17,21 +17,14 @@ <merge xmlns:android="http://schemas.android.com/apk/res/android" <merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> <FrameLayout <ViewStub android:id="@+id/stub_progress_bar_container" android:inflatedId="@+id/inflatedProgressBarContainer" android:layout="@layout/desktop_header_maximize_menu_button_progress_indicator_layout" android:layout_width="44dp" android:layout_width="44dp" android:layout_height="40dp" android:layout_height="40dp" android:importantForAccessibility="noHideDescendants"> android:importantForAccessibility="noHideDescendants" <ProgressBar /> android:id="@+id/progress_bar" style="?android:attr/progressBarStyleHorizontal" android:progressDrawable="@drawable/circular_progress" android:layout_width="32dp" android:layout_height="32dp" android:indeterminate="false" android:layout_marginHorizontal="6dp" android:layout_marginVertical="4dp" android:visibility="invisible"/> </FrameLayout> <ImageButton <ImageButton android:id="@+id/maximize_window" android:id="@+id/maximize_window" Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeButtonView.kt +30 −12 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.graphics.drawable.RippleDrawable import android.util.AttributeSet import android.util.AttributeSet import android.view.LayoutInflater import android.view.LayoutInflater import android.view.View import android.view.View import android.view.ViewStub import android.widget.FrameLayout import android.widget.FrameLayout import android.widget.ImageButton import android.widget.ImageButton import android.widget.ProgressBar import android.widget.ProgressBar Loading @@ -46,13 +47,17 @@ class MaximizeButtonView( private val hoverProgressAnimatorSet = AnimatorSet() private val hoverProgressAnimatorSet = AnimatorSet() var hoverDisabled = false var hoverDisabled = false private val progressBar: ProgressBar private lateinit var stubProgressBarContainer: ViewStub private val maximizeWindow: ImageButton private val maximizeWindow: ImageButton private val progressBar: ProgressBar by lazy { (stubProgressBarContainer.inflate() as FrameLayout) .requireViewById(R.id.progress_bar) } init { init { LayoutInflater.from(context).inflate(R.layout.maximize_menu_button, this, true) LayoutInflater.from(context).inflate(R.layout.maximize_menu_button, this, true) progressBar = requireViewById(R.id.progress_bar) stubProgressBarContainer = requireViewById(R.id.stub_progress_bar_container) maximizeWindow = requireViewById(R.id.maximize_window) maximizeWindow = requireViewById(R.id.maximize_window) } } Loading Loading @@ -115,21 +120,34 @@ class MaximizeButtonView( requireNotNull(rippleDrawable) { "Ripple drawable must be non-null" } requireNotNull(rippleDrawable) { "Ripple drawable must be non-null" } maximizeWindow.imageTintList = iconForegroundColor maximizeWindow.imageTintList = iconForegroundColor maximizeWindow.background = rippleDrawable maximizeWindow.background = rippleDrawable stubProgressBarContainer.setOnInflateListener { _, inflated -> val progressBar = (inflated as FrameLayout) .requireViewById(R.id.progress_bar) as ProgressBar progressBar.progressTintList = ColorStateList.valueOf(baseForegroundColor) progressBar.progressTintList = ColorStateList.valueOf(baseForegroundColor) .withAlpha(OPACITY_15) .withAlpha(OPACITY_15) progressBar.progressBackgroundTintList = ColorStateList.valueOf(Color.TRANSPARENT) progressBar.progressBackgroundTintList = ColorStateList.valueOf(Color.TRANSPARENT) } } else { } else { if (darkMode) { val progressTint = if (darkMode) { progressBar.progressTintList = ColorStateList.valueOf( ColorStateList.valueOf( resources.getColor(R.color.desktop_mode_maximize_menu_progress_dark)) resources.getColor(R.color.desktop_mode_maximize_menu_progress_dark)) maximizeWindow.background?.setTintList(ContextCompat.getColorStateList(context, R.color.desktop_mode_caption_button_color_selector_dark)) } else { } else { progressBar.progressTintList = ColorStateList.valueOf( ColorStateList.valueOf( resources.getColor(R.color.desktop_mode_maximize_menu_progress_light)) resources.getColor(R.color.desktop_mode_maximize_menu_progress_light)) maximizeWindow.background?.setTintList(ContextCompat.getColorStateList(context, R.color.desktop_mode_caption_button_color_selector_light)) } } val backgroundTint = if (darkMode) { ContextCompat.getColorStateList(context, R.color.desktop_mode_caption_button_color_selector_dark) } else { ContextCompat.getColorStateList(context, R.color.desktop_mode_caption_button_color_selector_light) } stubProgressBarContainer.setOnInflateListener { _, inflated -> val progressBar = (inflated as FrameLayout) .requireViewById(R.id.progress_bar) as ProgressBar progressBar.progressTintList = progressTint } maximizeWindow.background?.setTintList(backgroundTint) } } } } Loading Loading
libs/WindowManager/Shell/res/layout/desktop_header_maximize_menu_button_progress_indicator_layout.xml 0 → 100644 +34 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="44dp" android:layout_height="40dp" android:importantForAccessibility="noHideDescendants"> <ProgressBar android:id="@+id/progress_bar" style="?android:attr/progressBarStyleHorizontal" android:progressDrawable="@drawable/circular_progress" android:layout_width="32dp" android:layout_height="32dp" android:indeterminate="false" android:layout_marginHorizontal="6dp" android:layout_marginVertical="4dp" android:visibility="invisible"/> </FrameLayout>
libs/WindowManager/Shell/res/layout/maximize_menu_button.xml +6 −13 Original line number Original line Diff line number Diff line Loading @@ -17,21 +17,14 @@ <merge xmlns:android="http://schemas.android.com/apk/res/android" <merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> <FrameLayout <ViewStub android:id="@+id/stub_progress_bar_container" android:inflatedId="@+id/inflatedProgressBarContainer" android:layout="@layout/desktop_header_maximize_menu_button_progress_indicator_layout" android:layout_width="44dp" android:layout_width="44dp" android:layout_height="40dp" android:layout_height="40dp" android:importantForAccessibility="noHideDescendants"> android:importantForAccessibility="noHideDescendants" <ProgressBar /> android:id="@+id/progress_bar" style="?android:attr/progressBarStyleHorizontal" android:progressDrawable="@drawable/circular_progress" android:layout_width="32dp" android:layout_height="32dp" android:indeterminate="false" android:layout_marginHorizontal="6dp" android:layout_marginVertical="4dp" android:visibility="invisible"/> </FrameLayout> <ImageButton <ImageButton android:id="@+id/maximize_window" android:id="@+id/maximize_window" Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeButtonView.kt +30 −12 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.graphics.drawable.RippleDrawable import android.util.AttributeSet import android.util.AttributeSet import android.view.LayoutInflater import android.view.LayoutInflater import android.view.View import android.view.View import android.view.ViewStub import android.widget.FrameLayout import android.widget.FrameLayout import android.widget.ImageButton import android.widget.ImageButton import android.widget.ProgressBar import android.widget.ProgressBar Loading @@ -46,13 +47,17 @@ class MaximizeButtonView( private val hoverProgressAnimatorSet = AnimatorSet() private val hoverProgressAnimatorSet = AnimatorSet() var hoverDisabled = false var hoverDisabled = false private val progressBar: ProgressBar private lateinit var stubProgressBarContainer: ViewStub private val maximizeWindow: ImageButton private val maximizeWindow: ImageButton private val progressBar: ProgressBar by lazy { (stubProgressBarContainer.inflate() as FrameLayout) .requireViewById(R.id.progress_bar) } init { init { LayoutInflater.from(context).inflate(R.layout.maximize_menu_button, this, true) LayoutInflater.from(context).inflate(R.layout.maximize_menu_button, this, true) progressBar = requireViewById(R.id.progress_bar) stubProgressBarContainer = requireViewById(R.id.stub_progress_bar_container) maximizeWindow = requireViewById(R.id.maximize_window) maximizeWindow = requireViewById(R.id.maximize_window) } } Loading Loading @@ -115,21 +120,34 @@ class MaximizeButtonView( requireNotNull(rippleDrawable) { "Ripple drawable must be non-null" } requireNotNull(rippleDrawable) { "Ripple drawable must be non-null" } maximizeWindow.imageTintList = iconForegroundColor maximizeWindow.imageTintList = iconForegroundColor maximizeWindow.background = rippleDrawable maximizeWindow.background = rippleDrawable stubProgressBarContainer.setOnInflateListener { _, inflated -> val progressBar = (inflated as FrameLayout) .requireViewById(R.id.progress_bar) as ProgressBar progressBar.progressTintList = ColorStateList.valueOf(baseForegroundColor) progressBar.progressTintList = ColorStateList.valueOf(baseForegroundColor) .withAlpha(OPACITY_15) .withAlpha(OPACITY_15) progressBar.progressBackgroundTintList = ColorStateList.valueOf(Color.TRANSPARENT) progressBar.progressBackgroundTintList = ColorStateList.valueOf(Color.TRANSPARENT) } } else { } else { if (darkMode) { val progressTint = if (darkMode) { progressBar.progressTintList = ColorStateList.valueOf( ColorStateList.valueOf( resources.getColor(R.color.desktop_mode_maximize_menu_progress_dark)) resources.getColor(R.color.desktop_mode_maximize_menu_progress_dark)) maximizeWindow.background?.setTintList(ContextCompat.getColorStateList(context, R.color.desktop_mode_caption_button_color_selector_dark)) } else { } else { progressBar.progressTintList = ColorStateList.valueOf( ColorStateList.valueOf( resources.getColor(R.color.desktop_mode_maximize_menu_progress_light)) resources.getColor(R.color.desktop_mode_maximize_menu_progress_light)) maximizeWindow.background?.setTintList(ContextCompat.getColorStateList(context, R.color.desktop_mode_caption_button_color_selector_light)) } } val backgroundTint = if (darkMode) { ContextCompat.getColorStateList(context, R.color.desktop_mode_caption_button_color_selector_dark) } else { ContextCompat.getColorStateList(context, R.color.desktop_mode_caption_button_color_selector_light) } stubProgressBarContainer.setOnInflateListener { _, inflated -> val progressBar = (inflated as FrameLayout) .requireViewById(R.id.progress_bar) as ProgressBar progressBar.progressTintList = progressTint } maximizeWindow.background?.setTintList(backgroundTint) } } } } Loading