mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Fix icon shape refresh for widgets list / legacy shortcut black bg issue
Bug: 118085499 Change-Id: Ifc3c711815567f40f109e95bcb76c01f23b4a3a2
This commit is contained in:
@@ -61,6 +61,7 @@ public class BaseIconFactory implements AutoCloseable {
|
||||
|
||||
mCanvas = new Canvas();
|
||||
mCanvas.setDrawFilter(new PaintFlagsDrawFilter(DITHER_FLAG, FILTER_BITMAP_FLAG));
|
||||
clear();
|
||||
}
|
||||
|
||||
protected void clear() {
|
||||
@@ -113,11 +114,6 @@ public class BaseIconFactory implements AutoCloseable {
|
||||
return createBadgedIconBitmap(icon, user, shrinkNonAdaptiveIcons, false, null);
|
||||
}
|
||||
|
||||
public BitmapInfo createBadgedIconBitmap(Drawable icon, UserHandle user,
|
||||
boolean shrinkNonAdaptiveIcons, boolean isInstantApp) {
|
||||
return createBadgedIconBitmap(icon, user, shrinkNonAdaptiveIcons, isInstantApp, null);
|
||||
}
|
||||
|
||||
public BitmapInfo createBadgedIconBitmap(Drawable icon, UserHandle user,
|
||||
int iconAppTargetSdk) {
|
||||
return createBadgedIconBitmap(icon, user, iconAppTargetSdk, false);
|
||||
|
||||
@@ -131,6 +131,7 @@ public class LauncherAppState {
|
||||
if ((changeFlags & CHANGE_FLAG_ICON_PARAMS) != 0) {
|
||||
LauncherIcons.clearPool();
|
||||
mIconCache.updateIconParams(idp.fillResIconDpi, idp.iconBitmapSize);
|
||||
mWidgetCache.refresh();
|
||||
}
|
||||
|
||||
mModel.forceReload();
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.Handler;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.util.LongSparseArray;
|
||||
@@ -73,7 +74,6 @@ public class WidgetPreviewLoader {
|
||||
private final Context mContext;
|
||||
private final IconCache mIconCache;
|
||||
private final UserManagerCompat mUserManager;
|
||||
private final AppWidgetManagerCompat mWidgetManager;
|
||||
private final CacheDb mDb;
|
||||
|
||||
private final MainThreadExecutor mMainThreadExecutor = new MainThreadExecutor();
|
||||
@@ -82,7 +82,6 @@ public class WidgetPreviewLoader {
|
||||
public WidgetPreviewLoader(Context context, IconCache iconCache) {
|
||||
mContext = context;
|
||||
mIconCache = iconCache;
|
||||
mWidgetManager = AppWidgetManagerCompat.getInstance(context);
|
||||
mUserManager = UserManagerCompat.getInstance(context);
|
||||
mDb = new CacheDb(context);
|
||||
mWorkerHandler = new Handler(LauncherModel.getWorkerLooper());
|
||||
@@ -107,6 +106,10 @@ public class WidgetPreviewLoader {
|
||||
return signal;
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
mDb.clear();
|
||||
|
||||
}
|
||||
/**
|
||||
* The DB holds the generated previews for various components. Previews can also have different
|
||||
* sizes (landscape vs portrait).
|
||||
@@ -474,8 +477,9 @@ public class WidgetPreviewLoader {
|
||||
RectF boxRect = drawBoxWithShadow(c, size, size);
|
||||
|
||||
LauncherIcons li = LauncherIcons.obtain(mContext);
|
||||
Bitmap icon = li.createScaledBitmapWithoutShadow(
|
||||
mutateOnMainThread(info.getFullResIcon(mIconCache)), 0);
|
||||
Bitmap icon = li.createBadgedIconBitmap(
|
||||
mutateOnMainThread(info.getFullResIcon(mIconCache)),
|
||||
Process.myUserHandle(), 0).icon;
|
||||
li.recycle();
|
||||
|
||||
Rect src = new Rect(0, 0, icon.getWidth(), icon.getHeight());
|
||||
|
||||
@@ -56,11 +56,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch
|
||||
addOnItemTouchListener(this);
|
||||
}
|
||||
|
||||
public WidgetsRecyclerView(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
this(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
Reference in New Issue
Block a user