diff options
author | Adam Cohen <adamcohen@google.com> | 2013-05-29 18:41:50 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2013-05-30 11:16:25 -0700 |
commit | 7a8b82b5926e6a520df28e7f591b9a94ec605581 (patch) | |
tree | 1d71182bff526877ced8429733a66e3c17964fa7 /src | |
parent | 03db8767d501cbde210f0999b60577546c232f8b (diff) | |
download | android_packages_apps_Trebuchet-7a8b82b5926e6a520df28e7f591b9a94ec605581.tar.gz android_packages_apps_Trebuchet-7a8b82b5926e6a520df28e7f591b9a94ec605581.tar.bz2 android_packages_apps_Trebuchet-7a8b82b5926e6a520df28e7f591b9a94ec605581.zip |
Fix for issue 7178173, item disappearing from folder
Change-Id: I8e4e2f04053a2fc29ca38dc130f39c57c5c019f7
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/Folder.java | 32 | ||||
-rw-r--r-- | src/com/android/launcher2/FolderIcon.java | 4 |
2 files changed, 21 insertions, 15 deletions
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java index c58189cde..ee150088b 100644 --- a/src/com/android/launcher2/Folder.java +++ b/src/com/android/launcher2/Folder.java @@ -690,22 +690,21 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList replaceFolderWithFinalItem(); } } else { + setupContentForNumItems(getItemCount()); // The drag failed, we need to return the item to the folder mFolderIcon.onDrop(d); - - // We're going to trigger a "closeFolder" which may occur before this item has - // been added back to the folder -- this could cause the folder to be deleted - if (mOnExitAlarm.alarmPending()) { - mSuppressFolderDeletion = true; - } } if (target != this) { if (mOnExitAlarm.alarmPending()) { mOnExitAlarm.cancelAlarm(); + if (!success) { + mSuppressFolderDeletion = true; + } completeDragExit(); } } + mDeleteFolderOnDropCompleted = false; mDragInProgress = false; mItemAddedBackToSelfViaIcon = false; @@ -1024,6 +1023,18 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mInfo.add(item); } + // This is used so the item doesn't immediately appear in the folder when added. In one case + // we need to create the illusion that the item isn't added back to the folder yet, to + // to correspond to the animation of the icon back into the folder. This is + public void hideItem(ShortcutInfo info) { + View v = getViewForInfo(info); + v.setVisibility(INVISIBLE); + } + public void showItem(ShortcutInfo info) { + View v = getViewForInfo(info); + v.setVisibility(VISIBLE); + } + public void onAdd(ShortcutInfo item) { mItemsInvalidated = true; // If the item was dropped onto this open folder, we have done the work associated @@ -1076,20 +1087,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList } public ArrayList<View> getItemsInReadingOrder() { - return getItemsInReadingOrder(true); - } - - public ArrayList<View> getItemsInReadingOrder(boolean includeCurrentDragItem) { if (mItemsInvalidated) { mItemsInReadingOrder.clear(); for (int j = 0; j < mContent.getCountY(); j++) { for (int i = 0; i < mContent.getCountX(); i++) { View v = mContent.getChildAt(i, j); if (v != null) { - ShortcutInfo info = (ShortcutInfo) v.getTag(); - if (info != mCurrentDragInfo || includeCurrentDragItem) { - mItemsInReadingOrder.add(v); - } + mItemsInReadingOrder.add(v); } } } diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java index 76374d237..33650c50a 100644 --- a/src/com/android/launcher2/FolderIcon.java +++ b/src/com/android/launcher2/FolderIcon.java @@ -402,9 +402,11 @@ public class FolderIcon extends LinearLayout implements FolderListener { postAnimationRunnable, DragLayer.ANIMATION_END_DISAPPEAR, null); addItem(item); mHiddenItems.add(item); + mFolder.hideItem(item); postDelayed(new Runnable() { public void run() { mHiddenItems.remove(item); + mFolder.showItem(item); invalidate(); } }, DROP_IN_ANIMATION_DURATION); @@ -535,7 +537,7 @@ public class FolderIcon extends LinearLayout implements FolderListener { if (mFolder == null) return; if (mFolder.getItemCount() == 0 && !mAnimating) return; - ArrayList<View> items = mFolder.getItemsInReadingOrder(false); + ArrayList<View> items = mFolder.getItemsInReadingOrder(); Drawable d; TextView v; |