Clean up
This commit is contained in:
@@ -69,10 +69,10 @@ class GoogleClockIconProvider(val context: Context) : IconProvider {
|
||||
}
|
||||
ClockSublayer(
|
||||
drawable = drw,
|
||||
role = when {
|
||||
it == hourLayer -> ClockSublayerRole.Hour
|
||||
it == minuteLayer -> ClockSublayerRole.Minute
|
||||
it == secondLayer -> ClockSublayerRole.Second
|
||||
role = when (it) {
|
||||
hourLayer -> ClockSublayerRole.Hour
|
||||
minuteLayer -> ClockSublayerRole.Minute
|
||||
secondLayer -> ClockSublayerRole.Second
|
||||
else -> ClockSublayerRole.Static
|
||||
}
|
||||
)
|
||||
|
||||
@@ -44,8 +44,8 @@ class IconPackIconProvider(
|
||||
val resId = res.getIdentifier(drawableName, "drawable", iconPack).takeIf { it != 0 }
|
||||
?: return generateIcon(context, searchable.launcherActivityInfo, size)
|
||||
val drawable = ResourcesCompat.getDrawable(res, resId, context.theme) ?: return null
|
||||
return when {
|
||||
drawable is AdaptiveIconDrawable -> {
|
||||
return when (drawable) {
|
||||
is AdaptiveIconDrawable -> {
|
||||
return StaticLauncherIcon(
|
||||
foregroundLayer = drawable.foreground?.let {
|
||||
StaticIconLayer(
|
||||
@@ -135,7 +135,7 @@ class IconPackIconProvider(
|
||||
}
|
||||
if (upon != null) {
|
||||
res.getIdentifier(upon, "drawable", pack).takeIf { it != 0 }?.let {
|
||||
paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.SRC_OVER);
|
||||
paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)
|
||||
val maskDrawable = ResourcesCompat.getDrawable(res, it, null) ?: return null
|
||||
val maskBmp = maskDrawable.toBitmap(size, size)
|
||||
inBounds = Rect(0, 0, maskBmp.width, maskBmp.height)
|
||||
@@ -145,7 +145,7 @@ class IconPackIconProvider(
|
||||
}
|
||||
if (back != null) {
|
||||
res.getIdentifier(back, "drawable", pack).takeIf { it != 0 }?.let {
|
||||
paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OVER);
|
||||
paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OVER)
|
||||
val maskDrawable = ResourcesCompat.getDrawable(res, it, null) ?: return null
|
||||
val maskBmp = maskDrawable.toBitmap(size, size)
|
||||
inBounds = Rect(0, 0, maskBmp.width, maskBmp.height)
|
||||
|
||||
@@ -2,7 +2,6 @@ package de.mm20.launcher2.icons.providers
|
||||
|
||||
import android.content.Context
|
||||
import de.mm20.launcher2.icons.LauncherIcon
|
||||
import de.mm20.launcher2.preferences.Settings
|
||||
import de.mm20.launcher2.search.data.Searchable
|
||||
|
||||
class SystemIconProvider(
|
||||
|
||||
@@ -112,9 +112,9 @@ internal class ThemedIconProvider(
|
||||
}
|
||||
ClockSublayer(
|
||||
drawable = drw,
|
||||
role = when {
|
||||
it == hourIndex -> ClockSublayerRole.Hour
|
||||
it == minuteIndex -> ClockSublayerRole.Minute
|
||||
role = when (it) {
|
||||
hourIndex -> ClockSublayerRole.Hour
|
||||
minuteIndex -> ClockSublayerRole.Minute
|
||||
else -> ClockSublayerRole.Static
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user