Revert "Removing onInitialize method and creating searchManager in getView"

This reverts commit 6530017bb8.

Change-Id: I8ecfd21ec854cfe1774f16d2d50c7a0e45dd6865
This commit is contained in:
Sunny Goyal
2015-06-17 16:09:07 +00:00
parent 6530017bb8
commit 4919827990
2 changed files with 14 additions and 5 deletions
@@ -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.
@@ -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);
@@ -114,6 +113,11 @@ final class DefaultAppSearchController extends AllAppsSearchBarController
return mSearchBarEditView.isFocused();
}
@Override
protected void onInitialize() {
mSearchManager = new DefaultAppSearchAlgorithm(mApps.getApps());
}
@Override
public void reset() {
hideSearchField(false, null);