From b2cb60664a194e05fae78cf62a9a7b40f43dd635 Mon Sep 17 00:00:00 2001 From: Ben Reich Date: Wed, 19 Mar 2025 17:28:10 +1100 Subject: Stop system bar areas from being transparent On phones the layout is inset to accomodate for the system bars. When material 3 is enabled, the path bar is moved to the bottom of the window. When this happens there is a gap created from the inset where it is made a transparent colour that effectively shows the scrolling grid / list view. Stop that behaviour and set the default color in M3 to be the background colour. Fix: 403481518 Test: m DocumentsUIGoogle on bluejay and verify bottom bar Flag: com.android.documentsui.flags.use_material3 Change-Id: Icb565c80bbb30a6e84486319c1d6914c81bbf03a --- .../values/themes.xml | 4 ++++ src/com/android/documentsui/files/FilesActivity.java | 10 +++++++--- src/com/android/documentsui/picker/PickActivity.java | 4 +++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/res/flag(com.android.documentsui.flags.use_material3)/values/themes.xml b/res/flag(com.android.documentsui.flags.use_material3)/values/themes.xml index 314022eea..114d14c88 100644 --- a/res/flag(com.android.documentsui.flags.use_material3)/values/themes.xml +++ b/res/flag(com.android.documentsui.flags.use_material3)/values/themes.xml @@ -79,5 +79,9 @@ @style/MenuItemTextAppearance + + + ?attr/colorSurfaceContainer + ?attr/colorSurfaceContainer diff --git a/src/com/android/documentsui/files/FilesActivity.java b/src/com/android/documentsui/files/FilesActivity.java index 50e266d38..cb8708f0b 100644 --- a/src/com/android/documentsui/files/FilesActivity.java +++ b/src/com/android/documentsui/files/FilesActivity.java @@ -210,9 +210,13 @@ public class FilesActivity extends BaseActivity implements AbstractActionHandler updateTaskDescription(intent); } - // Set save container background to transparent for edge to edge nav bar. - View saveContainer = findViewById(R.id.container_save); - saveContainer.setBackgroundColor(Color.TRANSPARENT); + // When the use_material3 flag is on, the file path bar is at the bottom of the layout and + // hence the edge to edge nav bar is no longer required. + if (!isUseMaterial3FlagEnabled()) { + // Set save container background to transparent for edge to edge nav bar. + View saveContainer = findViewById(R.id.container_save); + saveContainer.setBackgroundColor(Color.TRANSPARENT); + } presentFileErrors(icicle, intent); } diff --git a/src/com/android/documentsui/picker/PickActivity.java b/src/com/android/documentsui/picker/PickActivity.java index 68a797397..4f875072e 100644 --- a/src/com/android/documentsui/picker/PickActivity.java +++ b/src/com/android/documentsui/picker/PickActivity.java @@ -224,9 +224,11 @@ public class PickActivity extends BaseActivity implements ActionHandler.Addons { } else if (mState.action == ACTION_OPEN_TREE || mState.action == ACTION_PICK_COPY_DESTINATION) { PickFragment.show(getSupportFragmentManager()); - } else { + } else if (!isUseMaterial3FlagEnabled()) { // If PickFragment or SaveFragment does not show, // Set save container background to transparent for edge to edge nav bar. + // However when the use_material3 flag is on, the file path bar is at the bottom of the + // layout and hence the edge to edge nav bar is no longer required. View saveContainer = findViewById(R.id.container_save); saveContainer.setBackgroundColor(Color.TRANSPARENT); } -- cgit v1.2.3-59-g8ed1b