summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/Folder.java4
-rw-r--r--src/com/android/launcher3/FolderIcon.java11
2 files changed, 14 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 3a43ec1..e4f935c 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -1073,6 +1073,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
return getItemCount() >= mMaxNumItems;
}
+ public int getMaxItems() {
+ return mMaxNumItems;
+ }
+
private void centerAboutIcon() {
DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
diff --git a/src/com/android/launcher3/FolderIcon.java b/src/com/android/launcher3/FolderIcon.java
index f52706d..032d2a6 100644
--- a/src/com/android/launcher3/FolderIcon.java
+++ b/src/com/android/launcher3/FolderIcon.java
@@ -329,11 +329,18 @@ public class FolderIcon extends FrameLayout implements FolderListener {
}
return ((itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT ||
- itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER) &&
+ itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER &&
+ canMergeDragFolder((FolderInfo) item)) &&
!mFolder.isFull() && item != mInfo && !mInfo.opened &&
!hidden);
}
+ private boolean canMergeDragFolder(FolderInfo info) {
+ int currentCount = mFolder.getInfo().contents.size();
+ int dragFolderCount = info.contents.size();
+ return (currentCount + dragFolderCount) <= mFolder.getMaxItems();
+ }
+
public boolean acceptDrop(Object dragInfo) {
final ItemInfo item = (ItemInfo) dragInfo;
if (mInfo.hidden) {
@@ -377,6 +384,8 @@ public class FolderIcon extends FrameLayout implements FolderListener {
item = ((AppInfo) mDragInfo).makeShortcut();
item.spanX = 1;
item.spanY = 1;
+ } else if (mDragInfo instanceof FolderInfo) {
+ return;
} else {
// ShortcutInfo
item = (ShortcutInfo) mDragInfo;