fixed crash when themed icons applied

This commit is contained in:
MrSluffy committed 2024-12-05 12:34:51 +08:00
1 parent 4b94189ee9
commit 68a866d1d2
3 files changed
+6 -7

No files matched your search

@@ -124,6 +124,7 @@ fun IconPackPreferences(
val isPortrait = LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT
val scrollState = rememberScrollState()
val drawerThemedIconsEnabled = drawerThemedIconsAdapter.state.value
val tintIconpack = prefs.tintIconPackBackgrounds.getAdapter()
PreferenceLayout(
label = stringResource(id = R.string.icon_style_label),
@@ -145,7 +146,7 @@ fun IconPackPreferences(
.clip(MaterialTheme.shapes.large),
) {
WallpaperPreview(modifier = Modifier.fillMaxSize())
key(iconPackAdapter.state.value, themedIconPackAdapter.state.value, themedIconsAdapter.state.value) {
key(iconPackAdapter.state.value, themedIconPackAdapter.state.value, themedIconsAdapter.state.value, tintIconpack.state.value) {
DummyLauncherLayout(
idp = invariantDeviceProfile(),
modifier = Modifier.fillMaxSize(),
@@ -314,17 +314,15 @@ public abstract class ItemInfoWithIcon extends ItemInfo {
* Returns a FastBitmapDrawable with the icon.
*/
public FastBitmapDrawable newIcon(Context context) {
return newIcon(context, PreferenceManager.getInstance(context).getThemedIcons().get());
return bitmap.newIcon(context);
}
/**
* Returns a FastBitmapDrawable with the icon and context theme applied
*/
public FastBitmapDrawable newIcon(Context context, boolean applyTheme) {
FastBitmapDrawable drawable = applyTheme
? bitmap.newThemedIcon(context) : bitmap.newIcon(context, BitmapInfo.FLAG_NO_BADGE);
drawable.setIsDisabled(isDisabled());
return drawable;
return applyTheme && PreferenceManager.getInstance(context).getThemedIcons().get()
? bitmap.newIcon(context) : bitmap.newIcon(context, BitmapInfo.FLAG_NO_BADGE);
}
/**