mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 17:06:49 +00:00
Fix crash when rotating all apps
Bug: 8134296
This commit is contained in:
@@ -47,6 +47,7 @@ public class PagedViewWidget extends LinearLayout {
|
||||
boolean mIsAppWidget;
|
||||
private final Rect mOriginalImagePadding = new Rect();
|
||||
private Object mInfo;
|
||||
private WidgetPreviewLoader mWidgetPreviewLoader;
|
||||
|
||||
public PagedViewWidget(Context context) {
|
||||
this(context, null);
|
||||
@@ -90,7 +91,7 @@ public class PagedViewWidget extends LinearLayout {
|
||||
if (image != null) {
|
||||
FastBitmapDrawable preview = (FastBitmapDrawable) image.getDrawable();
|
||||
if (mInfo != null && preview != null && preview.getBitmap() != null) {
|
||||
WidgetPreviewLoader.releaseBitmap(mInfo, preview.getBitmap());
|
||||
mWidgetPreviewLoader.releaseBitmap(mInfo, preview.getBitmap());
|
||||
}
|
||||
image.setImageDrawable(null);
|
||||
}
|
||||
@@ -98,7 +99,7 @@ public class PagedViewWidget extends LinearLayout {
|
||||
}
|
||||
|
||||
public void applyFromAppWidgetProviderInfo(AppWidgetProviderInfo info,
|
||||
int maxWidth, int[] cellSpan) {
|
||||
int maxWidth, int[] cellSpan, WidgetPreviewLoader loader) {
|
||||
mIsAppWidget = true;
|
||||
mInfo = info;
|
||||
final ImageView image = (ImageView) findViewById(R.id.widget_preview);
|
||||
@@ -114,9 +115,11 @@ public class PagedViewWidget extends LinearLayout {
|
||||
int vSpan = Math.min(cellSpan[1], LauncherModel.getCellCountY());
|
||||
dims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
|
||||
}
|
||||
mWidgetPreviewLoader = loader;
|
||||
}
|
||||
|
||||
public void applyFromResolveInfo(PackageManager pm, ResolveInfo info) {
|
||||
public void applyFromResolveInfo(
|
||||
PackageManager pm, ResolveInfo info, WidgetPreviewLoader loader) {
|
||||
mIsAppWidget = false;
|
||||
mInfo = info;
|
||||
CharSequence label = info.loadLabel(pm);
|
||||
@@ -128,6 +131,7 @@ public class PagedViewWidget extends LinearLayout {
|
||||
if (dims != null) {
|
||||
dims.setText(String.format(mDimensionsFormatString, 1, 1));
|
||||
}
|
||||
mWidgetPreviewLoader = loader;
|
||||
}
|
||||
|
||||
public int[] getPreviewSize() {
|
||||
|
||||
Reference in New Issue
Block a user