summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wenbo Jie <wenbojie@google.com> 2024-12-17 01:09:40 +0000
committer Wenbo Jie <wenbojie@google.com> 2024-12-17 01:24:08 +0000
commit1677a70605b0fcfe1669c3acc164a29e66f15822 (patch)
treec97391688c23ed87093a7ed3145cfb8cb41356d8
parent07f9eded27ccfa5978d2c3e3ce4f5487a5d2d87e (diff)
[DocsUI M3] Restyle the nav tree in drawer layout
The toolbar inside the drawer is removed as per spec. Check the demo in the bug item. Bug: 381959113 Test: Manual inpsection Flag: com.android.documentsui.flags.use_material3 Change-Id: I4de1377afb5f6a0e629ab183b5c27c8ac98a71c4
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/layout/drawer_layout.xml16
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/values-w900dp/dimens.xml2
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/values/dimens.xml2
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/values/styles_text.xml5
-rw-r--r--src/com/android/documentsui/ActionModeController.java14
-rw-r--r--src/com/android/documentsui/DrawerController.java7
6 files changed, 23 insertions, 23 deletions
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/layout/drawer_layout.xml b/res/flag(com.android.documentsui.flags.use_material3)/layout/drawer_layout.xml
index 1bf8d9bbd..8499c0112 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/layout/drawer_layout.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/layout/drawer_layout.xml
@@ -32,7 +32,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:paddingTop="@dimen/main_container_padding_top">
+ android:paddingTop="@dimen/main_container_padding_top"
+ android:background="?attr/colorSurfaceBright">
<FrameLayout
android:layout_width="match_parent"
@@ -85,18 +86,7 @@
android:layout_width="256dp"
android:layout_height="match_parent"
android:layout_gravity="start"
- android:orientation="vertical"
- android:elevation="0dp"
- android:background="?android:attr/colorBackground">
-
- <com.google.android.material.appbar.MaterialToolbar
- android:id="@+id/roots_toolbar"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/actionBarSize"
- android:background="?android:attr/colorBackground"
- android:elevation="0dp"
- app:titleTextAppearance="@style/DrawerMenuTitle"
- app:titleTextColor="?android:colorAccent"/>
+ android:orientation="vertical">
<FrameLayout
android:id="@+id/container_roots"
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/values-w900dp/dimens.xml b/res/flag(com.android.documentsui.flags.use_material3)/values-w900dp/dimens.xml
index c278dd8c9..99dd14794 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/values-w900dp/dimens.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/values-w900dp/dimens.xml
@@ -33,4 +33,6 @@
<dimen name="main_container_padding_top">@dimen/space_extra_small_6</dimen>
<dimen name="toolbar_padding_end">@dimen/space_small_3</dimen>
+
+ <dimen name="drawer_padding_top">@dimen/space_small_1</dimen>
</resources>
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/values/dimens.xml b/res/flag(com.android.documentsui.flags.use_material3)/values/dimens.xml
index d4199a026..a9edb65b0 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/values/dimens.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/values/dimens.xml
@@ -64,7 +64,7 @@
<dimen name="drawer_edge_width">12dp</dimen>
<dimen name="drawer_padding_horizontal">@dimen/space_extra_small_6</dimen>
- <dimen name="drawer_padding_top">@dimen/space_medium_1</dimen>
+ <dimen name="drawer_padding_top">@dimen/space_small_3</dimen>
<dimen name="drawer_padding_bottom">@dimen/space_small_1</dimen>
<dimen name="drawer_divider_padding_horizontal">16dp</dimen>
<dimen name="drawer_divider_padding_vertical">@dimen/space_extra_small_4</dimen>
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/values/styles_text.xml b/res/flag(com.android.documentsui.flags.use_material3)/values/styles_text.xml
index 2f83cbd3c..f0c3fd93b 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/values/styles_text.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/values/styles_text.xml
@@ -70,11 +70,6 @@
<item name="fontFamily">@string/config_fontFamilyMedium</item>
</style>
- <style name="DrawerMenuTitle" parent="@style/TextAppearance.Material3.TitleLarge">
- <item name="android:textSize">24sp</item>
- <item name="fontFamily">@string/config_fontFamilyMedium</item>
- </style>
-
<style name="DrawerMenuHeader" parent="@style/TextAppearance.Material3.BodyLarge">
<item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:textAllCaps">true</item>
diff --git a/src/com/android/documentsui/ActionModeController.java b/src/com/android/documentsui/ActionModeController.java
index 1bd4eea3c..39a50abf9 100644
--- a/src/com/android/documentsui/ActionModeController.java
+++ b/src/com/android/documentsui/ActionModeController.java
@@ -17,6 +17,7 @@
package com.android.documentsui;
import static com.android.documentsui.base.SharedMinimal.DEBUG;
+import static com.android.documentsui.flags.Flags.useMaterial3;
import android.app.Activity;
import android.util.Log;
@@ -134,8 +135,12 @@ public class ActionModeController extends SelectionObserver<String>
mActivity.getWindow().setTitle(mActivity.getTitle());
// Re-enable TalkBack for the toolbars, as they are no longer covered by action mode.
+ int[] toolbarIds =
+ useMaterial3()
+ ? new int[] {R.id.toolbar}
+ : new int[] {R.id.toolbar, R.id.roots_toolbar};
mScope.accessibilityImportanceSetter.setAccessibilityImportance(
- View.IMPORTANT_FOR_ACCESSIBILITY_AUTO, R.id.toolbar, R.id.roots_toolbar);
+ View.IMPORTANT_FOR_ACCESSIBILITY_AUTO, toolbarIds);
mNavigator.setActionModeActivated(false);
}
@@ -151,10 +156,13 @@ public class ActionModeController extends SelectionObserver<String>
// Hide the toolbars if action mode is enabled, so TalkBack doesn't navigate to
// these controls when using linear navigation.
+ int[] toolbarIds =
+ useMaterial3()
+ ? new int[] {R.id.toolbar}
+ : new int[] {R.id.toolbar, R.id.roots_toolbar};
mScope.accessibilityImportanceSetter.setAccessibilityImportance(
View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS,
- R.id.toolbar,
- R.id.roots_toolbar);
+ toolbarIds);
return true;
}
diff --git a/src/com/android/documentsui/DrawerController.java b/src/com/android/documentsui/DrawerController.java
index 56b3a879f..a988635fd 100644
--- a/src/com/android/documentsui/DrawerController.java
+++ b/src/com/android/documentsui/DrawerController.java
@@ -17,6 +17,7 @@
package com.android.documentsui;
import static com.android.documentsui.base.SharedMinimal.DEBUG;
+import static com.android.documentsui.flags.Flags.useMaterial3;
import android.app.Activity;
import android.util.Log;
@@ -59,6 +60,8 @@ public abstract class DrawerController implements DrawerListener {
}
View drawer = activity.findViewById(R.id.drawer_roots);
+ // This will be null in M3, we will check the flag when it's used in
+ // RuntimeDrawerController.
Toolbar toolbar = (Toolbar) activity.findViewById(R.id.roots_toolbar);
drawer.getLayoutParams().width = calculateDrawerWidth(activity);
@@ -202,7 +205,9 @@ public abstract class DrawerController implements DrawerListener {
@Override
void setTitle(String title) {
- mToolbar.setTitle(title);
+ if (!useMaterial3()) {
+ mToolbar.setTitle(title);
+ }
}
@Override