summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-05-09 20:43:21 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-06-08 15:00:09 -0700
commit3333b0ced8e6743c41909f6f6b916f1f9ec5a004 (patch)
tree7fd735821e3393a0dfe8691087f58ebbaa9dafae /src/com/android/launcher3/allapps/AllAppsGridAdapter.java
parentab06999a70c773ffbc0aadaf938e0e90f8ca09b2 (diff)
downloadandroid_packages_apps_Trebuchet-3333b0ced8e6743c41909f6f6b916f1f9ec5a004.tar.gz
android_packages_apps_Trebuchet-3333b0ced8e6743c41909f6f6b916f1f9ec5a004.tar.bz2
android_packages_apps_Trebuchet-3333b0ced8e6743c41909f6f6b916f1f9ec5a004.zip
Unifying focus indicator handling for workspace and all-apps
Adding an abstract FocusIndicatorHelper based on FocusIndicatorView which draws the background instead of using a dummy view. Change-Id: Id560195323d2ddad8fcd77ba675cf3f4fd4a94ab
Diffstat (limited to 'src/com/android/launcher3/allapps/AllAppsGridAdapter.java')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsGridAdapter.java23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
index 81a05a23b..4e591bb46 100644
--- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
+++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -33,6 +33,7 @@ import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnFocusChangeListener;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
@@ -348,6 +349,7 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
private BindViewCallback mBindViewCallback;
private AllAppsSearchBarController mSearchController;
+ private OnFocusChangeListener mIconFocusListener;
// The text to show when there are no search results and no market search handler.
private String mEmptySearchMessage;
@@ -412,6 +414,10 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
}
}
+ public void setIconFocusListener(OnFocusChangeListener focusListener) {
+ mIconFocusListener = focusListener;
+ }
+
/**
* Sets the last search query that was made, used to show when there are no results and to also
* seed the intent for searching the market.
@@ -461,26 +467,17 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
switch (viewType) {
case SECTION_BREAK_VIEW_TYPE:
return new ViewHolder(new View(parent.getContext()));
- case ICON_VIEW_TYPE: {
- BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
- R.layout.all_apps_icon, parent, false);
- icon.setOnTouchListener(mTouchListener);
- icon.setOnClickListener(mIconClickListener);
- icon.setOnLongClickListener(mIconLongClickListener);
- icon.setLongPressTimeout(ViewConfiguration.get(parent.getContext())
- .getLongPressTimeout());
- icon.setFocusable(true);
- return new ViewHolder(icon);
- }
+ case ICON_VIEW_TYPE:
case PREDICTION_ICON_VIEW_TYPE: {
BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
- R.layout.all_apps_prediction_bar_icon, parent, false);
+ viewType == ICON_VIEW_TYPE ? R.layout.all_apps_icon :
+ R.layout.all_apps_prediction_bar_icon, parent, false);
icon.setOnTouchListener(mTouchListener);
icon.setOnClickListener(mIconClickListener);
icon.setOnLongClickListener(mIconLongClickListener);
icon.setLongPressTimeout(ViewConfiguration.get(parent.getContext())
.getLongPressTimeout());
- icon.setFocusable(true);
+ icon.setOnFocusChangeListener(mIconFocusListener);
return new ViewHolder(icon);
}
case EMPTY_SEARCH_VIEW_TYPE: