summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-04-23 23:33:06 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-23 23:33:06 (GMT)
commit978f16d2e3c2e24a3fb6195957899c7556bcf587 (patch)
tree3cfdddda38cae86fdf751cda65d2a966a520295d
parentcabc4e5159ffa8ac6600418a204d8720fd41c913 (diff)
parentb8c663c492d32963b6ee33750fc985f037c58f10 (diff)
downloadandroid_packages_apps_Trebuchet-978f16d2e3c2e24a3fb6195957899c7556bcf587.zip
android_packages_apps_Trebuchet-978f16d2e3c2e24a3fb6195957899c7556bcf587.tar.gz
android_packages_apps_Trebuchet-978f16d2e3c2e24a3fb6195957899c7556bcf587.tar.bz2
Merge "Moving item to its old position in folder if DnD is cancelled" into ub-launcher3-burnaby
-rw-r--r--src/com/android/launcher3/Folder.java11
-rw-r--r--src/com/android/launcher3/FolderPagedView.java2
2 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index c35ce94..dff47c2 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -745,9 +745,18 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
replaceFolderWithFinalItem();
}
} else {
- rearrangeChildren();
// The drag failed, we need to return the item to the folder
+ ShortcutInfo info = (ShortcutInfo) d.dragInfo;
+ View icon = (mCurrentDragView != null && mCurrentDragView.getTag() == info)
+ ? mCurrentDragView : mContent.createNewView(info);
+ ArrayList<View> views = getItemsInReadingOrder();
+ views.add(info.rank, icon);
+ mContent.arrangeChildren(views, views.size());
+ mItemsInvalidated = true;
+
+ mSuppressOnAdd = true;
mFolderIcon.onDrop(d);
+ mSuppressOnAdd = false;
}
if (target != this) {
diff --git a/src/com/android/launcher3/FolderPagedView.java b/src/com/android/launcher3/FolderPagedView.java
index 6174892..3f08f43 100644
--- a/src/com/android/launcher3/FolderPagedView.java
+++ b/src/com/android/launcher3/FolderPagedView.java
@@ -363,7 +363,7 @@ public class FolderPagedView extends PagedView {
}
@SuppressLint("InflateParams")
- private View createNewView(ShortcutInfo item) {
+ public View createNewView(ShortcutInfo item) {
final BubbleTextView textView = (BubbleTextView) mInflater.inflate(
R.layout.folder_application, null, false);
textView.applyFromShortcutInfo(item, mIconCache, false);