summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-05-28 17:33:40 -0700
committerWinson Chung <winsonc@google.com>2015-06-02 16:58:30 -0700
commit8f1eff7b6cc8621888ee46605c32e601f80a890b (patch)
treee146630fbd97be40814eb573a8b5aac5c0e0d00d /src/com/android/launcher3/allapps
parent316490e636aad788fcfbfc2e04dd4f0e145bdd00 (diff)
downloadandroid_packages_apps_Trebuchet-8f1eff7b6cc8621888ee46605c32e601f80a890b.tar.gz
android_packages_apps_Trebuchet-8f1eff7b6cc8621888ee46605c32e601f80a890b.tar.bz2
android_packages_apps_Trebuchet-8f1eff7b6cc8621888ee46605c32e601f80a890b.zip
Adding context for app launches.
Bug: 21492784 Change-Id: I1b28ac8f44498e1d9770e770b074f19c721c3f10
Diffstat (limited to 'src/com/android/launcher3/allapps')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java13
-rw-r--r--src/com/android/launcher3/allapps/AllAppsRecyclerView.java18
-rw-r--r--src/com/android/launcher3/allapps/AlphabeticalAppsList.java10
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 725616fb3..f4d02a1c9 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()) {