summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java3
-rw-r--r--src/com/android/launcher3/allapps/AllAppsSearchBarController.java17
2 files changed, 17 insertions, 3 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 8b1f95087..428f78401 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -210,6 +210,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
*/
public void addApps(List<AppInfo> apps) {
mApps.addApps(apps);
+ mSearchBarController.refreshSearchResult();
}
/**
@@ -217,6 +218,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
*/
public void updateApps(List<AppInfo> apps) {
mApps.updateApps(apps);
+ mSearchBarController.refreshSearchResult();
}
/**
@@ -224,6 +226,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
*/
public void removeApps(List<AppInfo> apps) {
mApps.removeApps(apps);
+ mSearchBarController.refreshSearchResult();
}
public void setSearchBarVisible(boolean visible) {
diff --git a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
index ac3593238..e75210b93 100644
--- a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
+++ b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
@@ -45,6 +45,7 @@ public abstract class AllAppsSearchBarController
protected AlphabeticalAppsList mApps;
protected Callbacks mCb;
protected ExtendedEditText mInput;
+ private String mQuery;
protected DefaultAppSearchAlgorithm mSearchAlgorithm;
protected InputMethodManager mInputMethodManager;
@@ -90,14 +91,23 @@ public abstract class AllAppsSearchBarController
@Override
public void afterTextChanged(final Editable s) {
- String query = s.toString();
- if (query.isEmpty()) {
+ mQuery = s.toString();
+ if (mQuery.isEmpty()) {
mSearchAlgorithm.cancel(true);
mCb.clearSearchResult();
} else {
mSearchAlgorithm.cancel(false);
- mSearchAlgorithm.doSearch(query, mCb);
+ mSearchAlgorithm.doSearch(mQuery, mCb);
+ }
+ }
+
+ protected void refreshSearchResult() {
+ if (mQuery == null) {
+ return;
}
+ // If play store continues auto updating an app, we want to show partial result.
+ mSearchAlgorithm.cancel(false);
+ mSearchAlgorithm.doSearch(mQuery, mCb);
}
@Override
@@ -130,6 +140,7 @@ public abstract class AllAppsSearchBarController
* Resets the search bar state.
*/
public void reset() {
+ mQuery = null;
unfocusSearchField();
mCb.clearSearchResult();
mInput.setText("");