diff options
author | Mathew Inwood <mathewi@google.com> | 2013-11-19 15:45:07 +0000 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-06-06 22:54:19 -0700 |
commit | 454c49e6716289b869168a3e8ab8e6b645edc554 (patch) | |
tree | cec4b03bbf62421fd1e1e1f4a8d75f1974d18090 /src/com/android/launcher3/Launcher.java | |
parent | 0426f95e7a5aa34b0b6c220af769aa9f0b845ff3 (diff) | |
download | android_packages_apps_Trebuchet-454c49e6716289b869168a3e8ab8e6b645edc554.tar.gz android_packages_apps_Trebuchet-454c49e6716289b869168a3e8ab8e6b645edc554.tar.bz2 android_packages_apps_Trebuchet-454c49e6716289b869168a3e8ab8e6b645edc554.zip |
Add support for initiating a drag from an overlay.
This allows an overlay to create apps and shortcuts on the home screen.
Change-Id: I63ee4ef02db3f4bc89726c394fd55ad26f50452c
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 20 |
1 files changed, 20 insertions, 0 deletions
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. |