Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1acd0edb authored by Wenbo Jie's avatar Wenbo Jie
Browse files

[DocsUI M3] Fix the top gap when force_material3 is OFF

When use_material3 flag is ON but force_material3 config is OFF,
the values-w900dp-600dp/config.xml in the falg on resource folder
still takes effect, the scrolling_behavior defined there causes
a big gap for certain screen sizes. This CL changes the file to be
config_m3.xml to make it explicit that it should only be used in
M3, and also update the config variable names to have m3 suffix.

Check the attached bug for the before/after comparison.

Bug: 418124756
Test: m DocumentsUIGoogle && manual inspection
Flag: com.android.documentsui.flags.use_material3
Change-Id: Ie29d7002d361cd66aa4c5631b28efe17b4162ceb
parent 25240f01
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@
            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_behavior="@string/scrolling_behavior">
                app:layout_behavior="@string/scrolling_behavior_m3">

                <FrameLayout
                    android:id="@+id/container_directory"
+2 −2
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@

<resources>
    <!-- Indicates if search view is taking the whole toolbar space -->
    <bool name="full_bar_search_view">false</bool>
    <bool name="full_bar_search_view_m3">false</bool>

    <string name="scrolling_behavior" translatable="false">@string/appbar_scrolling_view_behavior</string>
    <string name="scrolling_behavior_m3" translatable="false">@string/appbar_scrolling_view_behavior</string>

    <!-- Dictates whether we show a search icon or a docked search bar in the toolbar. It's false
         on small screens to show the icon and true on larger screens to show the docked search. -->
+22 −0
Original line number 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.
-->

<resources>
    <!-- Indicates if search view is taking the whole toolbar space -->
    <bool name="full_bar_search_view_m3">true</bool>

    <string name="scrolling_behavior_m3" translatable="false">com.android.documentsui.ui.SearchBarScrollingViewBehavior</string>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -508,7 +508,7 @@ public abstract class BaseActivity

        getMenuInflater().inflate(getRes(R.menu.activity), menu);
        mNavigator.update();
        boolean fullBarSearch = getResources().getBoolean(R.bool.full_bar_search_view);
        boolean fullBarSearch = getResources().getBoolean(getRes(R.bool.full_bar_search_view));
        boolean showSearchBar = isUseMaterial3FlagEnabled() ? false : getResources().getBoolean(
                R.bool.show_search_bar);
        boolean showDockedSearch = getResources().getBoolean(R.bool.show_docked_search);
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ private const val TAG = "ThemeUtils"
@Suppress("ktlint:standard:max-line-length")
private fun initializeIdMapping() {
  idMapping = mapOf(
    R.bool.full_bar_search_view to R.bool.full_bar_search_view_m3,
    R.color.app_background_color to R.color.app_background_color_m3,
    R.color.app_icon_background to R.color.app_icon_background_m3,
    R.color.background_floating to R.color.background_floating_m3,
@@ -292,6 +293,7 @@ private fun initializeIdMapping() {
    R.menu.file_context_menu to R.menu.file_context_menu_m3,
    R.menu.mixed_context_menu to R.menu.mixed_context_menu_m3,
    R.menu.root_context_menu to R.menu.root_context_menu_m3,
    R.string.scrolling_behavior to R.string.scrolling_behavior_m3,
    R.style.ActionBarTheme to R.style.ActionBarThemeM3,
    R.style.ActionBarThemeCommon to R.style.ActionBarThemeCommonM3,
    R.style.AppsItemSubText to R.style.AppsItemSubTextM3,