Show solid color while icons are rendered

This commit is contained in:
MM20 2023-05-16 17:11:54 +02:00
parent e646844623
commit 49343e9690
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -52,7 +52,6 @@ import androidx.compose.ui.graphics.drawOutline
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.drawscope.scale import androidx.compose.ui.graphics.drawscope.scale
import androidx.compose.ui.graphics.drawscope.withTransform import androidx.compose.ui.graphics.drawscope.withTransform
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.nativeCanvas import androidx.compose.ui.graphics.nativeCanvas
import androidx.compose.ui.graphics.toAndroidRect import androidx.compose.ui.graphics.toAndroidRect
import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.graphics.toArgb
@ -164,7 +163,8 @@ fun ShapedLauncherIcon(
val bmp = currentBitmap val bmp = currentBitmap
val ic = currentIcon val ic = currentIcon
if (bmp != null && ic != null) { if (bmp != null && ic != null) {
Canvas(modifier = Modifier Canvas(
modifier = Modifier
.size(defaultIconSize) .size(defaultIconSize)
.scale(size / defaultIconSize, TransformOrigin.Center) .scale(size / defaultIconSize, TransformOrigin.Center)
) { ) {
@ -173,7 +173,11 @@ fun ShapedLauncherIcon(
drawRect(brush) drawRect(brush)
} else { } else {
val outline = val outline =
shape.createOutline(this.size, layoutDirection, Density(density, fontScale)) shape.createOutline(
this.size,
layoutDirection,
Density(density, fontScale)
)
drawOutline(outline, brush) drawOutline(outline, brush)
} }
} }
@ -190,6 +194,7 @@ fun ShapedLauncherIcon(
tintColor = null, tintColor = null,
) )
} }
is TintedClockLayer -> { is TintedClockLayer -> {
ClockLayer( ClockLayer(
sublayers = fg.sublayers, sublayers = fg.sublayers,
@ -204,6 +209,7 @@ fun ShapedLauncherIcon(
}, },
) )
} }
is TextLayer -> { is TextLayer -> {
Text( Text(
text = fg.text, text = fg.text,
@ -217,8 +223,20 @@ fun ShapedLauncherIcon(
}, },
) )
} }
else -> {} else -> {}
} }
} else {
val color = MaterialTheme.colorScheme.secondaryContainer
Canvas(
modifier = Modifier
.size(defaultIconSize)
.scale(size / defaultIconSize, TransformOrigin.Center)
) {
val outline =
shape.createOutline(this.size, layoutDirection, Density(density, fontScale))
drawOutline(outline, color)
}
} }
} }
val _badge = badge() val _badge = badge()