summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2014-07-30 00:37:22 (GMT)
committerDanesh M <daneshm90@gmail.com>2014-07-30 00:37:31 (GMT)
commit6903b919c835e9e6c9d3a0b6b7e61c31cd12e0ac (patch)
treecd28fb32734478ff5abfeb1a0e0168f2ca31d914
parent498c660baad57f84f2979d0e3e1ebcf45a23f05c (diff)
downloadandroid_packages_apps_Trebuchet-6903b919c835e9e6c9d3a0b6b7e61c31cd12e0ac.zip
android_packages_apps_Trebuchet-6903b919c835e9e6c9d3a0b6b7e61c31cd12e0ac.tar.gz
android_packages_apps_Trebuchet-6903b919c835e9e6c9d3a0b6b7e61c31cd12e0ac.tar.bz2
Trebuchet : Add folder on folder checks
- Check if the new folder can accomodate all items - Don't expand folder if trying to drop folder on folder Change-Id: I208e3afd4ee6aeeea01928fc77e136d6085c4fdc
-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 b584b95..004fa4e 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -1010,6 +1010,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 464b35d..78e8c3a 100644
--- a/src/com/android/launcher3/FolderIcon.java
+++ b/src/com/android/launcher3/FolderIcon.java
@@ -325,11 +325,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) {
@@ -368,6 +375,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 {
item = (ShortcutInfo) mDragInfo;
}