Skip to content

Commit

Permalink
Merge pull request #10 from SimpleAppProjects/develop
Browse files Browse the repository at this point in the history
SimpleWeather: v5.8.2 - release
  • Loading branch information
thewizrd authored Sep 10, 2023
2 parents a29a8d8 + 90e8de5 commit 2533d89
Show file tree
Hide file tree
Showing 20 changed files with 73 additions and 67 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
// NOTE: Version Code Format (TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)
versionCode 335820100
versionCode 335820400
versionName "5.8.2"

vectorDrawables.useSupportLibrary true
Expand Down Expand Up @@ -166,7 +166,7 @@ dependencies {
fullgmsImplementation 'com.google.android.gms:play-services-base:18.2.0'
fullgmsImplementation "com.google.android.gms:play-services-location:$gms_location_version"
fullgmsImplementation 'com.google.android.gms:play-services-maps:18.1.0'
fullgmsImplementation 'com.google.android.gms:play-services-wearable:18.0.0'
fullgmsImplementation 'com.google.android.gms:play-services-wearable:18.1.0'
fullgmsImplementation 'com.google.android.play:app-update-ktx:2.1.0'
fullgmsImplementation 'com.google.android.play:feature-delivery-ktx:2.1.0'
fullgmsImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinx_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.view.ViewGroup
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.NonNull
import androidx.core.text.util.LocalePreferences
import androidx.preference.ListPreference
import androidx.preference.SwitchPreferenceCompat
import com.google.android.material.snackbar.BaseTransientBottomBar
Expand Down Expand Up @@ -77,12 +78,17 @@ class SetupSettingsFragment : CustomPreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.pref_setup, rootKey)

val unitPref = findPreference<SwitchPreferenceCompat>(SettingsManager.KEY_USECELSIUS)!!
val intervalPref = findPreference<ListPreference>(SettingsManager.KEY_REFRESHINTERVAL)!!
val notIconPref = findPreference<ListPreference>(SettingsManager.KEY_NOTIFICATIONICON)!!
val onGoingPref =
findPreference<SwitchPreferenceCompat>(SettingsManager.KEY_ONGOINGNOTIFICATION)!!
val alertsPref = findPreference<SwitchPreferenceCompat>(SettingsManager.KEY_USEALERTS)!!

if (LocalePreferences.getTemperatureUnit() == LocalePreferences.TemperatureUnit.CELSIUS) {
unitPref.setDefaultValue(true)
}

if (enableAdditionalRefreshIntervals()) {
intervalPref.setEntries(R.array.premium_refreshinterval_entries)
intervalPref.setEntryValues(R.array.premium_refreshinterval_values)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildscript {
activity_version = '1.7.2'
appcompat_version = '1.6.1'
constraintlayout_version = '2.1.4'
core_version = '1.10.1'
core_version = '1.12.0-rc01'
arch_core_runtime_version = '2.2.0'
fragment_version = '1.6.1'
lifecycle_version = '2.6.1'
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ dependencies {
fullgmsImplementation 'com.google.android.gms:play-services-basement:18.2.0'
fullgmsImplementation 'com.google.android.gms:play-services-tasks:18.0.2'
fullgmsImplementation "com.google.android.gms:play-services-location:$gms_location_version"
fullgmsImplementation 'com.google.android.gms:play-services-wearable:18.0.0'
fullgmsImplementation 'com.google.android.gms:play-services-wearable:18.1.0'
fullgmsImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinx_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;

import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;

import com.thewizrd.shared_resources.R;
import com.thewizrd.shared_resources.SharedModuleKt;
Expand Down Expand Up @@ -272,6 +273,11 @@ public DetailItemViewModel(@NonNull UV uv) {
}
}

@RestrictTo(RestrictTo.Scope.TESTS)
public DetailItemViewModel(@NonNull WeatherDetailsType detailsType) {
this.detailsType = detailsType;
}

@NonNull
public WeatherDetailsType getDetailsType() {
return detailsType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class SettingsManager(context: Context) {
const val KEY_APIKEY = "API_KEY"
private const val KEY_APIKEY_VERIFIED = "API_KEY_VERIFIED"
const val KEY_APIKEY_PREFIX = "api_key"
private const val KEY_USECELSIUS = "key_usecelsius"
const val KEY_USECELSIUS = "key_usecelsius"
const val KEY_WEATHERLOADED = "weatherLoaded"
const val KEY_FOLLOWGPS = "key_followgps"
private const val KEY_LASTGPSLOCATION = "key_lastgpslocation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<string name="weather_fair">"Ładnie"</string>
<string name="weather_rainandhail">"Deszcz z gradem"</string>
<string name="weather_hot">"Gorąco"</string>
<string name="weather_isotstorms">"Miejscowe burze z piorunami"</string>
<string name="weather_isotstorms">"Pojedyncze burze z piorunami"</string>
<string name="weather_scatteredtstorms">"Rozproszone burze z piorunami"</string>
<string name="weather_scatteredshowers">"Rozproszone przelotne opady"</string>
<string name="weather_heavysnow">"Silne opady śniegu"</string>
Expand Down
4 changes: 2 additions & 2 deletions wearapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
minSdkVersion 26
targetSdkVersion rootProject.targetSdkVersion
// NOTE: Version Code Format (TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)
versionCode 335820101
versionCode 335820401
versionName "5.8.2"

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

// WearOS
implementation 'com.google.android.gms:play-services-wearable:18.0.0'
implementation 'com.google.android.gms:play-services-wearable:18.1.0'
compileOnly 'com.google.android.wearable:wearable:2.9.0'

implementation 'androidx.wear:wear:1.3.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
package com.thewizrd.simpleweather.ui.components

import android.content.res.Configuration
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.Text
import androidx.wear.compose.ui.tooling.preview.WearPreviewFontScales
import com.thewizrd.common.controls.DetailItemViewModel
import com.thewizrd.common.controls.WeatherDetailsType
import com.thewizrd.simpleweather.R
import com.thewizrd.simpleweather.ui.text.spannableStringToAnnotatedString
import com.thewizrd.simpleweather.ui.tools.WearPreviewDevices
import org.jetbrains.annotations.TestOnly

@Composable
fun WeatherDetailItem(
model: DetailItemViewModel
) {
val isPreview = LocalInspectionMode.current

Chip(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier
.fillMaxWidth()
.heightIn(min = 60.dp),
label = {
Text(
text = spannableStringToAnnotatedString(model.label)
Expand All @@ -35,52 +46,36 @@ fun WeatherDetailItem(
onClick = {},
colors = ChipDefaults.secondaryChipColors(),
icon = {
WeatherIcon(
modifier = Modifier
.size(24.dp)
.rotate(model.iconRotation.toFloat()),
weatherIcon = model.icon
)
if (isPreview) {
Image(
modifier = Modifier
.size(ChipDefaults.IconSize)
.wrapContentSize(align = Alignment.Center),
painter = painterResource(id = R.drawable.ic_error),
contentDescription = ""
)
} else {
WeatherIcon(
modifier = Modifier
.size(ChipDefaults.IconSize)
.wrapContentSize(align = Alignment.Center)
.rotate(model.iconRotation.toFloat()),
weatherIcon = model.icon
)
}
}
)
}

@Preview(
apiLevel = 26,
uiMode = Configuration.UI_MODE_TYPE_WATCH,
showSystemUi = true,
device = Devices.WEAR_OS_LARGE_ROUND,
widthDp = 360,
heightDp = 360,
showBackground = true,
backgroundColor = 0xFF000000
)
@Preview(
apiLevel = 26,
uiMode = Configuration.UI_MODE_TYPE_WATCH,
showSystemUi = true,
device = Devices.WEAR_OS_SQUARE,
widthDp = 360,
heightDp = 360,
showBackground = true,
backgroundColor = 0xFF000000
)
@Preview(
apiLevel = 26,
uiMode = Configuration.UI_MODE_TYPE_WATCH,
showSystemUi = true,
device = Devices.WEAR_OS_SMALL_ROUND,
widthDp = 320,
heightDp = 320,
showBackground = true,
backgroundColor = 0xFF000000
)
@WearPreviewDevices
@WearPreviewFontScales
@Composable
@TestOnly
fun PreviewWeatherDetailItem() {
WeatherDetailItem(
model = DetailItemViewModel(
WeatherDetailsType.FEELSLIKE,
"70°"
)
model = DetailItemViewModel(WeatherDetailsType.FEELSLIKE).apply {
value = "70°"
label = "Feels like"
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ class AQIComplicationService : BaseWeatherComplicationService() {
).build()
).setText(
PlainComplicationText.Builder("57").build()
).setTitle(
PlainComplicationText.Builder(getString(R.string.label_airquality_short))
.build()
).build()
}
ComplicationType.SHORT_TEXT -> {
Expand Down Expand Up @@ -163,9 +160,6 @@ class AQIComplicationService : BaseWeatherComplicationService() {
).build()
).setText(
PlainComplicationText.Builder(aqiIndex.toString()).build()
).setTitle(
PlainComplicationText.Builder(getString(R.string.label_airquality_short))
.build()
).setTapAction(
getTapIntent(this)
).build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class BeaufortComplicationService : WeatherHourlyForecastComplicationService() {
).build()
).setText(
PlainComplicationText.Builder("3").build()
).setTitle(
PlainComplicationText.Builder("Beaufort").build()
).build()
}
ComplicationType.SHORT_TEXT -> {
Expand Down Expand Up @@ -150,8 +148,6 @@ class BeaufortComplicationService : WeatherHourlyForecastComplicationService() {
).build()
).setText(
PlainComplicationText.Builder(beaufortModel.progress.toString()).build()
).setTitle(
PlainComplicationText.Builder(beaufortModel.beaufort.label).build()
).setTapAction(
getTapIntent(this)
).build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class UVComplicationService : WeatherHourlyForecastComplicationService() {
).setText(
PlainComplicationText.Builder("3").build()
).setTitle(
PlainComplicationText.Builder(getString(R.string.label_uv)).build()
PlainComplicationText.Builder("UV").build()
).build()
}
ComplicationType.SHORT_TEXT -> {
Expand Down Expand Up @@ -107,7 +107,7 @@ class UVComplicationService : WeatherHourlyForecastComplicationService() {
).setText(
PlainComplicationText.Builder(uvModel.index.toString()).build()
).setTitle(
PlainComplicationText.Builder(getString(R.string.label_uv)).build()
PlainComplicationText.Builder("UV").build()
).setTapAction(
getTapIntent(this)
).build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ abstract class WeatherCoroutinesTileService : SuspendingTileService() {
Timber.tag(this::class.java.name).d("buildTile: v($wipKey)")

return Tile.Builder()
.setResourcesVersion(wipKey)
.setResourcesVersion("${wipKey}:${weather?.location?.name}:${weather?.condition?.observationTime}")
.setTileTimeline(singleTileTimeline)
.setFreshnessIntervalMillis(freshnessIntervalMillis)
.build()
Expand All @@ -141,7 +141,7 @@ abstract class WeatherCoroutinesTileService : SuspendingTileService() {
.setVersion(requestParams.version)
.apply {
produceRequestedResources(
requestParams.version,
requestParams.version.split(':').first(),
requestParams.deviceConfiguration,
requestParams.resourceIds
)
Expand All @@ -157,7 +157,9 @@ abstract class WeatherCoroutinesTileService : SuspendingTileService() {
deviceParameters: DeviceParameters,
resourceIds: List<String>
) {
Timber.tag(this::class.java.name).d("produceRequestedResources")
Timber.tag(this::class.java.name).d("produceRequestedResources: key = $wipKey")
Timber.tag(this::class.java.name).d("res - resIds = $resourceIds")

val resources = resourceIds.takeIf { it.isNotEmpty() } ?: resources

if (resources.isNotEmpty()) {
Expand Down
1 change: 1 addition & 0 deletions wearapp/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@
Weather (High/Low) -->
<string name="complication_label_weather_hilo">"Wetter (hoch / niedrig)"</string>
<string name="complication_label_weather_currentlocation">"Wetter (Standort)"</string>
<string name="tile_label_weather_hrforecast">"Wetter + Stündliche Vorhersage"</string>
</resources>
1 change: 1 addition & 0 deletions wearapp/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
Weather (High/Low) -->
<string name="complication_label_weather_hilo">"Tiempo (Máx / Mín)"</string>
<string name="complication_label_weather_currentlocation">"Tiempo (ubicación actual)"</string>
<string name="tile_label_weather_hrforecast">"Tiempo + Previsión horaria"</string>
</resources>
1 change: 1 addition & 0 deletions wearapp/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
Weather (High/Low) -->
<string name="complication_label_weather_hilo">"Météo (Max / Min)"</string>
<string name="complication_label_weather_currentlocation">"Météo (emplacement actuel)"</string>
<string name="tile_label_weather_hrforecast">"Météo + prévisions horaires"</string>
</resources>
1 change: 1 addition & 0 deletions wearapp/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
Weather (High/Low) -->
<string name="complication_label_weather_hilo">"Weer (Max / Min)"</string>
<string name="complication_label_weather_currentlocation">"Weer (huidige locatie)"</string>
<string name="tile_label_weather_hrforecast">"Weer + Uurvoorspelling"</string>
</resources>
1 change: 1 addition & 0 deletions wearapp/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
Weather (High/Low) -->
<string name="complication_label_weather_hilo">"Pogoda (Maks / Min)"</string>
<string name="complication_label_weather_currentlocation">"Pogoda (obecna lokalizacja)"</string>
<string name="tile_label_weather_hrforecast">"Pogoda + prognoza godzinowa"</string>
</resources>
1 change: 1 addition & 0 deletions wearapp/src/main/res/values-sk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ Weather (High/Low) -->
<!-- Fuzzy -->
<string name="complication_label_weather_hilo">"Počasie (V. / N.)"</string>
<string name="complication_label_weather_currentlocation">"Počasie (súčasná poloha)"</string>
<string name="tile_label_weather_hrforecast">"Počasie + hodinová predpoveď"</string>
</resources>
1 change: 1 addition & 0 deletions wearapp/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ Weather (High/Low) -->
<!-- Fuzzy -->
<string name="complication_label_weather_hilo">"天气 (高溫 / 低溫)"</string>
<string name="complication_label_weather_currentlocation">"天气 (当前地址)"</string>
<string name="tile_label_weather_hrforecast">"天气 + 每小时预报"</string>
</resources>

0 comments on commit 2533d89

Please sign in to comment.