Skip to content

Commit

Permalink
Update UI weather elements
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneeVandervelde committed Sep 4, 2024
1 parent 488a279 commit e05696e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ lifecycle-runtime-ktx = "2.8.2"
activity-compose = "1.7.0"
compose-bom = "2024.06.00"
regolith = "1.6.0"
ink-ui = "0.5.0"
ink-ui = "0.6.0"

[libraries.android-gradle]
version = "8.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ sealed interface DisplayItem: Spanable, Positionable {
val symbol: Symbol? = null,
val temperature: String? = null,
val condition: WeatherElement.Condition? = null,
val secondaryTemperature: String? = null,
val secondaryText: String? = null,
val daytime: Boolean? = null,
)

object Serializer: KSerializer<DisplayItem> {
Expand Down Expand Up @@ -147,7 +148,9 @@ sealed interface DisplayItem: Spanable, Positionable {
temperature = schema.temperature!!,
condition = schema.condition!!,
title = schema.text,
secondaryTemperature = schema.secondaryTemperature,
daytime = schema.daytime ?: false,
sentiment = schema.sentiment.orDefault(),
secondaryText = schema.secondaryText,
),
position = schema.position,
span = schema.span,
Expand Down Expand Up @@ -211,6 +214,7 @@ sealed interface DisplayItem: Spanable, Positionable {
is StatusIndicatorElement -> value.element.sentiment
is ThrobberElement -> value.element.sentiment
is ProgressElement -> value.element.sentiment
is WeatherElement -> value.element.sentiment
else -> Sentiment.Nominal
},
symbol = when (value.element) {
Expand All @@ -229,8 +233,12 @@ sealed interface DisplayItem: Spanable, Positionable {
is WeatherElement -> value.element.condition
else -> null
},
secondaryTemperature = when (value.element) {
is WeatherElement -> value.element.secondaryTemperature
secondaryText = when (value.element) {
is WeatherElement -> value.element.secondaryText
else -> null
},
daytime = when (value.element) {
is WeatherElement -> value.element.daytime
else -> null
},
)
Expand Down

0 comments on commit e05696e

Please sign in to comment.