Skip to content

Commit 2533d89

Browse files
authored
Merge pull request #10 from SimpleAppProjects/develop
SimpleWeather: v5.8.2 - release
2 parents a29a8d8 + 90e8de5 commit 2533d89

File tree

20 files changed

+73
-67
lines changed

20 files changed

+73
-67
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android {
1414
minSdkVersion rootProject.minSdkVersion
1515
targetSdkVersion rootProject.targetSdkVersion
1616
// NOTE: Version Code Format (TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)
17-
versionCode 335820100
17+
versionCode 335820400
1818
versionName "5.8.2"
1919

2020
vectorDrawables.useSupportLibrary true
@@ -166,7 +166,7 @@ dependencies {
166166
fullgmsImplementation 'com.google.android.gms:play-services-base:18.2.0'
167167
fullgmsImplementation "com.google.android.gms:play-services-location:$gms_location_version"
168168
fullgmsImplementation 'com.google.android.gms:play-services-maps:18.1.0'
169-
fullgmsImplementation 'com.google.android.gms:play-services-wearable:18.0.0'
169+
fullgmsImplementation 'com.google.android.gms:play-services-wearable:18.1.0'
170170
fullgmsImplementation 'com.google.android.play:app-update-ktx:2.1.0'
171171
fullgmsImplementation 'com.google.android.play:feature-delivery-ktx:2.1.0'
172172
fullgmsImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinx_version"

app/src/main/java/com/thewizrd/simpleweather/setup/SetupSettingsFragment.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import android.view.ViewGroup
1111
import androidx.activity.result.ActivityResultLauncher
1212
import androidx.activity.result.contract.ActivityResultContracts
1313
import androidx.annotation.NonNull
14+
import androidx.core.text.util.LocalePreferences
1415
import androidx.preference.ListPreference
1516
import androidx.preference.SwitchPreferenceCompat
1617
import com.google.android.material.snackbar.BaseTransientBottomBar
@@ -77,12 +78,17 @@ class SetupSettingsFragment : CustomPreferenceFragmentCompat() {
7778
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
7879
setPreferencesFromResource(R.xml.pref_setup, rootKey)
7980

81+
val unitPref = findPreference<SwitchPreferenceCompat>(SettingsManager.KEY_USECELSIUS)!!
8082
val intervalPref = findPreference<ListPreference>(SettingsManager.KEY_REFRESHINTERVAL)!!
8183
val notIconPref = findPreference<ListPreference>(SettingsManager.KEY_NOTIFICATIONICON)!!
8284
val onGoingPref =
8385
findPreference<SwitchPreferenceCompat>(SettingsManager.KEY_ONGOINGNOTIFICATION)!!
8486
val alertsPref = findPreference<SwitchPreferenceCompat>(SettingsManager.KEY_USEALERTS)!!
8587

88+
if (LocalePreferences.getTemperatureUnit() == LocalePreferences.TemperatureUnit.CELSIUS) {
89+
unitPref.setDefaultValue(true)
90+
}
91+
8692
if (enableAdditionalRefreshIntervals()) {
8793
intervalPref.setEntries(R.array.premium_refreshinterval_entries)
8894
intervalPref.setEntryValues(R.array.premium_refreshinterval_values)

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ buildscript {
1919
activity_version = '1.7.2'
2020
appcompat_version = '1.6.1'
2121
constraintlayout_version = '2.1.4'
22-
core_version = '1.10.1'
22+
core_version = '1.12.0-rc01'
2323
arch_core_runtime_version = '2.2.0'
2424
fragment_version = '1.6.1'
2525
lifecycle_version = '2.6.1'

common/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,6 @@ dependencies {
8282
fullgmsImplementation 'com.google.android.gms:play-services-basement:18.2.0'
8383
fullgmsImplementation 'com.google.android.gms:play-services-tasks:18.0.2'
8484
fullgmsImplementation "com.google.android.gms:play-services-location:$gms_location_version"
85-
fullgmsImplementation 'com.google.android.gms:play-services-wearable:18.0.0'
85+
fullgmsImplementation 'com.google.android.gms:play-services-wearable:18.1.0'
8686
fullgmsImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinx_version"
8787
}

common/src/main/java/com/thewizrd/common/controls/DetailItemViewModel.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.content.Context;
44

55
import androidx.annotation.NonNull;
6+
import androidx.annotation.RestrictTo;
67

78
import com.thewizrd.shared_resources.R;
89
import com.thewizrd.shared_resources.SharedModuleKt;
@@ -272,6 +273,11 @@ public DetailItemViewModel(@NonNull UV uv) {
272273
}
273274
}
274275

276+
@RestrictTo(RestrictTo.Scope.TESTS)
277+
public DetailItemViewModel(@NonNull WeatherDetailsType detailsType) {
278+
this.detailsType = detailsType;
279+
}
280+
275281
@NonNull
276282
public WeatherDetailsType getDetailsType() {
277283
return detailsType;

shared_resources/src/main/java/com/thewizrd/shared_resources/preferences/SettingsManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SettingsManager(context: Context) {
7474
const val KEY_APIKEY = "API_KEY"
7575
private const val KEY_APIKEY_VERIFIED = "API_KEY_VERIFIED"
7676
const val KEY_APIKEY_PREFIX = "api_key"
77-
private const val KEY_USECELSIUS = "key_usecelsius"
77+
const val KEY_USECELSIUS = "key_usecelsius"
7878
const val KEY_WEATHERLOADED = "weatherLoaded"
7979
const val KEY_FOLLOWGPS = "key_followgps"
8080
private const val KEY_LASTGPSLOCATION = "key_lastgpslocation"

shared_resources/src/main/res/values-pl/weather_conditions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<string name="weather_fair">"Ładnie"</string>
3232
<string name="weather_rainandhail">"Deszcz z gradem"</string>
3333
<string name="weather_hot">"Gorąco"</string>
34-
<string name="weather_isotstorms">"Miejscowe burze z piorunami"</string>
34+
<string name="weather_isotstorms">"Pojedyncze burze z piorunami"</string>
3535
<string name="weather_scatteredtstorms">"Rozproszone burze z piorunami"</string>
3636
<string name="weather_scatteredshowers">"Rozproszone przelotne opady"</string>
3737
<string name="weather_heavysnow">"Silne opady śniegu"</string>

wearapp/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android {
1414
minSdkVersion 26
1515
targetSdkVersion rootProject.targetSdkVersion
1616
// NOTE: Version Code Format (TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)
17-
versionCode 335820101
17+
versionCode 335820401
1818
versionName "5.8.2"
1919

2020
vectorDrawables.useSupportLibrary true
@@ -136,7 +136,7 @@ dependencies {
136136
implementation "com.google.android.gms:play-services-location:$gms_location_version"
137137

138138
// WearOS
139-
implementation 'com.google.android.gms:play-services-wearable:18.0.0'
139+
implementation 'com.google.android.gms:play-services-wearable:18.1.0'
140140
compileOnly 'com.google.android.wearable:wearable:2.9.0'
141141

142142
implementation 'androidx.wear:wear:1.3.0'
Lines changed: 39 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
11
package com.thewizrd.simpleweather.ui.components
22

3-
import android.content.res.Configuration
3+
import androidx.compose.foundation.Image
44
import androidx.compose.foundation.layout.fillMaxWidth
5+
import androidx.compose.foundation.layout.heightIn
56
import androidx.compose.foundation.layout.size
7+
import androidx.compose.foundation.layout.wrapContentSize
68
import androidx.compose.runtime.Composable
9+
import androidx.compose.ui.Alignment
710
import androidx.compose.ui.Modifier
811
import androidx.compose.ui.draw.rotate
9-
import androidx.compose.ui.tooling.preview.Devices
10-
import androidx.compose.ui.tooling.preview.Preview
12+
import androidx.compose.ui.platform.LocalInspectionMode
13+
import androidx.compose.ui.res.painterResource
1114
import androidx.compose.ui.unit.dp
1215
import androidx.wear.compose.material.Chip
1316
import androidx.wear.compose.material.ChipDefaults
1417
import androidx.wear.compose.material.Text
18+
import androidx.wear.compose.ui.tooling.preview.WearPreviewFontScales
1519
import com.thewizrd.common.controls.DetailItemViewModel
1620
import com.thewizrd.common.controls.WeatherDetailsType
21+
import com.thewizrd.simpleweather.R
1722
import com.thewizrd.simpleweather.ui.text.spannableStringToAnnotatedString
23+
import com.thewizrd.simpleweather.ui.tools.WearPreviewDevices
24+
import org.jetbrains.annotations.TestOnly
1825

1926
@Composable
2027
fun WeatherDetailItem(
2128
model: DetailItemViewModel
2229
) {
30+
val isPreview = LocalInspectionMode.current
31+
2332
Chip(
24-
modifier = Modifier.fillMaxWidth(),
33+
modifier = Modifier
34+
.fillMaxWidth()
35+
.heightIn(min = 60.dp),
2536
label = {
2637
Text(
2738
text = spannableStringToAnnotatedString(model.label)
@@ -35,52 +46,36 @@ fun WeatherDetailItem(
3546
onClick = {},
3647
colors = ChipDefaults.secondaryChipColors(),
3748
icon = {
38-
WeatherIcon(
39-
modifier = Modifier
40-
.size(24.dp)
41-
.rotate(model.iconRotation.toFloat()),
42-
weatherIcon = model.icon
43-
)
49+
if (isPreview) {
50+
Image(
51+
modifier = Modifier
52+
.size(ChipDefaults.IconSize)
53+
.wrapContentSize(align = Alignment.Center),
54+
painter = painterResource(id = R.drawable.ic_error),
55+
contentDescription = ""
56+
)
57+
} else {
58+
WeatherIcon(
59+
modifier = Modifier
60+
.size(ChipDefaults.IconSize)
61+
.wrapContentSize(align = Alignment.Center)
62+
.rotate(model.iconRotation.toFloat()),
63+
weatherIcon = model.icon
64+
)
65+
}
4466
}
4567
)
4668
}
4769

48-
@Preview(
49-
apiLevel = 26,
50-
uiMode = Configuration.UI_MODE_TYPE_WATCH,
51-
showSystemUi = true,
52-
device = Devices.WEAR_OS_LARGE_ROUND,
53-
widthDp = 360,
54-
heightDp = 360,
55-
showBackground = true,
56-
backgroundColor = 0xFF000000
57-
)
58-
@Preview(
59-
apiLevel = 26,
60-
uiMode = Configuration.UI_MODE_TYPE_WATCH,
61-
showSystemUi = true,
62-
device = Devices.WEAR_OS_SQUARE,
63-
widthDp = 360,
64-
heightDp = 360,
65-
showBackground = true,
66-
backgroundColor = 0xFF000000
67-
)
68-
@Preview(
69-
apiLevel = 26,
70-
uiMode = Configuration.UI_MODE_TYPE_WATCH,
71-
showSystemUi = true,
72-
device = Devices.WEAR_OS_SMALL_ROUND,
73-
widthDp = 320,
74-
heightDp = 320,
75-
showBackground = true,
76-
backgroundColor = 0xFF000000
77-
)
70+
@WearPreviewDevices
71+
@WearPreviewFontScales
7872
@Composable
73+
@TestOnly
7974
fun PreviewWeatherDetailItem() {
8075
WeatherDetailItem(
81-
model = DetailItemViewModel(
82-
WeatherDetailsType.FEELSLIKE,
83-
"70°"
84-
)
76+
model = DetailItemViewModel(WeatherDetailsType.FEELSLIKE).apply {
77+
value = "70°"
78+
label = "Feels like"
79+
}
8580
)
8681
}

wearapp/src/main/java/com/thewizrd/simpleweather/wearable/complications/AQIComplicationService.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ class AQIComplicationService : BaseWeatherComplicationService() {
105105
).build()
106106
).setText(
107107
PlainComplicationText.Builder("57").build()
108-
).setTitle(
109-
PlainComplicationText.Builder(getString(R.string.label_airquality_short))
110-
.build()
111108
).build()
112109
}
113110
ComplicationType.SHORT_TEXT -> {
@@ -163,9 +160,6 @@ class AQIComplicationService : BaseWeatherComplicationService() {
163160
).build()
164161
).setText(
165162
PlainComplicationText.Builder(aqiIndex.toString()).build()
166-
).setTitle(
167-
PlainComplicationText.Builder(getString(R.string.label_airquality_short))
168-
.build()
169163
).setTapAction(
170164
getTapIntent(this)
171165
).build()

wearapp/src/main/java/com/thewizrd/simpleweather/wearable/complications/BeaufortComplicationService.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ class BeaufortComplicationService : WeatherHourlyForecastComplicationService() {
5757
).build()
5858
).setText(
5959
PlainComplicationText.Builder("3").build()
60-
).setTitle(
61-
PlainComplicationText.Builder("Beaufort").build()
6260
).build()
6361
}
6462
ComplicationType.SHORT_TEXT -> {
@@ -150,8 +148,6 @@ class BeaufortComplicationService : WeatherHourlyForecastComplicationService() {
150148
).build()
151149
).setText(
152150
PlainComplicationText.Builder(beaufortModel.progress.toString()).build()
153-
).setTitle(
154-
PlainComplicationText.Builder(beaufortModel.beaufort.label).build()
155151
).setTapAction(
156152
getTapIntent(this)
157153
).build()

wearapp/src/main/java/com/thewizrd/simpleweather/wearable/complications/UVComplicationService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class UVComplicationService : WeatherHourlyForecastComplicationService() {
4747
).setText(
4848
PlainComplicationText.Builder("3").build()
4949
).setTitle(
50-
PlainComplicationText.Builder(getString(R.string.label_uv)).build()
50+
PlainComplicationText.Builder("UV").build()
5151
).build()
5252
}
5353
ComplicationType.SHORT_TEXT -> {
@@ -107,7 +107,7 @@ class UVComplicationService : WeatherHourlyForecastComplicationService() {
107107
).setText(
108108
PlainComplicationText.Builder(uvModel.index.toString()).build()
109109
).setTitle(
110-
PlainComplicationText.Builder(getString(R.string.label_uv)).build()
110+
PlainComplicationText.Builder("UV").build()
111111
).setTapAction(
112112
getTapIntent(this)
113113
).build()

wearapp/src/main/java/com/thewizrd/simpleweather/wearable/tiles/WeatherCoroutinesTileService.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ abstract class WeatherCoroutinesTileService : SuspendingTileService() {
123123
Timber.tag(this::class.java.name).d("buildTile: v($wipKey)")
124124

125125
return Tile.Builder()
126-
.setResourcesVersion(wipKey)
126+
.setResourcesVersion("${wipKey}:${weather?.location?.name}:${weather?.condition?.observationTime}")
127127
.setTileTimeline(singleTileTimeline)
128128
.setFreshnessIntervalMillis(freshnessIntervalMillis)
129129
.build()
@@ -141,7 +141,7 @@ abstract class WeatherCoroutinesTileService : SuspendingTileService() {
141141
.setVersion(requestParams.version)
142142
.apply {
143143
produceRequestedResources(
144-
requestParams.version,
144+
requestParams.version.split(':').first(),
145145
requestParams.deviceConfiguration,
146146
requestParams.resourceIds
147147
)
@@ -157,7 +157,9 @@ abstract class WeatherCoroutinesTileService : SuspendingTileService() {
157157
deviceParameters: DeviceParameters,
158158
resourceIds: List<String>
159159
) {
160-
Timber.tag(this::class.java.name).d("produceRequestedResources")
160+
Timber.tag(this::class.java.name).d("produceRequestedResources: key = $wipKey")
161+
Timber.tag(this::class.java.name).d("res - resIds = $resourceIds")
162+
161163
val resources = resourceIds.takeIf { it.isNotEmpty() } ?: resources
162164

163165
if (resources.isNotEmpty()) {

wearapp/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@
4747
Weather (High/Low) -->
4848
<string name="complication_label_weather_hilo">"Wetter (hoch / niedrig)"</string>
4949
<string name="complication_label_weather_currentlocation">"Wetter (Standort)"</string>
50+
<string name="tile_label_weather_hrforecast">"Wetter + Stündliche Vorhersage"</string>
5051
</resources>

wearapp/src/main/res/values-es/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@
4444
Weather (High/Low) -->
4545
<string name="complication_label_weather_hilo">"Tiempo (Máx / Mín)"</string>
4646
<string name="complication_label_weather_currentlocation">"Tiempo (ubicación actual)"</string>
47+
<string name="tile_label_weather_hrforecast">"Tiempo + Previsión horaria"</string>
4748
</resources>

wearapp/src/main/res/values-fr/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@
4444
Weather (High/Low) -->
4545
<string name="complication_label_weather_hilo">"Météo (Max / Min)"</string>
4646
<string name="complication_label_weather_currentlocation">"Météo (emplacement actuel)"</string>
47+
<string name="tile_label_weather_hrforecast">"Météo + prévisions horaires"</string>
4748
</resources>

wearapp/src/main/res/values-nl/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@
4444
Weather (High/Low) -->
4545
<string name="complication_label_weather_hilo">"Weer (Max / Min)"</string>
4646
<string name="complication_label_weather_currentlocation">"Weer (huidige locatie)"</string>
47+
<string name="tile_label_weather_hrforecast">"Weer + Uurvoorspelling"</string>
4748
</resources>

wearapp/src/main/res/values-pl/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@
4444
Weather (High/Low) -->
4545
<string name="complication_label_weather_hilo">"Pogoda (Maks / Min)"</string>
4646
<string name="complication_label_weather_currentlocation">"Pogoda (obecna lokalizacja)"</string>
47+
<string name="tile_label_weather_hrforecast">"Pogoda + prognoza godzinowa"</string>
4748
</resources>

wearapp/src/main/res/values-sk/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ Weather (High/Low) -->
4545
<!-- Fuzzy -->
4646
<string name="complication_label_weather_hilo">"Počasie (V. / N.)"</string>
4747
<string name="complication_label_weather_currentlocation">"Počasie (súčasná poloha)"</string>
48+
<string name="tile_label_weather_hrforecast">"Počasie + hodinová predpoveď"</string>
4849
</resources>

wearapp/src/main/res/values-zh-rCN/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ Weather (High/Low) -->
6161
<!-- Fuzzy -->
6262
<string name="complication_label_weather_hilo">"天气 (高溫 / 低溫)"</string>
6363
<string name="complication_label_weather_currentlocation">"天气 (当前地址)"</string>
64+
<string name="tile_label_weather_hrforecast">"天气 + 每小时预报"</string>
6465
</resources>

0 commit comments

Comments
 (0)