summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Folder.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-07-27 22:23:47 -0700
committerAdam Cohen <adamcohen@google.com>2011-07-27 23:27:22 -0700
commit228da5a24e5a680cfb7bec14a24d20b5cb595a34 (patch)
tree2ba6d5abe08d580e0bbd1e61ff4a45cd8d67d997 /src/com/android/launcher2/Folder.java
parent2f84ef259314b0bef20f6e7e503377212fadc88c (diff)
downloadandroid_packages_apps_Trebuchet-228da5a24e5a680cfb7bec14a24d20b5cb595a34.tar.gz
android_packages_apps_Trebuchet-228da5a24e5a680cfb7bec14a24d20b5cb595a34.tar.bz2
android_packages_apps_Trebuchet-228da5a24e5a680cfb7bec14a24d20b5cb595a34.zip
Some launcher bugs:
-> Allowing folders to be specified in xml (issue 5032559) -> Mostly fixing issue where you can lose items when dragging out of a folder to a full screen (issue 5052078) Change-Id: I3228dd568b2b8919c14594ee518f86173430481e
Diffstat (limited to 'src/com/android/launcher2/Folder.java')
-rw-r--r--src/com/android/launcher2/Folder.java27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 428d7b330..83f580c2a 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -98,6 +98,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;
@@ -511,7 +515,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;
}
@@ -655,17 +660,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
}
}
}
@@ -839,6 +843,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);
}