diff options
author | Winson Chung <winsonc@google.com> | 2015-06-02 23:59:42 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-02 23:59:43 +0000 |
commit | ca51aaad671f1999dff135b1253fecf0869a3763 (patch) | |
tree | 65ca068e7097f5a92f3f7d053b09063970d5f301 /src/com/android/launcher3/allapps | |
parent | 59caa60222e55212c13110ca0890023b47356fa5 (diff) | |
parent | 8f1eff7b6cc8621888ee46605c32e601f80a890b (diff) | |
download | android_packages_apps_Trebuchet-ca51aaad671f1999dff135b1253fecf0869a3763.tar.gz android_packages_apps_Trebuchet-ca51aaad671f1999dff135b1253fecf0869a3763.tar.bz2 android_packages_apps_Trebuchet-ca51aaad671f1999dff135b1253fecf0869a3763.zip |
Merge "Adding context for app launches." into ub-launcher3-burnaby
Diffstat (limited to 'src/com/android/launcher3/allapps')
3 files changed, 38 insertions, 3 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 84a6462e5..9386500be 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -26,6 +26,7 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.InsetDrawable; import android.os.Build; +import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.text.Editable; import android.text.TextWatcher; @@ -57,6 +58,7 @@ import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherTransitionable; import com.android.launcher3.R; +import com.android.launcher3.Stats; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; import com.android.launcher3.allapps.AppSearchManager.AppSearchResultCallback; @@ -172,7 +174,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc TextWatcher, TextView.OnEditorActionListener, LauncherTransitionable, AlphabeticalAppsList.AdapterChangedCallback, AllAppsGridAdapter.PredictionBarSpacerCallbacks, View.OnTouchListener, View.OnClickListener, View.OnLongClickListener, - ViewTreeObserver.OnPreDrawListener, AppSearchResultCallback { + ViewTreeObserver.OnPreDrawListener, AppSearchResultCallback, Stats.LaunchSourceProvider { public static final boolean GRID_MERGE_SECTIONS = true; @@ -870,6 +872,15 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc return false; } + @Override + public void fillInLaunchSourceData(Bundle sourceData) { + // Since the other cases are caught by the AllAppsRecyclerView LaunchSourceProvider, we just + // handle the prediction bar icons here + sourceData.putString(Stats.SOURCE_EXTRA_CONTAINER, Stats.CONTAINER_ALL_APPS); + sourceData.putString(Stats.SOURCE_EXTRA_SUB_CONTAINER, + Stats.SUB_CONTAINER_ALL_APPS_PREDICTION); + } + /** * Returns the predicted app in the prediction bar given a set of local coordinates. */ diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index cc5add3b2..e1b5d918e 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -18,14 +18,15 @@ package com.android.launcher3.allapps; import android.content.Context; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.View; - import com.android.launcher3.BaseRecyclerView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; +import com.android.launcher3.Stats; import com.android.launcher3.Utilities; import java.util.List; @@ -33,7 +34,8 @@ 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 Stats.LaunchSourceProvider { private AlphabeticalAppsList mApps; private int mNumAppsPerRow; @@ -125,6 +127,18 @@ public class AllAppsRecyclerView extends BaseRecyclerView { addOnItemTouchListener(this); } + @Override + public void fillInLaunchSourceData(Bundle sourceData) { + sourceData.putString(Stats.SOURCE_EXTRA_CONTAINER, Stats.CONTAINER_ALL_APPS); + if (mApps.hasFilter()) { + sourceData.putString(Stats.SOURCE_EXTRA_SUB_CONTAINER, + Stats.SUB_CONTAINER_ALL_APPS_SEARCH); + } else { + sourceData.putString(Stats.SOURCE_EXTRA_SUB_CONTAINER, + Stats.SUB_CONTAINER_ALL_APPS_A_Z); + } + } + /** * Maps the touch (from 0..1) to the adapter position that should be visible. */ diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index aa5e907e1..e284f77c4 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -46,6 +46,7 @@ public class AlphabeticalAppsList { public static final String TAG = "AlphabeticalAppsList"; private static final boolean DEBUG = false; + private static final boolean DEBUG_PREDICTIONS = false; /** * Info about a section in the alphabetic list @@ -477,6 +478,15 @@ public class AlphabeticalAppsList { mAdapterItems.clear(); mSections.clear(); + if (DEBUG_PREDICTIONS) { + if (mPredictedAppComponents.isEmpty() && !mApps.isEmpty()) { + mPredictedAppComponents.add(mApps.get(0).componentName); + mPredictedAppComponents.add(mApps.get(0).componentName); + mPredictedAppComponents.add(mApps.get(0).componentName); + mPredictedAppComponents.add(mApps.get(0).componentName); + } + } + // Process the predicted app components mPredictedApps.clear(); if (mPredictedAppComponents != null && !mPredictedAppComponents.isEmpty() && !hasFilter()) { |