diff options
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsSearchBarController.java | 11 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/DefaultAppSearchController.java | 8 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java index 9e51406f0..341539cdd 100644 --- a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java +++ b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.allapps; +import android.content.ComponentName; import android.graphics.Rect; import android.view.View; import android.view.ViewGroup; @@ -34,13 +35,17 @@ public abstract class AllAppsSearchBarController { /** * Sets the references to the apps model and the search result callback. */ - public void initialize(AlphabeticalAppsList apps, Callbacks cb) { + public final void initialize(AlphabeticalAppsList apps, Callbacks cb) { mApps = apps; mCb = cb; + onInitialize(); } - @Deprecated - protected void onInitialize() { }; + /** + * To be overridden by subclasses. This method will get called when the controller is set, + * before getView(). + */ + protected abstract void onInitialize(); /** * Returns the search bar view. diff --git a/src/com/android/launcher3/allapps/DefaultAppSearchController.java b/src/com/android/launcher3/allapps/DefaultAppSearchController.java index 629bfeafe..20924af94 100644 --- a/src/com/android/launcher3/allapps/DefaultAppSearchController.java +++ b/src/com/android/launcher3/allapps/DefaultAppSearchController.java @@ -31,6 +31,7 @@ import com.android.launcher3.util.Thunk; import java.util.List; + /** * The default search controller. */ @@ -73,8 +74,6 @@ final class DefaultAppSearchController extends AllAppsSearchBarController @Override public View getView(ViewGroup parent) { - mSearchManager = new DefaultAppSearchAlgorithm(mApps.getApps()); - LayoutInflater inflater = LayoutInflater.from(parent.getContext()); mSearchView = inflater.inflate(R.layout.all_apps_search_bar, parent, false); mSearchView.setOnClickListener(this); @@ -115,6 +114,11 @@ final class DefaultAppSearchController extends AllAppsSearchBarController } @Override + protected void onInitialize() { + mSearchManager = new DefaultAppSearchAlgorithm(mApps.getApps()); + } + + @Override public void reset() { hideSearchField(false, null); } |