summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-05-05 15:41:26 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-05 15:41:26 -0700
commit563ed71d682cc979a095fff7d27f1afe378508df (patch)
tree8cc2b6746c9a72cedd8e90b4f7f1e112c958afd2
parentb9b8ce94ff958792dd6ef81b0e50784fe8ad98a6 (diff)
parent4dbea7920a5f52df1d35009352f7e5cba16c05fb (diff)
downloadandroid_packages_apps_Trebuchet-563ed71d682cc979a095fff7d27f1afe378508df.tar.gz
android_packages_apps_Trebuchet-563ed71d682cc979a095fff7d27f1afe378508df.tar.bz2
android_packages_apps_Trebuchet-563ed71d682cc979a095fff7d27f1afe378508df.zip
Merge "Cleaning up icon code."
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java5
-rw-r--r--src/com/android/launcher2/CustomizePagedView.java9
-rw-r--r--src/com/android/launcher2/Launcher.java2
-rw-r--r--src/com/android/launcher2/LauncherModel.java11
-rw-r--r--src/com/android/launcher2/PagedViewIcon.java5
5 files changed, 9 insertions, 23 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index d0e96c6e4..307140d1d 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -80,6 +80,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
private Drawable mDefaultWidgetBackground;
private final int sWidgetPreviewCacheSize = 1 * 1024 * 1024; // 1 MiB
private LruCache<Object, Bitmap> mWidgetPreviewCache;
+ private IconCache mIconCache;
// Dimens
private int mContentWidth;
@@ -102,6 +103,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mContentType = ContentType.Applications;
mApps = new ArrayList<ApplicationInfo>();
mWidgets = new ArrayList<Object>();
+ mIconCache = ((LauncherApplication) context.getApplicationContext()).getIconCache();
mWidgetPreviewCache = new LruCache<Object, Bitmap>(sWidgetPreviewCacheSize) {
protected int sizeOf(Object key, Bitmap value) {
return value.getByteCount();
@@ -553,8 +555,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Render the icon
Bitmap preview = Bitmap.createBitmap(expectedWidth, expectedHeight, Config.ARGB_8888);
- IconCache cache = ((LauncherApplication) mLauncher.getApplication()).getIconCache();
- Drawable icon = cache.getFullResIcon(info, mPackageManager);
+ Drawable icon = mIconCache.getFullResIcon(info, mPackageManager);
renderDrawableToBitmap(mDefaultWidgetBackground, preview, 0, 0,
mWidgetPreviewIconPaddedDimension, mWidgetPreviewIconPaddedDimension, 1f, 1f);
renderDrawableToBitmap(icon, preview, offset, offset, iconSize, iconSize, 1f, 1f);
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 7bcfaadb2..b61713a76 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -301,13 +301,8 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
}
});
- Comparator<ResolveInfo> resolveInfoComparator = new Comparator<ResolveInfo>() {
- @Override
- public int compare(ResolveInfo object1, ResolveInfo object2) {
- return object1.loadLabel(mPackageManager).toString().compareTo(
- object2.loadLabel(mPackageManager).toString());
- }
- };
+ LauncherModel.ShortcutNameComparator resolveInfoComparator =
+ new LauncherModel.ShortcutNameComparator(mPackageManager);
// get the list of shortcuts
Intent shortcutsIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 76d01a7f0..e75830fe6 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2191,7 +2191,7 @@ public final class Launcher extends Activity
if (LauncherApplication.isScreenXLarge()) {
addItems();
} else {
- showAddDialog(longClickCellInfo.cellX, longClickCellInfo.cellY);
+ startWallpaper();
}
} else {
if (!(itemUnderLongClick instanceof Folder)) {
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index 72e0962aa..6240c8fab 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -1658,17 +1658,6 @@ public class LauncherModel extends BroadcastReceiver {
return folderInfo;
}
- private static String getLabel(PackageManager manager, ActivityInfo activityInfo) {
- String label = activityInfo.loadLabel(manager).toString();
- if (label == null) {
- label = manager.getApplicationLabel(activityInfo.applicationInfo).toString();
- if (label == null) {
- label = activityInfo.name;
- }
- }
- return label;
- }
-
private static final Collator sCollator = Collator.getInstance();
public static final Comparator<ApplicationInfo> APP_NAME_COMPARATOR
= new Comparator<ApplicationInfo>() {
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index d9852adcf..7aeb0af15 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -19,6 +19,7 @@ package com.android.launcher2;
import com.android.launcher.R;
import android.animation.ObjectAnimator;
+import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -171,8 +172,8 @@ public class PagedViewIcon extends CachedTextView implements Checkable {
public void applyFromResolveInfo(ResolveInfo info, PackageManager packageManager,
PagedViewIconCache cache, IconCache modelIconCache, boolean createHolographicOutlines) {
- mIcon = Utilities.createIconBitmap(
- modelIconCache.getFullResIcon(info, packageManager), mContext);
+ ComponentName cn = new ComponentName(info.activityInfo.packageName, info.activityInfo.name);
+ mIcon = modelIconCache.getIcon(cn, info);
setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(mIcon), null, null);
setText(info.loadLabel(packageManager));
setTag(info);