summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathew Inwood <mathewi@google.com>2013-11-21 09:55:01 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-11-21 09:55:03 +0000
commit3705bb1b794ecb660e1ac57c4a3e99909d71a05e (patch)
tree3ea21ca478214d4f829543dc608361b6d9b3f3bf /src
parent954966bc2702b19151ab9d13c4983c2ecfb2150a (diff)
parent72fbec17e09a1120971621587d5005f683baafd1 (diff)
downloadandroid_packages_apps_Trebuchet-3705bb1b794ecb660e1ac57c4a3e99909d71a05e.tar.gz
android_packages_apps_Trebuchet-3705bb1b794ecb660e1ac57c4a3e99909d71a05e.tar.bz2
android_packages_apps_Trebuchet-3705bb1b794ecb660e1ac57c4a3e99909d71a05e.zip
Merge "Add support for initiating a drag from an overlay." into jb-ub-now-kermit
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/ItemInfo.java2
-rw-r--r--src/com/android/launcher3/Launcher.java20
-rw-r--r--src/com/android/launcher3/ShortcutInfo.java9
-rw-r--r--src/com/android/launcher3/Utilities.java4
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 7d84a3c88..ba3ba9327 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -45,6 +45,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;
@@ -4502,6 +4503,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);
+ }
+
/**
* Prints out out state for debugging.
*/
diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/ShortcutInfo.java
index dafabb8d9..fc087a897 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 21c546d04..9ffd044b4 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -43,7 +43,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;
@@ -111,7 +111,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);