diff options
author | Michael Jurka <mikejurka@google.com> | 2013-01-23 12:39:24 +0100 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2013-02-04 20:32:49 +0100 |
commit | 05713af127d765cc28a8b2fd548a90347c90d6cb (patch) | |
tree | 71b8301d523d919a0195f8473527f12bdd7ffe39 /src/com/android/launcher2/PagedViewWidget.java | |
parent | 892d023c548a5e49b67b4c81ff1e3e9d02004e6e (diff) | |
download | android_packages_apps_Trebuchet-05713af127d765cc28a8b2fd548a90347c90d6cb.tar.gz android_packages_apps_Trebuchet-05713af127d765cc28a8b2fd548a90347c90d6cb.tar.bz2 android_packages_apps_Trebuchet-05713af127d765cc28a8b2fd548a90347c90d6cb.zip |
Cache widget previews in a DB
- Smoother All Apps scroll performance
Change-Id: Id2d31a45e71c63d05a46f580667ad94403730616
Diffstat (limited to 'src/com/android/launcher2/PagedViewWidget.java')
-rw-r--r-- | src/com/android/launcher2/PagedViewWidget.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java index b804ab0a2..1ee1c4ac0 100644 --- a/src/com/android/launcher2/PagedViewWidget.java +++ b/src/com/android/launcher2/PagedViewWidget.java @@ -46,6 +46,7 @@ public class PagedViewWidget extends LinearLayout { static PagedViewWidget sShortpressTarget = null; boolean mIsAppWidget; private final Rect mOriginalImagePadding = new Rect(); + private Object mInfo; public PagedViewWidget(Context context) { this(context, null); @@ -88,8 +89,8 @@ public class PagedViewWidget extends LinearLayout { final ImageView image = (ImageView) findViewById(R.id.widget_preview); if (image != null) { FastBitmapDrawable preview = (FastBitmapDrawable) image.getDrawable(); - if (preview != null && preview.getBitmap() != null) { - preview.getBitmap().recycle(); + if (mInfo != null && preview != null && preview.getBitmap() != null) { + WidgetPreviewLoader.releaseBitmap(mInfo, preview.getBitmap()); } image.setImageDrawable(null); } @@ -99,6 +100,7 @@ public class PagedViewWidget extends LinearLayout { public void applyFromAppWidgetProviderInfo(AppWidgetProviderInfo info, int maxWidth, int[] cellSpan) { mIsAppWidget = true; + mInfo = info; final ImageView image = (ImageView) findViewById(R.id.widget_preview); if (maxWidth > -1) { image.setMaxWidth(maxWidth); @@ -116,6 +118,7 @@ public class PagedViewWidget extends LinearLayout { public void applyFromResolveInfo(PackageManager pm, ResolveInfo info) { mIsAppWidget = false; + mInfo = info; CharSequence label = info.loadLabel(pm); final ImageView image = (ImageView) findViewById(R.id.widget_preview); image.setContentDescription(label); |