Store themed attribute per icon pack icon
This commit is contained in:
@@ -8,6 +8,7 @@ data class IconPackIcon(
|
||||
val componentName: ComponentName?,
|
||||
val drawable: String?,
|
||||
val iconPack: String,
|
||||
val themed: Boolean = false,
|
||||
val name: String? = null,
|
||||
) {
|
||||
constructor(entity: IconEntity) : this(
|
||||
@@ -16,6 +17,7 @@ data class IconPackIcon(
|
||||
drawable = entity.drawable,
|
||||
iconPack = entity.iconPack,
|
||||
name = entity.name,
|
||||
themed = entity.themed,
|
||||
)
|
||||
|
||||
fun toDatabaseEntity(): IconEntity {
|
||||
@@ -25,6 +27,7 @@ data class IconPackIcon(
|
||||
drawable = drawable,
|
||||
iconPack = iconPack,
|
||||
name = name,
|
||||
themed = themed,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,6 @@ class IconPackManager(
|
||||
suspend fun getIcon(
|
||||
iconPack: String,
|
||||
componentName: ComponentName,
|
||||
themed: Boolean = false
|
||||
): LauncherIcon? {
|
||||
val res = try {
|
||||
context.packageManager.getResourcesForApplication(iconPack)
|
||||
@@ -75,7 +74,7 @@ class IconPackManager(
|
||||
val drawableName = icon.drawable ?: return null
|
||||
|
||||
if (icon.type == "calendar") {
|
||||
return getIconPackCalendarIcon(context, iconPack, drawableName, themed)
|
||||
return getIconPackCalendarIcon(context, iconPack, drawableName, icon.themed)
|
||||
}
|
||||
val resId = res.getIdentifier(drawableName, "drawable", iconPack).takeIf { it != 0 }
|
||||
?: return null
|
||||
@@ -85,7 +84,7 @@ class IconPackManager(
|
||||
return null
|
||||
}
|
||||
return when {
|
||||
themed && drawable is AdaptiveIconDrawable -> {
|
||||
icon.themed && drawable is AdaptiveIconDrawable -> {
|
||||
if (isAtLeastApiLevel(33) && drawable.monochrome != null) {
|
||||
return StaticLauncherIcon(
|
||||
foregroundLayer = StaticIconLayer(
|
||||
|
||||
@@ -122,6 +122,7 @@ class IconPackInstaller(
|
||||
drawable = drawable,
|
||||
iconPack = pkgName,
|
||||
name = name,
|
||||
themed = iconPack.themed,
|
||||
type = "app"
|
||||
)
|
||||
icons.add(icon)
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ class IconPackIconProvider(
|
||||
if (searchable !is LauncherApp) return null
|
||||
|
||||
val component = ComponentName(searchable.`package`, searchable.activity)
|
||||
return iconPackManager.getIcon(iconPack.packageName, component, iconPack.themed)
|
||||
return iconPackManager.getIcon(iconPack.packageName, component)
|
||||
?: iconPackManager.generateIcon(
|
||||
context,
|
||||
iconPack.packageName,
|
||||
|
||||
Reference in New Issue
Block a user