summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/widget/WidgetCell.java
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2015-04-28 15:06:45 -0700
committerHyunyoung Song <hyunyoungs@google.com>2015-04-28 15:06:45 -0700
commit559d90d0dafbac1d97a1e6f18062309831a25d51 (patch)
tree6427be948d4571798e55dfbb74660ac588fd2fde /src/com/android/launcher3/widget/WidgetCell.java
parent341220b954699dbf440024cfc2251f08d6fbc39f (diff)
downloadandroid_packages_apps_Trebuchet-559d90d0dafbac1d97a1e6f18062309831a25d51.tar.gz
android_packages_apps_Trebuchet-559d90d0dafbac1d97a1e6f18062309831a25d51.tar.bz2
android_packages_apps_Trebuchet-559d90d0dafbac1d97a1e6f18062309831a25d51.zip
WidgetPreviewLoader concurrency issue / Caching improvement
1) Concurrency issue: unused bitmap was not properly synchronized which caused concurrency issue. Hence, leading current widget tray implementation to not use it. (a.k.a. cancel(false)). Issue fixed and now using the unused bitmap pool. 2) Caching improvement: LoadedBitmap cache was a legacy support system for the old widget tray implementation. On our latest implementation, cache and recycled view is completely being managed by the recycler view. Hence removed. Change-Id: I843e6a286b676f283172f2c1ef5cbeed0a9fb17f
Diffstat (limited to 'src/com/android/launcher3/widget/WidgetCell.java')
-rw-r--r--src/com/android/launcher3/widget/WidgetCell.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index 7c7d982de..2df170eff 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -94,18 +94,25 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
mOriginalImagePadding.right = mWidgetImage.getPaddingRight();
mOriginalImagePadding.bottom = mWidgetImage.getPaddingBottom();
- // Ensure we are using the right text size
- DeviceProfile profile = LauncherAppState.getInstance().getDynamicGrid().getDeviceProfile();
mWidgetName = ((TextView) findViewById(R.id.widget_name));
mWidgetDims = ((TextView) findViewById(R.id.widget_dims));
}
- public void reset() {
+ /**
+ * Called to clear the view and free attached resources. (e.g., {@link Bitmap}
+ */
+ public void clear() {
+ if (DEBUG) {
+ Log.d(TAG, "reset called on:" + mWidgetName.getText());
+ }
mWidgetImage.setImageDrawable(null);
mWidgetName.setText(null);
mWidgetDims.setText(null);
- cancelLoader(false);
+ if (mActiveRequest != null) {
+ mActiveRequest.cleanup();
+ mActiveRequest = null;
+ }
}
/**
@@ -211,13 +218,6 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
return Math.min(size[0], info.spanX * cellWidth);
}
- private void cancelLoader(boolean recycleImage) {
- if (mActiveRequest != null) {
- mActiveRequest.cancel(recycleImage);
- mActiveRequest = null;
- }
- }
-
/**
* Helper method to get the string info of the tag.
*/