From ea7181ebf8b0b882d4e4a00e581b544cccebb13e Mon Sep 17 00:00:00 2001 From: SuperDragonXD <70206496+SuperDragonXD@users.noreply.github.com> Date: Mon, 29 Aug 2022 17:40:03 +0800 Subject: [PATCH] Add new icons Added icons Egg, Diamond, Octagon, and Sharp Square --- lawnchair/res/values/strings.xml | 15 ++++-- .../app/lawnchair/icons/shape/IconShape.kt | 54 +++++++++++++++++++ .../components/IconShapePreference.kt | 5 ++ 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/lawnchair/res/values/strings.xml b/lawnchair/res/values/strings.xml index 2ecdd22ee9..aa62d3a2c0 100644 --- a/lawnchair/res/values/strings.xml +++ b/lawnchair/res/values/strings.xml @@ -104,13 +104,18 @@ System Circle - Square - Rounded Square - Squircle - One UI - Teardrop Cylinder + Diamond + Egg iOS + Octagon + One UI + Rounded Square + One UI + Sharp Square + Square + Squircle + Teardrop Add Fonts diff --git a/lawnchair/src/app/lawnchair/icons/shape/IconShape.kt b/lawnchair/src/app/lawnchair/icons/shape/IconShape.kt index a53cf052b4..2233e0e69e 100644 --- a/lawnchair/src/app/lawnchair/icons/shape/IconShape.kt +++ b/lawnchair/src/app/lawnchair/icons/shape/IconShape.kt @@ -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) diff --git a/lawnchair/src/app/lawnchair/ui/preferences/components/IconShapePreference.kt b/lawnchair/src/app/lawnchair/ui/preferences/components/IconShapePreference.kt index 30f6845087..63933c1f72 100644 --- a/lawnchair/src/app/lawnchair/ui/preferences/components/IconShapePreference.kt +++ b/lawnchair/src/app/lawnchair/ui/preferences/components/IconShapePreference.kt @@ -51,12 +51,17 @@ fun NavGraphBuilder.iconShapeGraph(route: String) { fun iconShapeEntries(context: Context): List> { 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) },