From 2b50b53183b8163744248c0001ea93f61570ed7b Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 18 Jul 2017 04:25:55 -0700 Subject: Updating UserEventDispatcher to make some methods accessible. > Removing helper methods around fillInLogContainerData so that its easier to create events with 3 and more srcTargets > Removing setPredictedApps from userEventDispatcher as its specific to Launcher and does not apply to other activities. Instead moving it to AllAppsRecyclerView Bug: 63719473 Change-Id: Ib92621e41ede4ffe03892642ab173772b5a84dd1 --- .../android/launcher3/allapps/AllAppsContainerView.java | 2 +- .../android/launcher3/allapps/AllAppsRecyclerView.java | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/com/android/launcher3/allapps') diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index ccef4f2f5..20951921c 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -359,7 +359,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc @Override public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) { - targetParent.containerType = mAppsRecyclerView.getContainerType(v); + // This is filled in {@link AllAppsRecyclerView} } @Override diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index fb785fbb0..25144584e 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -30,18 +30,21 @@ import android.view.View; import com.android.launcher3.BaseRecyclerView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; +import com.android.launcher3.ItemInfo; import com.android.launcher3.R; import com.android.launcher3.anim.SpringAnimationHandler; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.DrawableFactory; +import com.android.launcher3.logging.UserEventDispatcher.LogContainerProvider; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; +import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import java.util.List; /** * A RecyclerView with custom fast scroll support for the all apps view. */ -public class AllAppsRecyclerView extends BaseRecyclerView { +public class AllAppsRecyclerView extends BaseRecyclerView implements LogContainerProvider { private AlphabeticalAppsList mApps; private AllAppsFastScrollHelper mFastScrollHelper; @@ -231,9 +234,10 @@ public class AllAppsRecyclerView extends BaseRecyclerView { updateEmptySearchBackgroundBounds(); } - public int getContainerType(View v) { + @Override + public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) { if (mApps.hasFilter()) { - return ContainerType.SEARCHRESULT; + targetParent.containerType = ContainerType.SEARCHRESULT; } else { if (v instanceof BubbleTextView) { BubbleTextView icon = (BubbleTextView) v; @@ -242,11 +246,13 @@ public class AllAppsRecyclerView extends BaseRecyclerView { List items = mApps.getAdapterItems(); AlphabeticalAppsList.AdapterItem item = items.get(position); if (item.viewType == AllAppsGridAdapter.VIEW_TYPE_PREDICTION_ICON) { - return ContainerType.PREDICTION; + targetParent.containerType = ContainerType.PREDICTION; + target.predictedRank = item.rowAppIndex; + return; } } } - return ContainerType.ALLAPPS; + targetParent.containerType = ContainerType.ALLAPPS; } } -- cgit v1.2.3