summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps/DefaultAppSearchController.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-07-10 12:38:30 -0700
committerWinson <winsonc@google.com>2015-08-06 12:22:38 -0700
commitbedf9232eb67a420f0372d3ca135ca13194e603b (patch)
treebcce2d55b9b90d760e874a506b3a0597b6006380 /src/com/android/launcher3/allapps/DefaultAppSearchController.java
parentd1ea63f24a751521e6c35cc06be0e548e0b04f23 (diff)
downloadandroid_packages_apps_Trebuchet-bedf9232eb67a420f0372d3ca135ca13194e603b.tar.gz
android_packages_apps_Trebuchet-bedf9232eb67a420f0372d3ca135ca13194e603b.tar.bz2
android_packages_apps_Trebuchet-bedf9232eb67a420f0372d3ca135ca13194e603b.zip
Adding market search.
Change-Id: Id41615653cd4fa76213add4595418ad0cc6e7852
Diffstat (limited to 'src/com/android/launcher3/allapps/DefaultAppSearchController.java')
-rw-r--r--src/com/android/launcher3/allapps/DefaultAppSearchController.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/com/android/launcher3/allapps/DefaultAppSearchController.java b/src/com/android/launcher3/allapps/DefaultAppSearchController.java
index 83b920589..14cbb9534 100644
--- a/src/com/android/launcher3/allapps/DefaultAppSearchController.java
+++ b/src/com/android/launcher3/allapps/DefaultAppSearchController.java
@@ -169,19 +169,21 @@ final class DefaultAppSearchController extends AllAppsSearchBarController
if (actionId != EditorInfo.IME_ACTION_DONE) {
return false;
}
- // Skip if there isn't exactly one item
- if (mApps.getSize() != 1) {
+ // Skip if there are more than one icon
+ if (mApps.getNumFilteredApps() > 1) {
return false;
}
- // If there is exactly one icon, then quick-launch it
+ // Otherwise, find the first icon, or fallback to the search-market-view and launch it
List<AlphabeticalAppsList.AdapterItem> items = mApps.getAdapterItems();
for (int i = 0; i < items.size(); i++) {
AlphabeticalAppsList.AdapterItem item = items.get(i);
- if (item.viewType == AllAppsGridAdapter.ICON_VIEW_TYPE) {
- mAppsRecyclerView.getChildAt(i).performClick();
- mInputMethodManager.hideSoftInputFromWindow(
- mContainerView.getWindowToken(), 0);
- return true;
+ switch (item.viewType) {
+ case AllAppsGridAdapter.ICON_VIEW_TYPE:
+ case AllAppsGridAdapter.SEARCH_MARKET_VIEW_TYPE:
+ mAppsRecyclerView.getChildAt(i).performClick();
+ mInputMethodManager.hideSoftInputFromWindow(
+ mContainerView.getWindowToken(), 0);
+ return true;
}
}
return false;