summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Dubroy <dubroy@google.com>2010-06-23 22:39:02 (GMT)
committerPatrick Dubroy <dubroy@google.com>2010-06-29 17:36:30 (GMT)
commitb848ba188dee80ad460a65f7fa28b858972a87c9 (patch)
tree35aad1292d0f5afbd5850726804622ce24ff324a /src
parentaf44209bfa60da3c7ab49b7f508f9effd316ee41 (diff)
downloadandroid_packages_apps_Trebuchet-b848ba188dee80ad460a65f7fa28b858972a87c9.zip
android_packages_apps_Trebuchet-b848ba188dee80ad460a65f7fa28b858972a87c9.tar.gz
android_packages_apps_Trebuchet-b848ba188dee80ad460a65f7fa28b858972a87c9.tar.bz2
In the WidgetChooser, show the widget preview (if available) rather than the icon
Change-Id: I4d4ef7f31027e198b2f215f3e2d91da41e6ae99e
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/WidgetGalleryAdapter.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/com/android/launcher2/WidgetGalleryAdapter.java b/src/com/android/launcher2/WidgetGalleryAdapter.java
index d6272d4..bdb3551 100644
--- a/src/com/android/launcher2/WidgetGalleryAdapter.java
+++ b/src/com/android/launcher2/WidgetGalleryAdapter.java
@@ -23,6 +23,7 @@ import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -35,6 +36,7 @@ public class WidgetGalleryAdapter extends BaseAdapter {
private LayoutInflater mLayoutInflater;
private PackageManager mPackageManager;
private List<AppWidgetProviderInfo> mWidgets;
+ private static final String TAG = "Launcher.WidgetGalleryAdapter";
WidgetGalleryAdapter(Context context) {
mLayoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -65,8 +67,19 @@ public class WidgetGalleryAdapter extends BaseAdapter {
}
AppWidgetProviderInfo info = mWidgets.get(position);
- Drawable drawable = mPackageManager.getDrawable(info.provider.getPackageName(), info.icon, null);
- imageView.setImageDrawable(drawable);
+ Drawable image = null;
+ if (info.previewImage != 0) {
+ image = mPackageManager.getDrawable(
+ info.provider.getPackageName(), info.previewImage, null);
+ if (image == null) {
+ Log.w(TAG, "Can't load icon drawable 0x" + Integer.toHexString(info.icon)
+ + " for provider: " + info.provider);
+ }
+ }
+ if (image == null) {
+ image = mPackageManager.getDrawable(info.provider.getPackageName(), info.icon, null);
+ }
+ imageView.setImageDrawable(image);
return imageView;
}