From 2e5c432a0aa7e83031575df73bed43a297e2eed3 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Tue, 6 Oct 2009 12:34:42 -0700 Subject: Launcher2: fix 2162230 - Can't add app shortcuts from 3D All Apps --- src/com/android/launcher2/DragController.java | 2 ++ src/com/android/launcher2/UserFolder.java | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/com/android') diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index 6994c3244..d4d142458 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -44,6 +44,8 @@ import java.util.ArrayList; * Class for initiating a drag within a view or across multiple views. */ public class DragController { + private static final String TAG = "Launcher.DragController"; + /** Indicates the drag is a move. */ public static int DRAG_ACTION_MOVE = 0; diff --git a/src/com/android/launcher2/UserFolder.java b/src/com/android/launcher2/UserFolder.java index 1379be6d0..16fe6160c 100644 --- a/src/com/android/launcher2/UserFolder.java +++ b/src/com/android/launcher2/UserFolder.java @@ -3,6 +3,7 @@ package com.android.launcher2; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ArrayAdapter; @@ -12,6 +13,8 @@ import android.widget.ArrayAdapter; * */ public class UserFolder extends Folder implements DropTarget { + private static final String TAG = "Launcher.UserFolder"; + public UserFolder(Context context, AttributeSet attrs) { super(context, attrs); } @@ -32,7 +35,8 @@ public class UserFolder extends Folder implements DropTarget { final ItemInfo item = (ItemInfo) dragInfo; final int itemType = item.itemType; return (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION || - itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) && item.container != mInfo.id; + itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) + && item.container != mInfo.id; } public Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset, @@ -42,7 +46,11 @@ public class UserFolder extends Folder implements DropTarget { public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset, DragView dragView, Object dragInfo) { - final ApplicationInfo item = (ApplicationInfo) dragInfo; + ApplicationInfo item = (ApplicationInfo) dragInfo; + if (item.container == NO_ID) { + // Came from all apps -- make a copy + item = new ApplicationInfo((ApplicationInfo)item); + } //noinspection unchecked ((ArrayAdapter) mContent.getAdapter()).add((ApplicationInfo) dragInfo); LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, 0, 0); -- cgit v1.2.3