From 87b24705a93fe7db4a442ff02d823c94cc760d1f Mon Sep 17 00:00:00 2001 From: Wenbo Jie Date: Fri, 17 Jan 2025 05:03:50 +0000 Subject: [DocsUI M3] Split the main container into 3 sections * Split the main container section (right part) into 3 sub sections: app bar and search chips, file list/grid, file path bar (breadcrumb), add gap between the 3 sub sections and add corner radius. Note: this doesn't impact the compact layout. * Remove the additional bottom padding for both nav tree and directory list in full screen mode. * Removes the bottom border for table header as per spec. * Explicitly specify background color for breadcrumb in compact screen to avoid overlap between the file list and the breadcrumb area. Check the attached bug for demo video. Bug: 387869597 Test: m DocumentsUIGoogle && manual inspection Flag: com.android.documentsui.flags.use_material3 Change-Id: Ib7f7e8837d7486a0e902604386f802322e557ab0 --- .../drawable/main_container_background.xml | 20 ------ .../main_container_bottom_section_background.xml | 24 +++++++ .../main_container_middle_section_background.xml | 20 ++++++ .../main_container_top_section_background.xml | 24 +++++++ .../drawable/sort_widget_background.xml | 1 + .../layout-w900dp/column_headers.xml | 1 - .../layout/directory_app_bar.xml | 4 ++ .../layout/directory_header.xml | 3 - .../layout/drawer_layout.xml | 6 ++ .../layout/fixed_layout.xml | 79 +++++++++++++-------- .../layout/nav_rail_layout.xml | 81 ++++++++++++++-------- .../values/dimens.xml | 3 + src/com/android/documentsui/BaseActivity.java | 15 ++-- 13 files changed, 195 insertions(+), 86 deletions(-) delete mode 100644 res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_background.xml create mode 100644 res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_bottom_section_background.xml create mode 100644 res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_middle_section_background.xml create mode 100644 res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_top_section_background.xml diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_background.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_background.xml deleted file mode 100644 index 151a7ba77..000000000 --- a/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_background.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_bottom_section_background.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_bottom_section_background.xml new file mode 100644 index 000000000..04f425e16 --- /dev/null +++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_bottom_section_background.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_middle_section_background.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_middle_section_background.xml new file mode 100644 index 000000000..8b0b42bee --- /dev/null +++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_middle_section_background.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_top_section_background.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_top_section_background.xml new file mode 100644 index 000000000..b35ed4060 --- /dev/null +++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/main_container_top_section_background.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/sort_widget_background.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/sort_widget_background.xml index 212dab765..5a9022035 100644 --- a/res/flag(com.android.documentsui.flags.use_material3)/drawable/sort_widget_background.xml +++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/sort_widget_background.xml @@ -15,6 +15,7 @@ limitations under the License. --> + + + + + - - - \ No newline at end of file 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 8499c0112..e86e0ec5a 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 @@ -28,6 +28,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + + + + - + android:paddingTop="@dimen/layout_padding_top" + android:paddingBottom="@dimen/layout_padding_bottom" + android:paddingEnd="@dimen/layout_padding_end"> + + + + + - - - - - + android:layout_height="match_parent" + android:orientation="vertical"> + + + android:paddingTop="@dimen/main_container_padding_top" + android:background="@drawable/main_container_top_section_background"> - + + + + + + + + + + + - - - + + diff --git a/res/flag(com.android.documentsui.flags.use_material3)/layout/nav_rail_layout.xml b/res/flag(com.android.documentsui.flags.use_material3)/layout/nav_rail_layout.xml index 5d753f336..618aa7f14 100644 --- a/res/flag(com.android.documentsui.flags.use_material3)/layout/nav_rail_layout.xml +++ b/res/flag(com.android.documentsui.flags.use_material3)/layout/nav_rail_layout.xml @@ -49,54 +49,81 @@ + android:orientation="vertical"> - + + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingTop="@dimen/main_container_padding_top" + android:background="@drawable/main_container_top_section_background"> - + android:layout_height="?attr/actionBarSize" + android:layout_marginTop="@dimen/action_bar_margin" + android:touchscreenBlocksFocus="false"> + + + + - + - + - + android:layout_weight="1" + android:orientation="vertical" + android:layout_marginTop="@dimen/main_container_section_gap" + android:background="@drawable/main_container_middle_section_background"> - + + android:layout_height="0dp" + android:layout_weight="1"> + + - + + + + + + + + @dimen/space_small_4 @dimen/space_small_4 0dp + 2dp + 16dp + 4dp @dimen/space_small_1 @dimen/space_small_1 @dimen/space_small_1 diff --git a/src/com/android/documentsui/BaseActivity.java b/src/com/android/documentsui/BaseActivity.java index 4c25b3608..41fc5182f 100644 --- a/src/com/android/documentsui/BaseActivity.java +++ b/src/com/android/documentsui/BaseActivity.java @@ -525,11 +525,16 @@ public abstract class BaseActivity root.setPadding(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), 0); - View saveContainer = findViewById(R.id.container_save); - saveContainer.setPadding(0, 0, 0, insets.getSystemWindowInsetBottom()); - - View rootsContainer = findViewById(R.id.container_roots); - rootsContainer.setPadding(0, 0, 0, insets.getSystemWindowInsetBottom()); + // in M3, no additional bottom gap in full screen mode. + if (!useMaterial3()) { + View saveContainer = findViewById(R.id.container_save); + saveContainer.setPadding( + 0, 0, 0, insets.getSystemWindowInsetBottom()); + + View rootsContainer = findViewById(R.id.container_roots); + rootsContainer.setPadding( + 0, 0, 0, insets.getSystemWindowInsetBottom()); + } return insets.consumeSystemWindowInsets(); }); -- cgit v1.2.3-59-g8ed1b