Skip to content

Commit a2621be

Browse files
committed
rearrange weather widget, add uv index
Close #1630
1 parent 58f56b3 commit a2621be

File tree

18 files changed

+286
-171
lines changed

18 files changed

+286
-171
lines changed

app/ui/src/main/java/de/mm20/launcher2/ui/component/weather/WeatherIconColors.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ object WeatherIconDefaults {
6565
@Composable
6666
fun themedColors(backgroundColor: Color): WeatherIconColors {
6767

68-
val themeColor = MaterialTheme.colorScheme.primary
68+
val themeColor = MaterialTheme.colorScheme.secondary
6969
val neutralColor = MaterialTheme.colorScheme.outline
7070

7171
return remember(backgroundColor, themeColor, neutralColor) {

app/ui/src/main/java/de/mm20/launcher2/ui/launcher/widgets/weather/WeatherWidget.kt

Lines changed: 193 additions & 153 deletions
Large diffs are not rendered by default.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="20dp"
3+
android:height="20dp"
4+
android:viewportWidth="960"
5+
android:viewportHeight="960"
6+
android:tint="?attr/colorControlNormal">
7+
<path
8+
android:fillColor="@android:color/white"
9+
android:pathData="M240,768Q160,768 104,712Q48,656 48,576Q48,500 100,444.5Q152,389 227,384Q250,299 319.5,245.5Q389,192 480,192Q583,192 659,261.5Q735,331 744,432L744,432L744,432Q814,432 863,481Q912,530 912,600Q912,670 863,719Q814,768 744,768L240,768ZM240,696L744,696Q784,696 812,668Q840,640 840,600Q840,560 812,532Q784,504 744,504L678,504L672,439Q665,365 610,314.5Q555,264 480,264Q416,264 365,302.5Q314,341 297,404L283,453L232,456Q184,459 152,493.5Q120,528 120,576Q120,626 155,661Q190,696 240,696ZM480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480L480,480L480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480L480,480L480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Z"/>
10+
</vector>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="20dp"
3+
android:height="20dp"
4+
android:viewportWidth="960"
5+
android:viewportHeight="960"
6+
android:tint="?attr/colorControlNormal">
7+
<path
8+
android:fillColor="@android:color/white"
9+
android:pathData="M480,816Q360,816 276,732Q192,648 192,528Q192,474 211,425Q230,376 266,336L480,96L694,336Q730,376 749,425Q768,474 768,528Q768,648 684,732Q600,816 480,816ZM264,528L696,528Q696,488 682.5,450.5Q669,413 641,384L480,204L320,384Q292,413 278,450.5Q264,488 264,528Z"/>
10+
</vector>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="20dp"
3+
android:height="20dp"
4+
android:viewportWidth="960"
5+
android:viewportHeight="960"
6+
android:tint="?attr/colorControlNormal">
7+
<path
8+
android:fillColor="@android:color/white"
9+
android:pathData="M480,696L257,797Q246,802 235.5,800Q225,798 217,790Q209,782 206.5,772Q204,762 209,751L447,176Q452,165 460.5,159.5Q469,154 480,154Q491,154 499.5,159.5Q508,165 513,176L751,751Q756,762 753.5,772Q751,782 743,790Q735,798 724.5,800Q714,802 703,797L480,696ZM311,694L480,617L649,694L480,284L311,694ZM480,617L480,617L480,617L480,617Z"/>
10+
</vector>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="20dp"
3+
android:height="20dp"
4+
android:viewportWidth="960"
5+
android:viewportHeight="960"
6+
android:tint="?attr/colorControlNormal">
7+
<path
8+
android:fillColor="@android:color/white"
9+
android:pathData="M454.5,181.68Q444,171.35 444,156.09L444,84.26Q444,69 454.29,58.5Q464.58,48 479.79,48Q495,48 505.5,58.32Q516,68.65 516,83.91L516,155.74Q516,171 505.71,181.5Q495.42,192 480.21,192Q465,192 454.5,181.68ZM684,276Q673,266.14 673,251.36Q673,236.58 684,225.82L733.9,174.75Q744.59,164 759.3,164Q774,164 785,175Q796,186 796,200.5Q796,215 785,226L734,276Q723,287 709,287Q695,287 684,276ZM804.26,516Q789,516 778.5,505.71Q768,495.42 768,480.21Q768,465 778.32,454.5Q788.65,444 803.91,444L875.74,444Q891,444 901.5,454.29Q912,464.58 912,479.79Q912,495 901.68,505.5Q891.35,516 876.09,516L804.26,516ZM454.5,901.68Q444,891.35 444,876.09L444,804.26Q444,789 454.29,778.5Q464.58,768 479.79,768Q495,768 505.5,778.32Q516,788.65 516,803.91L516,875.74Q516,891 505.71,901.5Q495.42,912 480.21,912Q465,912 454.5,901.68ZM225.82,276L174.75,225.76Q164,215 164,200.5Q164,186 175,175Q186,165 200.5,164.5Q215,164 226,175L276,226Q287,237 287,251Q287,265 276,276Q265.25,287 250.91,287Q236.58,287 225.82,276ZM734,785L684,734Q673,723 673,709Q673,695 684,684Q695,673 709,673Q723,673 734,684L785.22,734.15Q796,744 796,759Q796,774 785.48,785Q774,796 759.5,796Q745,796 734,785ZM84.26,516Q69,516 58.5,505.71Q48,495.42 48,480.21Q48,465 58.32,454.5Q68.65,444 83.91,444L155.74,444Q171,444 181.5,454.29Q192,464.58 192,479.79Q192,495 181.68,505.5Q171.35,516 156.09,516L84.26,516ZM175,784.52Q164,774 164,759.5Q164,745 175,734L226,684Q237,674 251.18,674Q265.37,674 275.68,684.04Q286,695 286,709Q286,723 276,734L225.76,785.06Q215,796 200.5,796Q186,796 175,784.52ZM310,650Q240,580 240,480Q240,380 310,310Q380,240 480,240Q580,240 650,310Q720,380 720,480Q720,580 650,650Q580,720 480,720Q380,720 310,650ZM599,599Q648,550 648,480Q648,410 599,361Q550,312 480,312Q410,312 361,361Q312,410 312,480Q312,550 361,599Q410,648 480,648Q550,648 599,599ZM480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Z"/>
10+
</vector>

core/shared/src/main/java/de/mm20/launcher2/plugin/contracts/WeatherPluginContract.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ object WeatherPluginContract {
2929
val Precipitation = column<Double>("precipitation")
3030
val RainProbability = column<Int>("rain_probability")
3131
val Clouds = column<Int>("clouds")
32+
val UvIndex = column<Double>("uv_index")
3233
val Location = column<String>("location")
3334
val Provider = column<String>("provider")
3435
val ProviderUrl = column<String>("provider_url")

data/database/src/main/java/de/mm20/launcher2/database/AppDatabase.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import de.mm20.launcher2.database.migrations.Migration_27_28
4444
import de.mm20.launcher2.database.migrations.Migration_28_29
4545
import de.mm20.launcher2.database.migrations.Migration_29_30
4646
import de.mm20.launcher2.database.migrations.Migration_30_31
47+
import de.mm20.launcher2.database.migrations.Migration_31_32
4748
import de.mm20.launcher2.database.migrations.Migration_6_7
4849
import de.mm20.launcher2.database.migrations.Migration_7_8
4950
import de.mm20.launcher2.database.migrations.Migration_8_9
@@ -67,7 +68,7 @@ import java.util.UUID
6768
ShapesEntity::class,
6869
TransparenciesEntity::class,
6970
TypographyEntity::class,
70-
], version = 31, exportSchema = true
71+
], version = 32, exportSchema = true
7172
)
7273
@TypeConverters(ComponentNameConverter::class)
7374
abstract class AppDatabase : RoomDatabase() {
@@ -175,6 +176,7 @@ abstract class AppDatabase : RoomDatabase() {
175176
Migration_28_29(),
176177
Migration_29_30(),
177178
Migration_30_31(),
179+
Migration_31_32(),
178180
).build()
179181
if (_instance == null) _instance = instance
180182
return instance

data/database/src/main/java/de/mm20/launcher2/database/entities/ForecastEntity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ data class ForecastEntity(
2424
val provider: String,
2525
val providerUrl: String = "",
2626
@ColumnInfo(name = "rainProbability") val precipProbability: Int = -1,
27+
@Deprecated("Deprecated")
2728
val snowProbability: Int = -1,
29+
val uvIndex: Double = -1.0,
2830
val updateTime: Long
2931
) {
3032
companion object {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package de.mm20.launcher2.database.migrations
2+
3+
import androidx.room.migration.Migration
4+
import androidx.sqlite.db.SupportSQLiteDatabase
5+
import de.mm20.launcher2.ktx.toBytes
6+
import de.mm20.launcher2.preferences.WidgetScreenTarget
7+
8+
class Migration_31_32 : Migration(31, 32) {
9+
10+
override fun migrate(db: SupportSQLiteDatabase) {
11+
db.execSQL(
12+
"""
13+
ALTER TABLE `forecasts` ADD COLUMN `uvIndex` REAL NOT NULL DEFAULT -1.0;
14+
""".trimIndent(),
15+
)
16+
}
17+
}

0 commit comments

Comments
 (0)