summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2014-07-30 00:37:22 (GMT)
committerAbhisek Devkota <ciwrl@cyanogenmod.com>2014-12-02 01:19:49 (GMT)
commit48589f73feca7213df5d36648910ae1d521f9cf7 (patch)
tree7f0fac7688c308850eba629957f5876f24ddd38b
parenta50bd577ed6148ea3d1c803e140ddbcce71cddb1 (diff)
downloadandroid_packages_apps_Trebuchet-48589f73feca7213df5d36648910ae1d521f9cf7.zip
android_packages_apps_Trebuchet-48589f73feca7213df5d36648910ae1d521f9cf7.tar.gz
android_packages_apps_Trebuchet-48589f73feca7213df5d36648910ae1d521f9cf7.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 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;