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

Commit 3518bbc9 authored by Tony Huang's avatar Tony Huang
Browse files

Fix restoreSearch behavior

If there has checked chip, when the user rotates the device,
the search field will expand due to restoreSearch method.
The function is only used to restore text search.
Refactor it and also rename the method to avoid confusion.

Fix: 124911175
Test: manual
Test: atest DocumentsUITests
Change-Id: I0b61bb3cdf3373173b1d8ec7c270a5e8a16ed09b
parent 9e14c9f5
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ public class SearchViewManager implements
        mSearchView.setMaxWidth(Integer.MAX_VALUE);
        mMenuItem.setOnActionExpandListener(this);

        restoreSearch();
        restoreTextSearch();
    }

    /**
@@ -310,8 +310,8 @@ public class SearchViewManager implements
     * Sets search view into the searching state. Used to restore state after device orientation
     * change.
     */
    private void restoreSearch() {
        if (isSearching()) {
    private void restoreTextSearch() {
        if (isTextSearching()) {
            onSearchBarClicked();
            mSearchView.setQuery(mCurrentSearch, false);
            mSearchView.clearFocus();
@@ -488,6 +488,10 @@ public class SearchViewManager implements
        return mCurrentSearch != null || mChipViewManager.hasCheckedItems();
    }

    private boolean isTextSearching() {
        return mCurrentSearch != null;
    }

    public boolean hasCheckedChip() {
        return mChipViewManager.hasCheckedItems();
    }