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

Commit af64d6af authored by Zemiao Zhu's avatar Zemiao Zhu
Browse files

Refactor SearchFragment to fix keyboard focus issue.

Bug: 148623802
Test: atest DocumentsUIGoogleTests
Change-Id: I4676bdffc16c5b0cbc40623e461dd397d54de610
parent 9af39a03
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/directory_header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/action_bar_space_margin"
+6 −0
Original line number Diff line number Diff line
@@ -52,6 +52,12 @@

                </LinearLayout>

                <FrameLayout
                    android:id="@+id/container_search_fragment"
                    android:clipToPadding="false"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />

                <!-- Drawer edge is a dummy view used to capture hovering event
                     on view edge to open the drawer. (b/28345294) -->
                <View
+15 −3
Original line number Diff line number Diff line
@@ -76,12 +76,24 @@

                <include layout="@layout/directory_header" />

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1">

                    <FrameLayout
                        android:id="@+id/container_directory"
                        android:clipToPadding="false"
                        android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1" />
                        android:layout_height="match_parent" />

                    <FrameLayout
                        android:id="@+id/container_search_fragment"
                        android:clipToPadding="false"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" />

                </FrameLayout>

                <androidx.coordinatorlayout.widget.CoordinatorLayout
                    android:id="@+id/container_save"
+0 −15
Original line number Diff line number Diff line
@@ -22,21 +22,6 @@
    android:layout_height="match_parent"
    android:background="?android:attr/colorBackground">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:layout_margin="@dimen/search_bar_margin"
        android:theme="?actionBarTheme"
        app:navigationIcon="@drawable/ic_arrow_back"
        app:navigationContentDescription="@string/button_back">

        <androidx.appcompat.widget.SearchView
            android:id="@+id/search_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    </androidx.appcompat.widget.Toolbar>

    <!-- used for search chip. -->
    <include layout="@layout/search_chip_row"/>

+6 −0
Original line number Diff line number Diff line
@@ -174,6 +174,10 @@ public abstract class BaseActivity
             */
            @Override
            public void onSearchChanged(@Nullable String query) {
                if (query != null) {
                    SearchFragment.dismissFragment(getSupportFragmentManager());
                }

                if (mSearchManager.isSearching()) {
                    Metrics.logSearchMode(query != null, mSearchManager.hasCheckedChip());
                    if (mInjector.pickResult != null) {
@@ -226,6 +230,8 @@ public abstract class BaseActivity
                        && !isInitailSearch) {
                    SearchFragment.showFragment(getSupportFragmentManager(),
                            mSearchManager.getSearchViewText());
                } else {
                    SearchFragment.dismissFragment(getSupportFragmentManager());
                }
            }

Loading