summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Folder.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-04-15 09:42:19 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-04-15 17:12:04 -0700
commitf406615354a92367481a60966b6b873cae37fe4c (patch)
tree68d773fe61d3bb0c667f7a610097d1835a23951c /src/com/android/launcher3/Folder.java
parent6da9c32204347d0980d3e76a5ff03bc3431b49a7 (diff)
downloadandroid_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/Folder.java')
-rw-r--r--src/com/android/launcher3/Folder.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 0eb1fd8bb..116332438 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -49,6 +49,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
import android.widget.TextView;
+import com.android.launcher3.DragController.DragListener;
import com.android.launcher3.FolderInfo.FolderListener;
import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.util.Thunk;
@@ -61,7 +62,7 @@ import java.util.Collections;
*/
public class Folder extends LinearLayout implements DragSource, View.OnClickListener,
View.OnLongClickListener, DropTarget, FolderListener, TextView.OnEditorActionListener,
- View.OnFocusChangeListener {
+ View.OnFocusChangeListener, DragListener {
private static final String TAG = "Launcher.Folder";
/**
@@ -537,6 +538,20 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mScrollPauseAlarm.setAlarm(SORTED_STICKY_REORDER_DELAY);
}
+ // Since this folder opened by another controller, it might not get onDrop or
+ // onDropComplete. Perform cleanup once drag-n-drop ends.
+ mDragController.addDragListener(this);
+ }
+
+ @Override
+ public void onDragStart(DragSource source, Object info, int dragAction) { }
+
+ @Override
+ public void onDragEnd() {
+ if (mIsExternalDrag && mDragInProgress) {
+ completeDragExit();
+ }
+ mDragController.removeDragListener(this);
}
@Thunk void sendCustomAccessibilityEvent(int type, String text) {
@@ -678,11 +693,15 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
};
public void completeDragExit() {
- mLauncher.closeFolder();
+ if (mInfo.opened) {
+ mLauncher.closeFolder();
+ mRearrangeOnClose = true;
+ } else {
+ rearrangeChildren();
+ }
mCurrentDragInfo = null;
mCurrentDragView = null;
mSuppressOnAdd = false;
- mRearrangeOnClose = true;
mIsExternalDrag = false;
}
@@ -1124,6 +1143,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mSuppressOnAdd = false;
// Clear the drag info, as it is no longer being dragged.
mCurrentDragInfo = null;
+ mDragInProgress = false;
}
// This is used so the item doesn't immediately appear in the folder when added. In one case