diff options
-rw-r--r-- | src/com/android/launcher3/ItemInfo.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 20 | ||||
-rw-r--r-- | src/com/android/launcher3/ShortcutInfo.java | 9 | ||||
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 4 |
4 files changed, 31 insertions, 4 deletions
diff --git a/src/com/android/launcher3/ItemInfo.java b/src/com/android/launcher3/ItemInfo.java index 8c4cefd5f..36ba6c14f 100644 --- a/src/com/android/launcher3/ItemInfo.java +++ b/src/com/android/launcher3/ItemInfo.java @@ -27,7 +27,7 @@ import java.io.IOException; /** * Represents an item in the launcher. */ -class ItemInfo { +public class ItemInfo { static final int NO_ID = -1; diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 57f7d5501..b7efdb5d3 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -49,6 +49,7 @@ import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.database.ContentObserver; @@ -4669,6 +4670,25 @@ public class Launcher extends Activity DISMISS_CLING_DURATION, true); } + public ItemInfo createAppDragInfo(Intent appLaunchIntent) { + ResolveInfo ri = getPackageManager().resolveActivity(appLaunchIntent, 0); + if (ri == null) { + return null; + } + return new AppInfo(getPackageManager(), ri, mIconCache, null); + } + + public ItemInfo createShortcutDragInfo(Intent shortcutIntent, CharSequence caption, + Bitmap icon) { + return new ShortcutInfo(shortcutIntent, caption, icon); + } + + public void startDrag(View dragView, ItemInfo dragInfo, DragSource source) { + dragView.setTag(dragInfo); + mWorkspace.onDragStartedWithItem(dragView); + mWorkspace.beginDragShared(dragView, source); + } + /** * To avoid managing preference change listeners for various parts of the * launcher we simply kill the process and let it reload from scratch. diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/ShortcutInfo.java index 0998eec2b..6f38eae54 100644 --- a/src/com/android/launcher3/ShortcutInfo.java +++ b/src/com/android/launcher3/ShortcutInfo.java @@ -71,7 +71,14 @@ class ShortcutInfo extends ItemInfo { protected Intent getIntent() { return intent; } - + + ShortcutInfo(Intent intent, CharSequence title, Bitmap icon) { + this(); + this.intent = intent; + this.title = title; + mIcon = icon; + } + public ShortcutInfo(Context context, ShortcutInfo info) { super(info); title = info.title.toString(); diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index f41a1c2e5..39848176a 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -36,7 +36,7 @@ import java.util.ArrayList; /** * Various utilities shared amongst the Launcher's classes. */ -final class Utilities { +public final class Utilities { private static final String TAG = "Launcher.Utilities"; private static int sIconWidth = -1; @@ -106,7 +106,7 @@ final class Utilities { /** * Returns a bitmap suitable for the all apps view. */ - static Bitmap createIconBitmap(Drawable icon, Context context) { + public static Bitmap createIconBitmap(Drawable icon, Context context) { synchronized (sCanvas) { // we share the statics :-( if (sIconWidth == -1) { initStatics(context); |