Add teardrop icon shape

This commit is contained in:
MM20 2022-09-07 19:19:26 +02:00
parent d5270ab214
commit 0531628302
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
4 changed files with 34 additions and 0 deletions

View File

@ -450,6 +450,7 @@
<string name="preference_icon_shape_squircle">Squircle</string>
<string name="preference_icon_shape_triangle">Reuleaux triangle</string>
<string name="preference_icon_shape_circle">Circle</string>
<string name="preference_icon_shape_teardrop">Teardrop</string>
<string name="preference_icon_shape_hexagon">Hexagon</string>
<string name="preference_category_searchbar">Search bar</string>
<string name="preference_screen_services">Services</string>

View File

@ -219,6 +219,7 @@ message Settings {
Hexagon = 6;
Pentagon = 7;
EasterEgg = 8;
Teardrop = 9;
}
IconShape shape = 1;
bool themed_icons = 2;

View File

@ -368,6 +368,7 @@ fun getShape(iconShape: IconShape): Shape {
IconShape.Squircle -> SquircleShape
IconShape.Hexagon -> HexagonShape
IconShape.Pentagon -> PentagonShape
IconShape.Teardrop -> TeardropShape
IconShape.EasterEgg -> EasterEggShape
IconShape.UNRECOGNIZED -> CircleShape
}
@ -466,6 +467,36 @@ private val PentagonShape: Shape
close()
}
private val TeardropShape: Shape
get() = GenericShape { size, _ ->
moveTo(0.5f * size.width, 0f)
cubicTo(
0.776f * size.width, 0f,
size.width, 0.224f * size.height,
size.width, 0.5f * size.height,
)
lineTo(
size.width, 0.88f * size.height,
)
cubicTo(
size.width, 0.946f * size.height,
0.946f * size.width, size.height,
0.88f * size.width, size.height,
)
lineTo(0.5f * size.width, size.height)
cubicTo(
0.224f * size.width, size.height,
0f, 0.776f * size.height,
0f, 0.5f * size.height,
)
cubicTo(
0f, 0.224f * size.height,
0.224f * size.width, 0f,
0.5f * size.width, 0f,
)
close()
}
private val EasterEggShape: Shape
get() = GenericShape { size, _ ->
moveTo(

View File

@ -592,6 +592,7 @@ private fun getShapeName(shape: IconSettings.IconShape?): String? {
IconSettings.IconShape.Pentagon -> R.string.preference_icon_shape_pentagon
IconSettings.IconShape.PlatformDefault -> R.string.preference_icon_shape_platform
IconSettings.IconShape.Circle -> R.string.preference_icon_shape_circle
IconSettings.IconShape.Teardrop -> R.string.preference_icon_shape_teardrop
else -> return null
}
)