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:
@@ -1740,4 +1740,98 @@ private val _BreezyWeather = materialIcon("Icons.Rounded.BreezyWeather") {
|
||||
}
|
||||
|
||||
val Icons.Rounded.BreezyWeather
|
||||
get() = _BreezyWeather
|
||||
get() = _BreezyWeather
|
||||
|
||||
private val _TollOff = materialIcon("Icons.Rounded.TollOff") {
|
||||
materialPath {
|
||||
moveTo(2.8066406f, 3.2207031f)
|
||||
curveToRelative(-0.2556191f, 0f, -0.5111625f, 0.099053f, -0.7070312f, 0.2949219f)
|
||||
curveToRelative(-0.3917371f, 0.3917372f, -0.3917371f, 1.0223253f, 0f, 1.4140625f)
|
||||
lineToRelative(1.3339844f, 1.3320312f)
|
||||
verticalLineToRelative(0.00195f)
|
||||
curveTo(1.933574f, 7.7156369f, 0.99999996f, 9.7483802f, 1f, 12f)
|
||||
curveToRelative(3e-7f, 3.23f, 1.9196876f, 6.009532f, 4.6796875f, 7.269531f)
|
||||
curveTo(6.2896876f, 19.549531f, 7.0000003f, 19.129219f, 7f, 18.449219f)
|
||||
verticalLineToRelative(-0.179688f)
|
||||
curveToRelative(-3e-7f, -0.37f, -0.2303127f, -0.689609f, -0.5703125f, -0.849609f)
|
||||
curveTo(4.399687f, 16.459922f, 2.9999999f, 14.39f, 3f, 12f)
|
||||
curveToRelative(-2e-7f, -1.698485f, 0.7060878f, -3.2344795f, 1.84375f, -4.3261719f)
|
||||
lineToRelative(2.3925781f, 2.3906249f)
|
||||
verticalLineToRelative(0.002f)
|
||||
curveTo(7.0825208f, 10.685478f, 6.9999996f, 11.333026f, 7f, 12f)
|
||||
curveToRelative(0f, 4.42f, 3.58f, 8f, 8f, 8f)
|
||||
curveToRelative(0.666973f, 0f, 1.314475f, -0.08252f, 1.933594f, -0.236328f)
|
||||
horizontalLineToRelative(0.002f)
|
||||
lineToRelative(2.134765f, 2.136719f)
|
||||
curveToRelative(0.391737f, 0.391737f, 1.022326f, 0.391737f, 1.414063f, 0f)
|
||||
curveToRelative(0.391737f, -0.391738f, 0.391737f, -1.024279f, 0f, -1.416016f)
|
||||
lineTo(18.955078f, 18.955078f)
|
||||
lineTo(17.46875f, 17.46875f)
|
||||
lineTo(9.53125f, 9.53125f)
|
||||
lineTo(8.0449219f, 8.0449219f)
|
||||
lineTo(6.5273437f, 6.5273437f)
|
||||
lineTo(5.0507812f, 5.0507812f)
|
||||
lineTo(3.515625f, 3.515625f)
|
||||
curveTo(3.3197565f, 3.3197565f, 3.0622597f, 3.2207031f, 2.8066406f, 3.2207031f)
|
||||
close()
|
||||
moveTo(15f, 4f)
|
||||
curveToRelative(-2.25366f, 2e-7f, -4.288489f, 0.9314658f, -5.7421875f, 2.4296875f)
|
||||
lineTo(10.673828f, 7.8457031f)
|
||||
curveTo(11.766133f, 6.7086818f, 13.30143f, 6.0000002f, 15f, 6f)
|
||||
curveToRelative(3.31f, 4e-7f, 6f, 2.6899997f, 6f, 6f)
|
||||
curveToRelative(0f, 1.69857f, -0.708682f, 3.233867f, -1.845703f, 4.326172f)
|
||||
lineToRelative(1.416015f, 1.416015f)
|
||||
curveTo(22.068533f, 16.288488f, 23f, 14.25366f, 23f, 12f)
|
||||
curveTo(23f, 7.5799994f, 19.42f, 3.9999997f, 15f, 4f)
|
||||
close()
|
||||
moveToRelative(-5.9980469f, 7.832031f)
|
||||
lineToRelative(6.1660159f, 6.166016f)
|
||||
curveTo(15.112392f, 17.999575f, 15.055942f, 18f, 15f, 18f)
|
||||
curveTo(11.69f, 18f, 9.0000004f, 15.31f, 9f, 12f)
|
||||
curveToRelative(2e-7f, -0.05594f, 0.0004292f, -0.112391f, 0.00195f, -0.167969f)
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
||||
val Icons.Outlined.TollOff
|
||||
get() = _TollOff
|
||||
|
||||
val _CutCorner = materialIcon("Icons.Rounded.CutCorner") {
|
||||
materialPath {
|
||||
moveTo(2f, 3f)
|
||||
verticalLineTo(22f)
|
||||
horizontalLineTo(21f)
|
||||
verticalLineTo(11.585938f)
|
||||
lineTo(12.414063f, 3f)
|
||||
close()
|
||||
moveToRelative(2f, 2f)
|
||||
horizontalLineToRelative(7.585938f)
|
||||
lineTo(19f, 12.414063f)
|
||||
verticalLineTo(20f)
|
||||
horizontalLineTo(4f)
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
||||
val Icons.Rounded.CutCorner
|
||||
get() = _CutCorner
|
||||
|
||||
val _RoundedCornerAlt = materialIcon("Icons.Rounded.RoundedCornerAlt") {
|
||||
materialPath {
|
||||
moveTo(2f, 3f)
|
||||
verticalLineTo(22f)
|
||||
horizontalLineTo(21f)
|
||||
verticalLineTo(12f)
|
||||
curveTo(21f, 7.0412819f, 16.958718f, 3f, 12f, 3f)
|
||||
close()
|
||||
moveToRelative(2f, 2f)
|
||||
horizontalLineToRelative(8f)
|
||||
curveToRelative(3.877838f, 0f, 7f, 3.1221621f, 7f, 7f)
|
||||
verticalLineToRelative(8f)
|
||||
horizontalLineTo(4f)
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
||||
val Icons.Rounded.RoundedCornerAlt
|
||||
get() = _RoundedCornerAlt
|
||||
@@ -129,6 +129,7 @@ import de.mm20.launcher2.search.location.Departure
|
||||
import de.mm20.launcher2.search.location.LocationIcon
|
||||
import de.mm20.launcher2.search.location.OpeningHours
|
||||
import de.mm20.launcher2.search.location.OpeningSchedule
|
||||
import de.mm20.launcher2.search.location.PaymentMethod
|
||||
import java.time.LocalDateTime
|
||||
import java.time.temporal.TemporalAdjusters
|
||||
import android.location.Location as AndroidLocation
|
||||
@@ -154,6 +155,8 @@ interface Location : SavableSearchable {
|
||||
val openingSchedule: OpeningSchedule?
|
||||
val departures: List<Departure>?
|
||||
|
||||
val acceptedPaymentMethods: Map<PaymentMethod, Boolean>?
|
||||
|
||||
val attribution: Attribution?
|
||||
get() = null
|
||||
|
||||
|
||||
@@ -438,6 +438,11 @@
|
||||
<string name="preference_mdy_color_source">Source for dynamic colors</string>
|
||||
<string name="preference_mdy_color_source_system">System</string>
|
||||
<string name="preference_mdy_color_source_wallpaper">Wallpaper</string>
|
||||
<string name="preference_screen_shapes">Shapes</string>
|
||||
<string name="preference_shapes_default">Default</string>
|
||||
<string name="preference_shapes_extra_round">Extra round</string>
|
||||
<string name="preference_shapes_rect">Rectangualar</string>
|
||||
<string name="preference_shapes_base">Base shape</string>
|
||||
<string name="preference_font">Font</string>
|
||||
<string name="preference_font_system">System default</string>
|
||||
<string name="preference_screen_about">About</string>
|
||||
@@ -819,7 +824,9 @@
|
||||
<string name="note_widget_file_write_error">Error saving note</string>
|
||||
<string name="note_widget_file_write_error_description">The note could not be written to the linked file. Possibly, it has been moved or deleted. A copy has been saved to the launcher\'s internal storage.</string>
|
||||
<string name="confirmation_delete_color_scheme">Do you really want to delete the color scheme %1$s\?</string>
|
||||
<string name="confirmation_delete_shapes_scheme">Do you really want to delete the shapes scheme %1$s\?</string>
|
||||
<string name="new_color_scheme_name">New color scheme</string>
|
||||
<string name="new_shapes_name">New shapes</string>
|
||||
<string name="theme_color_scheme_system_default">Use system default</string>
|
||||
<string name="theme_color_scheme_autogenerate">From primary color</string>
|
||||
<string name="theme_color_scheme_palette_color">Palette</string>
|
||||
|
||||
+35
-5
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import de.mm20.launcher2.search.location.Attribution
|
||||
import de.mm20.launcher2.search.location.Departure
|
||||
import de.mm20.launcher2.search.location.LocationIcon
|
||||
import de.mm20.launcher2.search.location.OpeningSchedule
|
||||
import de.mm20.launcher2.search.location.PaymentMethod
|
||||
|
||||
abstract class LocationPluginContract {
|
||||
object Paths {
|
||||
@@ -139,5 +140,11 @@ abstract class LocationPluginContract {
|
||||
* Type: String? (JSON)
|
||||
*/
|
||||
val Attribution = column<Attribution>("attribution")
|
||||
|
||||
/**
|
||||
* Accepted payment methods at this location, encoded as JSON.
|
||||
* Type: String? (JSON)
|
||||
*/
|
||||
val AcceptedPaymentMethods = column<Map<PaymentMethod, Boolean>>("accepted_payment_methods")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.mm20.launcher2.search.location
|
||||
|
||||
enum class PaymentMethod {
|
||||
Cash,
|
||||
Card
|
||||
}
|
||||
Reference in New Issue
Block a user