From 0d44e9482b95d8f163b28bf20131c4349185b589 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Mon, 16 Nov 2009 18:20:51 -0800 Subject: [PATCH 1/2] Fix bug 2261637 - Workspace previews home screens on long pressing at the bottom of app drawer This includes some contortions to get it not to perform the vibrate haptic feedback then. (By the way, it appears that we're vibrating on the add context menu long press, so also do it when when we show the previews. --- src/com/android/launcher2/Launcher.java | 17 +++++++++++++++-- src/com/android/launcher2/Workspace.java | 7 ++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index c04176f13f..a8235a2814 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -55,6 +55,7 @@ import android.text.TextUtils; import android.text.method.TextKeyListener; import android.util.Log; import android.view.Display; +import android.view.HapticFeedbackConstants; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; @@ -563,7 +564,9 @@ public final class Launcher extends Activity Drawable next = mNextView.getDrawable(); mWorkspace.setIndicators(previous, next); + mPreviousView.setHapticFeedbackEnabled(false); mPreviousView.setOnLongClickListener(this); + mNextView.setHapticFeedbackEnabled(false); mNextView.setOnLongClickListener(this); workspace.setOnLongClickListener(this); @@ -1469,10 +1472,18 @@ public final class Launcher extends Activity public boolean onLongClick(View v) { switch (v.getId()) { case R.id.previous_screen: - showPreviousPreview(v); + if (!isAllAppsVisible()) { + mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, + HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + showPreviousPreview(v); + } return true; case R.id.next_screen: - showNextPreview(v); + if (!isAllAppsVisible()) { + mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, + HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + showNextPreview(v); + } return true; } @@ -1501,6 +1512,8 @@ public final class Launcher extends Activity } else { if (!(cellInfo.cell instanceof Folder)) { // User long pressed on an item + mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, + HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); mWorkspace.startDrag(cellInfo); } } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 8853158101..d0cec8af1c 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -139,6 +139,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag mDefaultScreen = a.getInt(R.styleable.Workspace_defaultScreen, 1); a.recycle(); + setHapticFeedbackEnabled(false); initWorkspace(); } @@ -352,6 +353,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag } group.addView(child, insert ? 0 : -1, lp); if (!(child instanceof Folder)) { + child.setHapticFeedbackEnabled(false); child.setOnLongClickListener(mLongClickListener); } if (child instanceof DropTarget) { @@ -426,10 +428,8 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag if (vacant) { group.addView(child, new CellLayout.LayoutParams(mTempCell[0], mTempCell[1], spanX, spanY)); + child.setHapticFeedbackEnabled(false); child.setOnLongClickListener(mLongClickListener); - if (!(child instanceof Folder)) { - child.setOnLongClickListener(mLongClickListener); - } if (child instanceof DropTarget) { mDragController.addDropTarget((DropTarget)child); } @@ -1094,6 +1094,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag } cellLayout.addView(view, insertAtFirst ? 0 : -1); + view.setHapticFeedbackEnabled(false); view.setOnLongClickListener(mLongClickListener); if (view instanceof DropTarget) { mDragController.addDropTarget((DropTarget) view); From 1db7a972bfa8786fc8b58d57f832a378fa731eb0 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Mon, 16 Nov 2009 18:32:22 -0800 Subject: [PATCH 2/2] Fix 2260199 - App icons placed in folder widget are doubled after rebooting phone. I don't know why I did this piecemeal instead of just fixing it for widgets items and folders all at once. --- src/com/android/launcher2/LauncherModel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index a796831b64..262190df11 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -616,6 +616,7 @@ public class LauncherModel extends BroadcastReceiver { mItems.clear(); mAppWidgets.clear(); + mFolders.clear(); final Cursor c = contentResolver.query( LauncherSettings.Favorites.CONTENT_URI, null, null, null, null);