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

Commit 2bcc3f85 authored by Brian Isganitis's avatar Brian Isganitis Committed by Android (Google) Code Review
Browse files

Merge "Fix crash on long press of prediction row icons" into tm-qpr-dev

parents e690ef7f aee55077
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ package com.android.launcher3.secondarydisplay;
import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;

import android.content.Context;
import android.view.View;

import com.android.launcher3.allapps.ActivityAllAppsContainerView;
import com.android.launcher3.appprediction.AppsDividerView;
import com.android.launcher3.appprediction.PredictionRowView;
import com.android.launcher3.model.BgDataModel;
@@ -39,11 +41,14 @@ public final class SecondaryDisplayPredictionsImpl extends SecondaryDisplayPredi
    @Override
    void updateAppDivider() {
        OnboardingPrefs<?> onboardingPrefs = mActivityContext.getOnboardingPrefs();
        if (onboardingPrefs != null) {
            mActivityContext.getAppsView().getFloatingHeaderView()
                    .findFixedRowByType(AppsDividerView.class)
                .setShowAllAppsLabel(!onboardingPrefs.hasReachedMaxCount(ALL_APPS_VISITED_COUNT));
                    .setShowAllAppsLabel(
                            !onboardingPrefs.hasReachedMaxCount(ALL_APPS_VISITED_COUNT));
            onboardingPrefs.incrementEventCount(ALL_APPS_VISITED_COUNT);
        }
    }

    @Override
    public void setPredictedApps(BgDataModel.FixedContainerItems item) {
@@ -51,4 +56,12 @@ public final class SecondaryDisplayPredictionsImpl extends SecondaryDisplayPredi
                .findFixedRowByType(PredictionRowView.class)
                .setPredictedApps(item.items);
    }

    @Override
    public void setLongClickListener(ActivityAllAppsContainerView<?> appsView,
            View.OnLongClickListener onIconLongClickListener) {
        appsView.getFloatingHeaderView()
                .findFixedRowByType(PredictionRowView.class)
                .setOnIconLongClickListener(onIconLongClickListener);
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -303,6 +303,10 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
        }
    }

    public SecondaryDisplayPredictions getSecondaryDisplayPredictions() {
        return mSecondaryDisplayPredictions;
    }

    @Override
    public StringCache getStringCache() {
        return mStringCache;
+10 −0
Original line number Diff line number Diff line
@@ -16,8 +16,10 @@
package com.android.launcher3.secondarydisplay;

import android.content.Context;
import android.view.View;

import com.android.launcher3.R;
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
import com.android.launcher3.model.BgDataModel;
import com.android.launcher3.util.ResourceBasedOverride;

@@ -45,4 +47,12 @@ public class SecondaryDisplayPredictions implements ResourceBasedOverride {
     */
    public void setPredictedApps(BgDataModel.FixedContainerItems item) {
    }

    /**
     * Set long click listener for predicted apps in top of app drawer.
     */
    public void setLongClickListener(
            ActivityAllAppsContainerView<?> appsView,
            View.OnLongClickListener onIconLongClickListener) {
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -77,7 +77,8 @@ public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher>

        mAppsView = findViewById(R.id.apps_view);
        mAppsView.setOnIconLongClickListener(this::onIconLongClicked);

        mActivity.getSecondaryDisplayPredictions()
                .setLongClickListener(mAppsView, this::onIconLongClicked);
        // Setup workspace
        mWorkspace = findViewById(R.id.workspace_grid);
        mPinnedAppsAdapter = new PinnedAppsAdapter(mActivity, mAppsView.getAppsStore(),