diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-04-15 09:42:19 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-04-15 17:12:04 -0700 |
commit | f406615354a92367481a60966b6b873cae37fe4c (patch) | |
tree | 68d773fe61d3bb0c667f7a610097d1835a23951c /src/com/android/launcher3/Launcher.java | |
parent | 6da9c32204347d0980d3e76a5ff03bc3431b49a7 (diff) | |
download | android_packages_apps_Trebuchet-f406615354a92367481a60966b6b873cae37fe4c.tar.gz android_packages_apps_Trebuchet-f406615354a92367481a60966b6b873cae37fe4c.tar.bz2 android_packages_apps_Trebuchet-f406615354a92367481a60966b6b873cae37fe4c.zip |
Fixing drag-n-drop for folders in hotseat.
The current drag-n-drop model assums that when a folder is open
it completely covers the folderIcon and its not possible to drop
anything on the icon. But its not true when a folder is in the
hotseat.
> When DnD finishes revert folder to the normal state
> Ensure that only one folder is open at a time
> Prevent folder icon from moving when the folder is open
Bug: 13646281,14680549
Change-Id: I016a4c3f0d9b57c388eaa28f40df9e7b7bbab5fc
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 42e145bc8..9ad87c3a6 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3112,10 +3112,19 @@ public class Launcher extends Activity */ public void openFolder(FolderIcon folderIcon) { Folder folder = folderIcon.getFolder(); + Folder openFolder = mWorkspace != null ? mWorkspace.getOpenFolder() : null; + if (openFolder != null && openFolder != folder) { + // Close any open folder before opening a folder. + closeFolder(); + } + FolderInfo info = folder.mInfo; info.opened = true; + // While the folder is open, the position of the icon cannot change. + ((CellLayout.LayoutParams) folderIcon.getLayoutParams()).canReorder = false; + // Just verify that the folder hasn't already been added to the DragLayer. // There was a one-off crash where the folder had a parent already. if (folder.getParent() == null) { @@ -3151,6 +3160,9 @@ public class Launcher extends Activity if (parent != null) { FolderIcon fi = (FolderIcon) mWorkspace.getViewForTag(folder.mInfo); shrinkAndFadeInFolderIcon(fi); + if (fi != null) { + ((CellLayout.LayoutParams) fi.getLayoutParams()).canReorder = true; + } } folder.animateClosed(); |