Cleaning up icon code.
- Changing long-press on homescreen to bring up wallpaper picker. Change-Id: I854b1b7dc5a102e95853732d6e9a4fa298144650
This commit is contained in:
1 parent
fd6e4511b0
commit
4dbea7920a
5 files changed
+9
-23
No files matched your search
@@ -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();
|
||||
@@ -552,8 +554,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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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>() {
|
||||
|
||||
@@ -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;
|
||||
@@ -174,8 +175,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);
|
||||
|
||||
Reference in new issue
Block a user