Location: add icons for available payment methods (#1408)

* add backend for PaymentMethod.kt

* change type of acceptedPaymentMethods to Map<PaymentMethod, Boolean>

* add icons to UI and reduce PaymentMethod.kt to Cash and Card

* make OSM parsing for acceptedPaymentMethods correct (in an opinionated way)

* use Toll and TollOff icons

* fix seperator on empty payment methods

* fix sharedElement and animateEnterExit labels that are not part of the sharedElement

* (feat) shape schemes

---------

Co-authored-by: MM20 <15646950+MM2-0@users.noreply.github.com>
This commit is contained in:
shtrophic
2025-06-01 17:27:18 +02:00
committed by GitHub
co-authored by MM20
parent 1efffcf586
commit 78fa1d71dc
50 changed files with 2313 additions and 965 deletions
@@ -11,7 +11,10 @@ data class LauncherSettingsData internal constructor(
val schemaVersion: Int = 5,
val uiColorScheme: ColorScheme = ColorScheme.System,
val uiTheme: ThemeDescriptor = ThemeDescriptor.Default,
@JsonNames("uiTheme")
val uiColors: ColorsDescriptor = ColorsDescriptor.Default,
val uiShapes: ShapesDescriptor = ShapesDescriptor.Default,
val uiCompatModeColors: Boolean = false,
val uiFont: Font = Font.Outfit,
@Deprecated("No longer in use, only used for migration")
@@ -121,8 +124,10 @@ data class LauncherSettingsData internal constructor(
val systemBarsNavColors: SystemBarColors = SystemBarColors.Auto,
val surfacesOpacity: Float = 1f,
@Deprecated("Replaces with shape schemes")
val surfacesRadius: Int = 24,
val surfacesBorderWidth: Int = 0,
@Deprecated("Replaces with shape schemes")
val surfacesShape: SurfaceShape = SurfaceShape.Rounded,
val widgetsEditButton: Boolean = true,
@@ -201,20 +206,45 @@ enum class Font {
@Serializable
sealed interface ThemeDescriptor {
sealed interface ColorsDescriptor {
@Serializable
@SerialName("default")
data object Default : ThemeDescriptor
data object Default : ColorsDescriptor
@Serializable
@SerialName("bw")
data object BlackAndWhite : ThemeDescriptor
data object BlackAndWhite : ColorsDescriptor
@Serializable
@SerialName("custom")
data class Custom(
val id: String,
) : ThemeDescriptor
) : ColorsDescriptor
}
@Serializable
sealed interface ShapesDescriptor {
@Serializable
@SerialName("default")
data object Default : ShapesDescriptor
@Serializable
@SerialName("cut")
data object Cut : ShapesDescriptor
@Serializable
@SerialName("extra_round")
data object ExtraRound : ShapesDescriptor
@Serializable
@SerialName("rect")
data object Rect : ShapesDescriptor
@Serializable
@SerialName("custom")
data class Custom(
val id: String,
) : ShapesDescriptor
}
internal enum class ClockWidgetStyleEnum {
@@ -7,16 +7,14 @@ import de.mm20.launcher2.preferences.LauncherDataStore
import de.mm20.launcher2.preferences.ScreenOrientation
import de.mm20.launcher2.preferences.SearchBarColors
import de.mm20.launcher2.preferences.SearchBarStyle
import de.mm20.launcher2.preferences.SurfaceShape
import de.mm20.launcher2.preferences.SystemBarColors
import de.mm20.launcher2.preferences.ThemeDescriptor
import de.mm20.launcher2.preferences.ColorsDescriptor
import de.mm20.launcher2.preferences.ShapesDescriptor
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
data class CardStyle(
val opacity: Float = 1f,
val cornerRadius: Int = 0,
val shape: SurfaceShape = SurfaceShape.Rounded,
val borderWidth: Int = 0,
)
@@ -90,8 +88,6 @@ class UiSettings internal constructor(
get() = launcherDataStore.data.map {
CardStyle(
opacity = it.surfacesOpacity,
cornerRadius = it.surfacesRadius,
shape = it.surfacesShape,
borderWidth = it.surfacesBorderWidth,
)
}
@@ -102,24 +98,12 @@ class UiSettings internal constructor(
}
}
fun setCardRadius(radius: Int) {
launcherDataStore.update {
it.copy(surfacesRadius = radius)
}
}
fun setCardBorderWidth(borderWidth: Int) {
launcherDataStore.update {
it.copy(surfacesBorderWidth = borderWidth)
}
}
fun setCardShape(shape: SurfaceShape) {
launcherDataStore.update {
it.copy(surfacesShape = shape)
}
}
val dimWallpaper
get() = launcherDataStore.data.map {
it.wallpaperDim
@@ -302,14 +286,25 @@ class UiSettings internal constructor(
}
val theme
val colors
get() = launcherDataStore.data.map {
it.uiTheme
it.uiColors
}.distinctUntilChanged()
fun setTheme(theme: ThemeDescriptor) {
fun setColors(colors: ColorsDescriptor) {
launcherDataStore.update {
it.copy(uiTheme = theme)
it.copy(uiColors = colors)
}
}
val shapes
get() = launcherDataStore.data.map {
it.uiShapes
}.distinctUntilChanged()
fun setShapes(shapes: ShapesDescriptor) {
launcherDataStore.update {
it.copy(uiShapes = shapes)
}
}