diff options
author | Mario Bertschler <bmario@google.com> | 2017-11-28 15:24:25 -0800 |
---|---|---|
committer | Mario Bertschler <bmario@google.com> | 2017-12-01 10:57:05 -0800 |
commit | 527fa71adce40aeb077c7d9333ca756c8fd47ab0 (patch) | |
tree | 833bea6db9cd38059471fc83c67d7d6b5cc08e46 | |
parent | 4d9d4542e01ab30e48a21f6da0ede2c3d7d053b3 (diff) | |
download | android_packages_apps_Trebuchet-527fa71adce40aeb077c7d9333ca756c8fd47ab0.tar.gz android_packages_apps_Trebuchet-527fa71adce40aeb077c7d9333ca756c8fd47ab0.tar.bz2 android_packages_apps_Trebuchet-527fa71adce40aeb077c7d9333ca756c8fd47ab0.zip |
Enables searching when using work tabs together with fallback search.
Bug: 69966634
Bug: 68713881
Change-Id: I972696575b7559b5baf80b949437dcb2dc885f66
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsContainerView.java | 16 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AlphabeticalAppsList.java | 4 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index a6c1e6edc..9ee9514fc 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -27,6 +27,7 @@ import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.Selection; import android.text.SpannableStringBuilder; +import android.text.TextUtils; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -95,6 +96,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, private TransformingTouchDelegate mTouchDelegate; private boolean mUsingTabs; private boolean mHasPredictions = false; + private boolean mSearchModeWhileUsingTabs = false; private final HashMap<ComponentKey, AppInfo> mComponentToAppMap = new HashMap<>(); @@ -559,8 +561,10 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, return; } mHeader.setVisibility(View.VISIBLE); - int contentHeight = mHasPredictions ? mLauncher.getDeviceProfile().allAppsCellHeightPx : 0; - if (mHasPredictions && !mUsingTabs) { + + boolean usePredictionRow = mHasPredictions && !mSearchModeWhileUsingTabs; + int contentHeight = usePredictionRow ? mLauncher.getDeviceProfile().allAppsCellHeightPx : 0;; + if (usePredictionRow && !mUsingTabs) { contentHeight += getResources() .getDimensionPixelSize(R.dimen.all_apps_prediction_row_divider_height); } @@ -584,6 +588,14 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, for (int i = 0; i < mAH.length; i++) { mAH[i].adapter.setLastSearchQuery(query); } + boolean hasQuery = !TextUtils.isEmpty(query); + if (mFloatingHeaderHandler != null && mUsingTabs && hasQuery) { + mSearchModeWhileUsingTabs = true; + rebindAdapters(false); // hide tabs + } else if (mSearchModeWhileUsingTabs && !hasQuery) { + mSearchModeWhileUsingTabs = false; + rebindAdapters(true); // show tabs + } } public void onSearchResultsChanged() { diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index 12715cba2..2b9cba302 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -301,7 +301,7 @@ public class AlphabeticalAppsList { if (mSearchResults != f) { boolean same = mSearchResults != null && mSearchResults.equals(f); mSearchResults = f; - updateAdapterItems(); + onAppsUpdated(); return !same; } return false; @@ -403,7 +403,7 @@ public class AlphabeticalAppsList { mApps.clear(); for (AppInfo app : mComponentToAppMap.values()) { - if (mItemFilter == null || mItemFilter.matches(app, null)) { + if (mItemFilter == null || mItemFilter.matches(app, null) || hasFilter()) { mApps.add(app); } } |