diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 013bd8cccb..1d308d5020 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -229,7 +229,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc throw new RuntimeException("Expected search bar controller to only be set once"); } mSearchBarController = searchController; - mSearchBarController.initialize(mApps, mSearchInput, mAppsRecyclerView, this); + mSearchBarController.initialize(mApps, mSearchInput, mLauncher, this); updateBackgroundAndPaddings(); } diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index d9313f8ecc..e983860eb5 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java @@ -566,7 +566,7 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter 1) { + // Skip if the query is empty + String query = v.getText().toString(); + if (query.isEmpty()) { return false; } - // Otherwise, find the first icon, or fallback to the search-market-view and launch it - List items = mApps.getAdapterItems(); - for (int i = 0; i < items.size(); i++) { - AlphabeticalAppsList.AdapterItem item = items.get(i); - switch (item.viewType) { - case AllAppsGridAdapter.ICON_VIEW_TYPE: - case AllAppsGridAdapter.SEARCH_MARKET_VIEW_TYPE: - mAppsRecyclerView.getChildAt(i).performClick(); - mInputMethodManager.hideSoftInputFromWindow(mInput.getWindowToken(), 0); - return true; - } - } - return false; + return mLauncher.startActivitySafely( + v, AllAppsGridAdapter.createMarketSearchIntent(query), null); } @Override