Loading res/flag(com.android.documentsui.flags.use_material3)/drawable/job_progress_badge.xml 0 → 100644 +24 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2025 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. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="?attr/colorError" /> <stroke android:color="?attr/colorSurfaceBright" android:width="@dimen/job_progress_toolbar_badge_outline_width" /> </shape> res/flag(com.android.documentsui.flags.use_material3)/layout/job_progress_toolbar_item.xml +24 −6 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,28 @@ limitations under the License. limitations under the License. --> --> <com.google.android.material.progressindicator.CircularProgressIndicator <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="48dp" android:layout_height="48dp"> <com.google.android.material.progressindicator.CircularProgressIndicator android:id="@+id/job_progress_toolbar_indicator" style="@style/JobProgressToolbarIndicatorStyle" style="@style/JobProgressToolbarIndicatorStyle" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:clickable="true" android:focusable="true" /> android:focusable="true" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" /> <ImageView android:id="@+id/job_progress_toolbar_badge" android:layout_width="@dimen/job_progress_toolbar_badge_diameter" android:layout_height="@dimen/job_progress_toolbar_badge_diameter" android:src="@drawable/job_progress_badge" android:visible="false" app:layout_constraintEnd_toEndOf="@id/job_progress_toolbar_indicator" app:layout_constraintTop_toTopOf="@id/job_progress_toolbar_indicator" /> </androidx.constraintlayout.widget.ConstraintLayout> res/flag(com.android.documentsui.flags.use_material3)/values/dimens_m3.xml +3 −0 Original line number Original line Diff line number Diff line Loading @@ -258,6 +258,9 @@ the space between the button the text/title. --> the space between the button the text/title. --> <dimen name="search_bar_text_margin_start_m3">@dimen/space_extra_small_6</dimen> <dimen name="search_bar_text_margin_start_m3">@dimen/space_extra_small_6</dimen> <dimen name="job_progress_toolbar_indicator_size">24dp</dimen> <dimen name="job_progress_toolbar_indicator_size">24dp</dimen> <dimen name="job_progress_toolbar_badge_outline_width">1dp</dimen> <!-- Includes outline. --> <dimen name="job_progress_toolbar_badge_diameter">10dp</dimen> <!-- The main margin is controlled above on paddingStart, zeroing toolbar_content_insets to <!-- The main margin is controlled above on paddingStart, zeroing toolbar_content_insets to avoid pushing the title or button further. --> avoid pushing the title or button further. --> <dimen name="toolbar_content_inset_start">0dp</dimen> <dimen name="toolbar_content_inset_start">0dp</dimen> Loading res/flag(com.android.documentsui.flags.use_material3)/values/styles_m3.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -37,7 +37,7 @@ <style name="JobProgressToolbarIndicatorStyle" parent="@style/Widget.Material3.CircularProgressIndicator.ExtraSmall"> <style name="JobProgressToolbarIndicatorStyle" parent="@style/Widget.Material3.CircularProgressIndicator.ExtraSmall"> <item name="android:background">?attr/actionBarItemBackground</item> <item name="android:background">?attr/actionBarItemBackground</item> <item name="indicatorSize">@dimen/job_progress_toolbar_indicator_size</item> <item name="indicatorSize">@dimen/job_progress_toolbar_indicator_size</item> <item name="indicatorInset">@dimen/space_extra_small_6</item> <item name="indicatorInset">0dp</item> </style> </style> <style name="ToolbarStyles" parent="@style/Widget.Material3.Toolbar"> <style name="ToolbarStyles" parent="@style/Widget.Material3.Toolbar"> Loading src/com/android/documentsui/JobPanelController.kt +7 −2 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.MenuItem import android.view.View import android.view.View import android.view.ViewGroup import android.view.ViewGroup import android.widget.Button import android.widget.Button import android.widget.ImageView import android.widget.PopupWindow import android.widget.PopupWindow import android.widget.ProgressBar import android.widget.ProgressBar import android.widget.TextView import android.widget.TextView Loading Loading @@ -308,7 +309,8 @@ class JobPanelController( menuItem?.let { menuItem?.let { Menus.setEnabledAndVisible(it, menuIconState !is MenuIconState.INVISIBLE) Menus.setEnabledAndVisible(it, menuIconState !is MenuIconState.INVISIBLE) val icon = it.actionView as ProgressBar val icon = it.actionView!! .findViewById<ProgressBar>(R.id.job_progress_toolbar_indicator) when (menuIconState) { when (menuIconState) { is MenuIconState.INDETERMINATE -> icon.isIndeterminate = true is MenuIconState.INDETERMINATE -> icon.isIndeterminate = true is MenuIconState.VISIBLE -> icon.apply { is MenuIconState.VISIBLE -> icon.apply { Loading @@ -317,6 +319,8 @@ class JobPanelController( } } is MenuIconState.INVISIBLE -> {} is MenuIconState.INVISIBLE -> {} } } val badge = it.actionView!!.findViewById<ImageView>(R.id.job_progress_toolbar_badge) badge.isVisible = menuIconState.hasFailures } } } } Loading @@ -325,7 +329,8 @@ class JobPanelController( */ */ @Suppress("ktlint:standard:comment-wrapping") @Suppress("ktlint:standard:comment-wrapping") fun setMenuItem(newMenuItem: MenuItem) { fun setMenuItem(newMenuItem: MenuItem) { val progressIcon = newMenuItem.actionView as ProgressBar val progressIcon = newMenuItem.actionView!! .findViewById<ProgressBar>(R.id.job_progress_toolbar_indicator) progressIcon.max = MAX_PROGRESS progressIcon.max = MAX_PROGRESS progressIcon.setOnClickListener { view -> progressIcon.setOnClickListener { view -> val panel = LayoutInflater.from(activityContext).inflate( val panel = LayoutInflater.from(activityContext).inflate( Loading Loading
res/flag(com.android.documentsui.flags.use_material3)/drawable/job_progress_badge.xml 0 → 100644 +24 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2025 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. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="?attr/colorError" /> <stroke android:color="?attr/colorSurfaceBright" android:width="@dimen/job_progress_toolbar_badge_outline_width" /> </shape>
res/flag(com.android.documentsui.flags.use_material3)/layout/job_progress_toolbar_item.xml +24 −6 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,28 @@ limitations under the License. limitations under the License. --> --> <com.google.android.material.progressindicator.CircularProgressIndicator <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="48dp" android:layout_height="48dp"> <com.google.android.material.progressindicator.CircularProgressIndicator android:id="@+id/job_progress_toolbar_indicator" style="@style/JobProgressToolbarIndicatorStyle" style="@style/JobProgressToolbarIndicatorStyle" android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:clickable="true" android:focusable="true" /> android:focusable="true" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" /> <ImageView android:id="@+id/job_progress_toolbar_badge" android:layout_width="@dimen/job_progress_toolbar_badge_diameter" android:layout_height="@dimen/job_progress_toolbar_badge_diameter" android:src="@drawable/job_progress_badge" android:visible="false" app:layout_constraintEnd_toEndOf="@id/job_progress_toolbar_indicator" app:layout_constraintTop_toTopOf="@id/job_progress_toolbar_indicator" /> </androidx.constraintlayout.widget.ConstraintLayout>
res/flag(com.android.documentsui.flags.use_material3)/values/dimens_m3.xml +3 −0 Original line number Original line Diff line number Diff line Loading @@ -258,6 +258,9 @@ the space between the button the text/title. --> the space between the button the text/title. --> <dimen name="search_bar_text_margin_start_m3">@dimen/space_extra_small_6</dimen> <dimen name="search_bar_text_margin_start_m3">@dimen/space_extra_small_6</dimen> <dimen name="job_progress_toolbar_indicator_size">24dp</dimen> <dimen name="job_progress_toolbar_indicator_size">24dp</dimen> <dimen name="job_progress_toolbar_badge_outline_width">1dp</dimen> <!-- Includes outline. --> <dimen name="job_progress_toolbar_badge_diameter">10dp</dimen> <!-- The main margin is controlled above on paddingStart, zeroing toolbar_content_insets to <!-- The main margin is controlled above on paddingStart, zeroing toolbar_content_insets to avoid pushing the title or button further. --> avoid pushing the title or button further. --> <dimen name="toolbar_content_inset_start">0dp</dimen> <dimen name="toolbar_content_inset_start">0dp</dimen> Loading
res/flag(com.android.documentsui.flags.use_material3)/values/styles_m3.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -37,7 +37,7 @@ <style name="JobProgressToolbarIndicatorStyle" parent="@style/Widget.Material3.CircularProgressIndicator.ExtraSmall"> <style name="JobProgressToolbarIndicatorStyle" parent="@style/Widget.Material3.CircularProgressIndicator.ExtraSmall"> <item name="android:background">?attr/actionBarItemBackground</item> <item name="android:background">?attr/actionBarItemBackground</item> <item name="indicatorSize">@dimen/job_progress_toolbar_indicator_size</item> <item name="indicatorSize">@dimen/job_progress_toolbar_indicator_size</item> <item name="indicatorInset">@dimen/space_extra_small_6</item> <item name="indicatorInset">0dp</item> </style> </style> <style name="ToolbarStyles" parent="@style/Widget.Material3.Toolbar"> <style name="ToolbarStyles" parent="@style/Widget.Material3.Toolbar"> Loading
src/com/android/documentsui/JobPanelController.kt +7 −2 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.MenuItem import android.view.View import android.view.View import android.view.ViewGroup import android.view.ViewGroup import android.widget.Button import android.widget.Button import android.widget.ImageView import android.widget.PopupWindow import android.widget.PopupWindow import android.widget.ProgressBar import android.widget.ProgressBar import android.widget.TextView import android.widget.TextView Loading Loading @@ -308,7 +309,8 @@ class JobPanelController( menuItem?.let { menuItem?.let { Menus.setEnabledAndVisible(it, menuIconState !is MenuIconState.INVISIBLE) Menus.setEnabledAndVisible(it, menuIconState !is MenuIconState.INVISIBLE) val icon = it.actionView as ProgressBar val icon = it.actionView!! .findViewById<ProgressBar>(R.id.job_progress_toolbar_indicator) when (menuIconState) { when (menuIconState) { is MenuIconState.INDETERMINATE -> icon.isIndeterminate = true is MenuIconState.INDETERMINATE -> icon.isIndeterminate = true is MenuIconState.VISIBLE -> icon.apply { is MenuIconState.VISIBLE -> icon.apply { Loading @@ -317,6 +319,8 @@ class JobPanelController( } } is MenuIconState.INVISIBLE -> {} is MenuIconState.INVISIBLE -> {} } } val badge = it.actionView!!.findViewById<ImageView>(R.id.job_progress_toolbar_badge) badge.isVisible = menuIconState.hasFailures } } } } Loading @@ -325,7 +329,8 @@ class JobPanelController( */ */ @Suppress("ktlint:standard:comment-wrapping") @Suppress("ktlint:standard:comment-wrapping") fun setMenuItem(newMenuItem: MenuItem) { fun setMenuItem(newMenuItem: MenuItem) { val progressIcon = newMenuItem.actionView as ProgressBar val progressIcon = newMenuItem.actionView!! .findViewById<ProgressBar>(R.id.job_progress_toolbar_indicator) progressIcon.max = MAX_PROGRESS progressIcon.max = MAX_PROGRESS progressIcon.setOnClickListener { view -> progressIcon.setOnClickListener { view -> val panel = LayoutInflater.from(activityContext).inflate( val panel = LayoutInflater.from(activityContext).inflate( Loading