summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/PagedViewWidget.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-01-05 13:54:43 -0800
committerWinson Chung <winsonc@google.com>2011-01-05 16:23:55 -0800
commit0499834db3f9dc6fb0f5f57b5876b8503bce5189 (patch)
treef2606e09998f9821e760ea2f6de6ffa5c08e3592 /src/com/android/launcher2/PagedViewWidget.java
parenta6612cd45fc77e4f44fcdd1a74833a61bf440720 (diff)
downloadandroid_packages_apps_Trebuchet-0499834db3f9dc6fb0f5f57b5876b8503bce5189.tar.gz
android_packages_apps_Trebuchet-0499834db3f9dc6fb0f5f57b5876b8503bce5189.tar.bz2
android_packages_apps_Trebuchet-0499834db3f9dc6fb0f5f57b5876b8503bce5189.zip
Fixing issues with holographic outline cache in AllApps/Customize.
- Fixing issue where the outline cache was not properly used when changing orientations - Making the outline cache static, and shared across both the AllApps/Customize (since they share an Apps view) - Making sure that holographic outlines for items on only one page are not created, since the holographic outlines will never be shown in that case. - No longer clearing outline cache as frequently Change-Id: I291db3802260249d0470d2637d871958baa8ebff
Diffstat (limited to 'src/com/android/launcher2/PagedViewWidget.java')
-rw-r--r--src/com/android/launcher2/PagedViewWidget.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 8c729b1ca..07a59eec4 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -52,6 +52,9 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
private final Canvas mHolographicOutlineCanvas = new Canvas();
private FastBitmapDrawable mPreview;
+ private PagedViewIconCache.Key mIconCacheKey;
+ private PagedViewIconCache mIconCache;
+
private int mAlpha = 255;
private int mHolographicAlpha;
@@ -97,6 +100,7 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
mHandler.post(new Runnable() {
public void run() {
widget.mHolographicOutline = outline;
+ widget.mIconCache.addOutline(widget.mIconCacheKey, outline);
widget.invalidate();
}
});
@@ -140,7 +144,7 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
private void queueHolographicOutlineCreation() {
// Generate the outline in the background
- if (mHolographicOutline == null) {
+ if (mHolographicOutline == null && mPreview != null) {
Message m = sWorker.obtainMessage(MESSAGE_CREATE_HOLOGRAPHIC_OUTLINE);
m.obj = this;
sWorker.sendMessage(m);
@@ -148,7 +152,8 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
}
public void applyFromAppWidgetProviderInfo(AppWidgetProviderInfo info,
- FastBitmapDrawable preview, int maxWidth, int[] cellSpan) {
+ FastBitmapDrawable preview, int maxWidth, int[] cellSpan,
+ PagedViewIconCache cache, boolean createHolographicOutline) {
final ImageView image = (ImageView) findViewById(R.id.widget_preview);
image.setMaxWidth(maxWidth);
image.setImageDrawable(preview);
@@ -156,17 +161,30 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
name.setText(info.label);
final TextView dims = (TextView) findViewById(R.id.widget_dims);
dims.setText(mContext.getString(R.string.widget_dims_format, cellSpan[0], cellSpan[1]));
- mPreview = preview;
+
+ if (createHolographicOutline) {
+ mIconCache = cache;
+ mIconCacheKey = new PagedViewIconCache.Key(info);
+ mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
+ mPreview = preview;
+ }
}
public void applyFromWallpaperInfo(ResolveInfo info, PackageManager packageManager,
- FastBitmapDrawable preview, int maxWidth) {
+ FastBitmapDrawable preview, int maxWidth, PagedViewIconCache cache,
+ boolean createHolographicOutline) {
ImageView image = (ImageView) findViewById(R.id.wallpaper_preview);
image.setMaxWidth(maxWidth);
image.setImageDrawable(preview);
TextView name = (TextView) findViewById(R.id.wallpaper_name);
name.setText(info.loadLabel(packageManager));
- mPreview = preview;
+
+ if (createHolographicOutline) {
+ mIconCache = cache;
+ mIconCacheKey = new PagedViewIconCache.Key(info);
+ mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
+ mPreview = preview;
+ }
}
@Override