diff options
author | Adam Cohen <adamcohen@google.com> | 2011-07-28 09:54:34 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-28 09:54:34 -0700 |
commit | ac68b8151f081ad9989cf302e48ff215cd249848 (patch) | |
tree | 3675ac5c18ed4b5537df0fb390af8c9bd4dca469 /src/com/android/launcher2/Folder.java | |
parent | 292bffbdc8bf1c9110c0ef9fcd4fedc5f002c9e4 (diff) | |
parent | 228da5a24e5a680cfb7bec14a24d20b5cb595a34 (diff) | |
download | android_packages_apps_Trebuchet-ac68b8151f081ad9989cf302e48ff215cd249848.tar.gz android_packages_apps_Trebuchet-ac68b8151f081ad9989cf302e48ff215cd249848.tar.bz2 android_packages_apps_Trebuchet-ac68b8151f081ad9989cf302e48ff215cd249848.zip |
Merge "Some launcher bugs:"
Diffstat (limited to 'src/com/android/launcher2/Folder.java')
-rw-r--r-- | src/com/android/launcher2/Folder.java | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java index 014356bb6..780d0ed26 100644 --- a/src/com/android/launcher2/Folder.java +++ b/src/com/android/launcher2/Folder.java @@ -100,6 +100,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList private Rect mTempRect = new Rect(); private boolean mFirstOpen = true; + // Internal variable to track whether the folder was destroyed due to only a single + // item remaining + private boolean mDestroyed = false; + private boolean mIsEditingName = false; private InputMethodManager mInputMethodManager; @@ -514,7 +518,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList // by another item. If it is, we need to find the next available slot and assign // it that position. This is an issue when upgrading from the old Folders implementation // which could contain an unlimited number of items. - if (mContent.getChildAt(item.cellX, item.cellY) != null) { + if (mContent.getChildAt(item.cellX, item.cellY) != null || + item.cellX < 0 || item.cellY < 0) { if (!findAndSetEmptyCells(item)) { return false; } @@ -658,17 +663,16 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mCurrentDragInfo = null; mCurrentDragView = null; mSuppressOnAdd = false; + if (target != this) { + mOnExitAlarm.cancelAlarm(); + completeDragExit(); + } + if (!success) { - if (d.dragView != null) { - if (target instanceof CellLayout) { - // TODO: we should animate the item back to the folder in this case - } - } - // TODO: if the drag fails, we need to re-add the item - } else { - if (target != this) { - mOnExitAlarm.cancelAlarm(); - completeDragExit(); + if (!mDestroyed) { + mFolderIcon.onDrop(d); + } else { + // TODO: if the folder was removed, recreate it } } } @@ -842,6 +846,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList private void replaceFolderWithFinalItem() { ItemInfo finalItem = null; + mDestroyed = true; if (getItemCount() == 1) { finalItem = mInfo.contents.get(0); } |