diff options
author | Dan Sandler <dsandler@android.com> | 2014-01-13 14:30:14 -0500 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-06-06 22:54:25 -0700 |
commit | 03aec6cf90e244fb88b1b01a3543d4da56742a39 (patch) | |
tree | 3fd6272080a668a12f4ad19da449aca60f83dae3 /src | |
parent | bc4ea1cde2aa98cedb33bbbb4d697906049d72a9 (diff) | |
download | android_packages_apps_Trebuchet-03aec6cf90e244fb88b1b01a3543d4da56742a39.tar.gz android_packages_apps_Trebuchet-03aec6cf90e244fb88b1b01a3543d4da56742a39.tar.bz2 android_packages_apps_Trebuchet-03aec6cf90e244fb88b1b01a3543d4da56742a39.zip |
Fix longpress crash.
The AllApps button doesn't usually accept longpresses, but
you can trick it into trying by holding one finger on it and
another on another icon in the hotseat. This patch defends
against that and bails out if the longpressed item has the
all apps rank (position in hotseat).
Bug: 11740833
Change-Id: I99785ccbc9e6dc6be2a9e56289b3cc0275fbb65c
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/Hotseat.java | 41 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 3 |
2 files changed, 2 insertions, 42 deletions
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index a09d83e79..0cca03b8c 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -95,14 +95,6 @@ public class Hotseat extends FrameLayout { return hasVerticalHotseat() ? (mContent.getCountY() - (rank + 1)) : 0; } - public boolean isAllAppsButtonRank(int rank) { - if (LauncherAppState.isDisableAllApps()) { - return false; - } else { - return rank == mAllAppsButtonRank; - } - } - /** This returns the coordinates of an app in a given cell, relative to the DragLayer */ Rect getCellCoordinates(int cellX, int cellY) { Rect coords = new Rect(); @@ -142,39 +134,6 @@ public class Hotseat extends FrameLayout { void resetLayout() { mContent.removeAllViewsInLayout(); - - if (!LauncherAppState.isDisableAllApps()) { - // Add the Apps button - Context context = getContext(); - - LayoutInflater inflater = LayoutInflater.from(context); - TextView allAppsButton = (TextView) - inflater.inflate(R.layout.all_apps_button, mContent, false); - Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon); - Utilities.resizeIconDrawable(d); - allAppsButton.setCompoundDrawables(null, d, null, null); - - allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label)); - if (mLauncher != null) { - allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener()); - } - allAppsButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(android.view.View v) { - if (mLauncher != null) { - mLauncher.onClickAllAppsButton(v); - } - } - }); - - // Note: We do this to ensure that the hotseat is always laid out in the orientation of - // the hotseat in order regardless of which orientation they were added - int x = getCellXFromOrder(mAllAppsButtonRank); - int y = getCellYFromOrder(mAllAppsButtonRank); - CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1); - lp.canReorder = false; - mContent.addViewToCellLayout(allAppsButton, -1, 0, lp, true); - } } @Override diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 5f5ad774d..03fb0fa03 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2976,7 +2976,8 @@ public class Launcher extends Activity // The hotseat touch handling does not go through Workspace, and we always allow long press // on hotseat items. final View itemUnderLongClick = longClickCellInfo.cell; - boolean allowLongPress = isHotseatLayout(v) || mWorkspace.allowLongPress(); + final boolean inHotseat = isHotseatLayout(v); + boolean allowLongPress = inHotseat || mWorkspace.allowLongPress(); if (allowLongPress && !mDragController.isDragging()) { if (itemUnderLongClick == null) { // User long pressed on empty space |