summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-08-01 12:12:49 -0700
committerAdam Cohen <adamcohen@google.com>2011-08-01 12:12:49 -0700
commit05e0f40e50574f50678a9e1461cb245cddc46abb (patch)
tree916b82ea823ab8f56969ec45161ebbd1de02c30a /src
parent67bd9ccf856840856944815a382e4bbb0e71e949 (diff)
downloadandroid_packages_apps_Trebuchet-05e0f40e50574f50678a9e1461cb245cddc46abb.tar.gz
android_packages_apps_Trebuchet-05e0f40e50574f50678a9e1461cb245cddc46abb.tar.bz2
android_packages_apps_Trebuchet-05e0f40e50574f50678a9e1461cb245cddc46abb.zip
Fixing issue 5043360, double haptic feedback
-> Minor code cleanup in Folder.java Change-Id: I62267078bfdab9f37fdef28448a63760db1fc1fb
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Folder.java28
-rw-r--r--src/com/android/launcher2/Launcher.java2
2 files changed, 15 insertions, 15 deletions
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 652c8b03d..45730e018 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -101,7 +101,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private boolean mDragInProgress = false;
private boolean mDeleteFolderOnDropCompleted = false;
private boolean mSuppressFolderDeletion = false;
- private boolean mItemAddedBackToSelf = false;
+ private boolean mItemAddedBackToSelfViaIcon = false;
private boolean mIsEditingName = false;
private InputMethodManager mInputMethodManager;
@@ -221,7 +221,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mContent.removeView(mCurrentDragView);
mInfo.remove(mCurrentDragInfo);
mDragInProgress = true;
- mItemAddedBackToSelf = false;
+ mItemAddedBackToSelfViaIcon = false;
}
return true;
}
@@ -297,12 +297,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mContent.requestLayout();
}
- void onClose() {
- DragLayer parent = (DragLayer) getParent();
- parent.removeView(Folder.this);
- clearFocus();
- }
-
void bind(FolderInfo info) {
mInfo = info;
ArrayList<ShortcutInfo> children = info.contents;
@@ -465,7 +459,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
oa.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- onClose();
onCloseComplete();
mState = STATE_SMALL;
}
@@ -662,7 +655,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
public void onDropCompleted(View target, DragObject d, boolean success) {
if (success) {
- if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelf) {
+ if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon) {
replaceFolderWithFinalItem();
}
} else {
@@ -684,7 +677,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
mDeleteFolderOnDropCompleted = false;
mDragInProgress = false;
- mItemAddedBackToSelf = false;
+ mItemAddedBackToSelfViaIcon = false;
mCurrentDragInfo = null;
mCurrentDragView = null;
mSuppressOnAdd = false;
@@ -692,7 +685,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
public void notifyDrop() {
if (mDragInProgress) {
- mItemAddedBackToSelf = true;
+ mItemAddedBackToSelfViaIcon = true;
}
}
@@ -853,6 +846,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
private void onCloseComplete() {
+ DragLayer parent = (DragLayer) getParent();
+ parent.removeView(Folder.this);
+ clearFocus();
+
if (mRearrangeOnClose) {
setupContentForNumItems(getItemCount());
mRearrangeOnClose = false;
@@ -908,7 +905,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
} else {
item = (ShortcutInfo) d.dragInfo;
}
- // Dragged from self onto self
+ // Dragged from self onto self, currently this is the only path possible, however
+ // we keep this as a distinct code path.
if (item == mCurrentDragInfo) {
ShortcutInfo si = (ShortcutInfo) mCurrentDragView.getTag();
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) mCurrentDragView.getLayoutParams();
@@ -929,6 +927,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
public void onAdd(ShortcutInfo item) {
mItemsInvalidated = true;
+ // If the item was dropped onto this open folder, we have done the work associated
+ // with adding the item to the folder, as indicated by mSuppressOnAdd being set
if (mSuppressOnAdd) return;
if (!findAndSetEmptyCells(item)) {
// The current layout is full, can we expand it?
@@ -942,6 +942,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
public void onRemove(ShortcutInfo item) {
mItemsInvalidated = true;
+ // If this item is being dragged from this open folder, we have already handled
+ // the work associated with removing the item, so we don't have to do anything here.
if (item == mCurrentDragInfo) return;
View v = getViewForInfo(item);
mContent.removeView(v);
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 400c8813a..34cbf1a73 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1828,8 +1828,6 @@ public final class Launcher extends Activity
} else {
if (!(itemUnderLongClick instanceof Folder)) {
// User long pressed on an item
- mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
- HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
mWorkspace.startDrag(longClickCellInfo);
}
}