Add new icons

Added icons Egg, Diamond, Octagon, and Sharp Square
This commit is contained in:
SuperDragonXD
2022-08-29 17:40:03 +08:00
parent f83e8bd243
commit ea7181ebf8
3 changed files with 69 additions and 5 deletions

View File

@@ -104,13 +104,18 @@
<!-- <string name="icon_shape_label" /> -->
<string name="icon_shape_system">System</string>
<string name="icon_shape_circle">Circle</string>
<string name="icon_shape_square">Square</string>
<string name="icon_shape_rounded_square">Rounded Square</string>
<string name="icon_shape_squircle">Squircle</string>
<string name="icon_shape_sammy">One UI</string>
<string name="icon_shape_teardrop">Teardrop</string>
<string name="icon_shape_cylinder">Cylinder</string>
<string name="icon_shape_diamond">Diamond</string>
<string name="icon_shape_egg">Egg</string>
<string name="icon_shape_cupertino">iOS</string>
<string name="icon_shape_octagon">Octagon</string>
<string name="icon_shape_sammy">One UI</string>
<string name="icon_shape_rounded_square">Rounded Square</string>
<string name="icon_shape_sammy">One UI</string>
<string name="icon_shape_sharp_square">Sharp Square</string>
<string name="icon_shape_square">Square</string>
<string name="icon_shape_squircle">Squircle</string>
<string name="icon_shape_teardrop">Teardrop</string>
<!-- FontSelectionPreferences -->
<string name="pref_fonts_add_fonts">Add Fonts</string>

View File

@@ -206,6 +206,19 @@ open class IconShape(val topLeft: Corner,
}
}
object SharpSquare : IconShape(IconCornerShape.arc,
IconCornerShape.arc,
IconCornerShape.arc,
IconCornerShape.arc,
0f, 0f, 0f, 0f) {
override val windowTransitionRadius = 0f
override fun toString(): String {
return "sharpSquare"
}
}
object RoundedSquare : IconShape(IconCornerShape.arc,
IconCornerShape.arc,
IconCornerShape.arc,
@@ -279,18 +292,59 @@ open class IconShape(val topLeft: Corner,
}
}
object Octagon : IconShape(IconCornerShape.cut,
IconCornerShape.cut,
IconCornerShape.cut,
IconCornerShape.cut,
.5f, .5f, .5f, .5f) {
override fun toString(): String {
return "octagon"
}
}
object Diamond : IconShape(IconCornerShape.cut,
IconCornerShape.cut,
IconCornerShape.cut,
IconCornerShape.cut,
1f, 1f, 1f, 1f) {
override val windowTransitionRadius = 0f
override fun toString(): String {
return "diamond"
}
}
object Egg : IconShape(IconCornerShape.arc,
IconCornerShape.arc,
IconCornerShape.arc,
IconCornerShape.arc,
1f, 1f, 0.75f, 0.75f) {
override val windowTransitionRadius = 0.85f
override fun toString(): String {
return "egg"
}
}
companion object {
fun fromString(value: String): IconShape? {
return when (value) {
"circle" -> Circle
"square" -> Square
"sharpSquare" -> SharpSquare
"roundedSquare" -> RoundedSquare
"squircle" -> Squircle
"sammy" -> Sammy
"teardrop" -> Teardrop
"cylinder" -> Cylinder
"cupertino" -> Cupertino
"octagon" -> Octagon
"diamond" -> Diamond
"egg" -> Egg
"" -> null
else -> try {
parseCustomShape(value)

View File

@@ -51,12 +51,17 @@ fun NavGraphBuilder.iconShapeGraph(route: String) {
fun iconShapeEntries(context: Context): List<ListPreferenceEntry<IconShape>> {
val systemShape = IconShapeManager.getSystemIconShape(context)
return listOf(
// Organized as seen in /lawnchair/res/values/strings.xml
ListPreferenceEntry(systemShape) { stringResource(id = R.string.icon_shape_system) },
ListPreferenceEntry(IconShape.Circle) { stringResource(id = R.string.icon_shape_circle) },
ListPreferenceEntry(IconShape.Cylinder) { stringResource(id = R.string.icon_shape_cylinder) },
ListPreferenceEntry(IconShape.Diamond) { stringResource(id = R.string.icon_shape_diamond) },
ListPreferenceEntry(IconShape.Egg) { stringResource(id = R.string.icon_shape_egg) },
ListPreferenceEntry(IconShape.Cupertino) { stringResource(id = R.string.icon_shape_cupertino) },
ListPreferenceEntry(IconShape.Octagon) { stringResource(id = R.string.icon_shape_octagon) },
ListPreferenceEntry(IconShape.Sammy) { stringResource(id = R.string.icon_shape_sammy) },
ListPreferenceEntry(IconShape.RoundedSquare) { stringResource(id = R.string.icon_shape_rounded_square) },
ListPreferenceEntry(IconShape.SharpSquare) { stringResource(id = R.string.icon_shape_sharp_square) },
ListPreferenceEntry(IconShape.Square) { stringResource(id = R.string.icon_shape_square) },
ListPreferenceEntry(IconShape.Squircle) { stringResource(id = R.string.icon_shape_squircle) },
ListPreferenceEntry(IconShape.Teardrop) { stringResource(id = R.string.icon_shape_teardrop) },