Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49198279 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Revert "Removing onInitialize method and creating searchManager in getView"

This reverts commit 6530017b.

Change-Id: I8ecfd21ec854cfe1774f16d2d50c7a0e45dd6865
parent 6530017b
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -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.
+6 −2
Original line number Diff line number Diff line
@@ -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);