diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2014-08-20 20:36:59 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-20 20:15:45 +0000 |
commit | 22308ce1b858aa9a4e9068ea4fb1d47e62fc6e67 (patch) | |
tree | b4d16b837ff1c55a64053e692a6082cd28affdf6 /src/com/android/launcher3/FocusHelper.java | |
parent | 2111606845bec8b40e8eb164c73c60f59c028014 (diff) | |
parent | 508da15509224b46fcccabbe78f3e92fe69a67d8 (diff) | |
download | android_packages_apps_Trebuchet-22308ce1b858aa9a4e9068ea4fb1d47e62fc6e67.tar.gz android_packages_apps_Trebuchet-22308ce1b858aa9a4e9068ea4fb1d47e62fc6e67.tar.bz2 android_packages_apps_Trebuchet-22308ce1b858aa9a4e9068ea4fb1d47e62fc6e67.zip |
Merge "Updating the icon click feedback" into ub-now-porkchop
Diffstat (limited to 'src/com/android/launcher3/FocusHelper.java')
-rw-r--r-- | src/com/android/launcher3/FocusHelper.java | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/com/android/launcher3/FocusHelper.java b/src/com/android/launcher3/FocusHelper.java index df5e0fc33..34e752b85 100644 --- a/src/com/android/launcher3/FocusHelper.java +++ b/src/com/android/launcher3/FocusHelper.java @@ -22,8 +22,6 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.widget.ScrollView; -import android.widget.TabHost; -import android.widget.TabWidget; import java.util.ArrayList; import java.util.Collections; @@ -89,7 +87,6 @@ public class FocusHelper { final PagedViewGridLayout parent = (PagedViewGridLayout) w.getParent(); final PagedView container = (PagedView) parent.getParent(); - final AppsCustomizeTabHost tabHost = findTabHostParent(container); final int widgetIndex = parent.indexOfChild(w); final int widgetCount = parent.getChildCount(); final int pageIndex = ((PagedView) container).indexToPage(container.indexOfChild(parent)); @@ -228,6 +225,13 @@ public class FocusHelper { * Handles key events in a PageViewCellLayout containing PagedViewIcons. */ static boolean handleAppsCustomizeKeyEvent(View v, int keyCode, KeyEvent e) { + final int action = e.getAction(); + if (((action == KeyEvent.ACTION_DOWN) && v.onKeyDown(keyCode, e)) + || ((action == KeyEvent.ACTION_UP) && v.onKeyUp(keyCode, e))) { + // Let the view handle the confirmation key. + return true; + } + ViewGroup parentLayout; ViewGroup itemContainer; int countX; @@ -246,7 +250,6 @@ public class FocusHelper { // Note we have an extra parent because of the // PagedViewCellLayout/PagedViewCellLayoutChildren relationship final PagedView container = (PagedView) parentLayout.getParent(); - final AppsCustomizeTabHost tabHost = findTabHostParent(container); final int iconIndex = itemContainer.indexOfChild(v); final int itemCount = itemContainer.getChildCount(); final int pageIndex = ((PagedView) container).indexToPage(container.indexOfChild(parentLayout)); @@ -255,7 +258,6 @@ public class FocusHelper { final int x = iconIndex % countX; final int y = iconIndex / countX; - final int action = e.getAction(); final boolean handleKeyEvent = (action != KeyEvent.ACTION_UP); ViewGroup newParent = null; // Side pages do not always load synchronously, so check before focusing child siblings @@ -319,15 +321,6 @@ public class FocusHelper { } wasHandled = true; break; - case KeyEvent.KEYCODE_ENTER: - case KeyEvent.KEYCODE_DPAD_CENTER: - if (handleKeyEvent) { - // Simulate a click on the icon - View.OnClickListener clickListener = (View.OnClickListener) container; - clickListener.onClick(v); - } - wasHandled = true; - break; case KeyEvent.KEYCODE_PAGE_UP: if (handleKeyEvent) { // Select the first icon on the previous page, or the first icon on this page |