Removing onInitialize method and creating searchManager in getView
Change-Id: I3e2620a7839dfd5e6ecb76f24b384eb50e820a94
diff --git a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
index 341539c..9e51406 100644
--- a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
+++ b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
@@ -15,7 +15,6 @@
*/
package com.android.launcher3.allapps;
-import android.content.ComponentName;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
@@ -35,17 +34,13 @@
/**
* Sets the references to the apps model and the search result callback.
*/
- public final void initialize(AlphabeticalAppsList apps, Callbacks cb) {
+ public void initialize(AlphabeticalAppsList apps, Callbacks cb) {
mApps = apps;
mCb = cb;
- onInitialize();
}
- /**
- * To be overridden by subclasses. This method will get called when the controller is set,
- * before getView().
- */
- protected abstract void onInitialize();
+ @Deprecated
+ protected 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 20924af..629bfea 100644
--- a/src/com/android/launcher3/allapps/DefaultAppSearchController.java
+++ b/src/com/android/launcher3/allapps/DefaultAppSearchController.java
@@ -31,7 +31,6 @@
import java.util.List;
-
/**
* The default search controller.
*/
@@ -74,6 +73,8 @@
@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);
@@ -114,11 +115,6 @@
}
@Override
- protected void onInitialize() {
- mSearchManager = new DefaultAppSearchAlgorithm(mApps.getApps());
- }
-
- @Override
public void reset() {
hideSearchField(false, null);
}