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

Commit 527fa71a authored by Mario Bertschler's avatar Mario Bertschler
Browse files

Enables searching when using work tabs together with fallback search.

Bug: 69966634
Bug: 68713881
Change-Id: I972696575b7559b5baf80b949437dcb2dc885f66
parent 4d9d4542
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Selection;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -95,6 +96,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
    private TransformingTouchDelegate mTouchDelegate;
    private boolean mUsingTabs;
    private boolean mHasPredictions = false;
    private boolean mSearchModeWhileUsingTabs = false;

    private final HashMap<ComponentKey, AppInfo> mComponentToAppMap = new HashMap<>();

@@ -559,8 +561,10 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
            return;
        }
        mHeader.setVisibility(View.VISIBLE);
        int contentHeight = mHasPredictions ? mLauncher.getDeviceProfile().allAppsCellHeightPx : 0;
        if (mHasPredictions && !mUsingTabs) {

        boolean usePredictionRow = mHasPredictions && !mSearchModeWhileUsingTabs;
        int contentHeight = usePredictionRow ? mLauncher.getDeviceProfile().allAppsCellHeightPx : 0;;
        if (usePredictionRow && !mUsingTabs) {
            contentHeight += getResources()
                    .getDimensionPixelSize(R.dimen.all_apps_prediction_row_divider_height);
        }
@@ -584,6 +588,14 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
        for (int i = 0; i < mAH.length; i++) {
            mAH[i].adapter.setLastSearchQuery(query);
        }
        boolean hasQuery = !TextUtils.isEmpty(query);
        if (mFloatingHeaderHandler != null && mUsingTabs && hasQuery) {
            mSearchModeWhileUsingTabs = true;
            rebindAdapters(false); // hide tabs
        } else if (mSearchModeWhileUsingTabs && !hasQuery) {
            mSearchModeWhileUsingTabs = false;
            rebindAdapters(true); // show tabs
        }
    }

    public void onSearchResultsChanged() {
+2 −2
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ public class AlphabeticalAppsList {
        if (mSearchResults != f) {
            boolean same = mSearchResults != null && mSearchResults.equals(f);
            mSearchResults = f;
            updateAdapterItems();
            onAppsUpdated();
            return !same;
        }
        return false;
@@ -403,7 +403,7 @@ public class AlphabeticalAppsList {
        mApps.clear();

        for (AppInfo app : mComponentToAppMap.values()) {
            if (mItemFilter == null || mItemFilter.matches(app, null)) {
            if (mItemFilter == null || mItemFilter.matches(app, null) || hasFilter()) {
                mApps.add(app);
            }
        }