summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-08-15 14:22:53 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-15 14:22:53 -0700
commit14923d9dae1da7f0aacc13aa00ad8fb85d086b4a (patch)
tree832448ee2e75d09fd0d2c8efb882b2ae6d62aab5 /src/com
parentc273c5814d7b312628107ad4a7bff9cc64e89eae (diff)
parent0057bbcfa4a2ee12c5e87cba8c3fac8eadb078ed (diff)
downloadandroid_packages_apps_Trebuchet-14923d9dae1da7f0aacc13aa00ad8fb85d086b4a.tar.gz
android_packages_apps_Trebuchet-14923d9dae1da7f0aacc13aa00ad8fb85d086b4a.tar.bz2
android_packages_apps_Trebuchet-14923d9dae1da7f0aacc13aa00ad8fb85d086b4a.zip
Merge "Minor code cleanup, addresses issues raised in issue 5097504"
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher2/Folder.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index c490d5e6d..1fcfebc5a 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -297,13 +297,19 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
ArrayList<ShortcutInfo> children = info.contents;
ArrayList<ShortcutInfo> overflow = new ArrayList<ShortcutInfo>();
setupContentForNumItems(children.size());
+ int count = 0;
for (int i = 0; i < children.size(); i++) {
ShortcutInfo child = (ShortcutInfo) children.get(i);
if (!createAndAddShortcut(child)) {
overflow.add(child);
+ } else {
+ count++;
}
}
+ // We rearrange the items in case there are any empty gaps
+ setupContentForNumItems(count);
+
// If our folder has too many items we prune them from the list. This is an issue
// when upgrading from the old Folders implementation which could contain an unlimited
// number of items.
@@ -507,8 +513,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 ||
- item.cellX < 0 || item.cellY < 0) {
+ if (mContent.getChildAt(item.cellX, item.cellY) != null || item.cellX < 0 || item.cellY < 0
+ || item.cellX >= mContent.getCountX() || item.cellY >= mContent.getCountY()) {
if (!findAndSetEmptyCells(item)) {
return false;
}