Skip to content

Commit a6bd0ed

Browse files
committed
bump version to 3.1.1, use dynamic icon in small pill widget, and replace string formatting with mathematical rounding for coordinates
1 parent 5847566 commit a6bd0ed

8 files changed

Lines changed: 15 additions & 13 deletions

File tree

.idea/deploymentTargetSelector.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ android {
3232
applicationId = "com.pranshulgg.weather_master_app"
3333
minSdk = 24
3434
targetSdk = 36
35-
versionCode = 48
36-
versionName = "3.1.0"
35+
versionCode = 49
36+
versionName = "3.1.1"
3737

3838
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3939

app/release/output-metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"type": "SINGLE",
1212
"filters": [],
1313
"attributes": [],
14-
"versionCode": 47,
15-
"versionName": "3.0.0",
14+
"versionCode": 48,
15+
"versionName": "3.1.0",
1616
"outputFile": "app-release.apk"
1717
}
1818
],

app/src/main/java/com/pranshulgg/weather_master_app/data/provider/devicelocation/DeviceLocationProvider.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ class GetDeviceLocation {
155155
* For e.g. "53,85893" -> app crashes, because upstream only takes in double
156156
* We convert that here
157157
*/
158-
private fun parseCord(value: Any): Double {
158+
private fun parseCord(value: Any?): Double? {
159159
return when (value) {
160160
is Double -> value
161161
is String -> value.replace(',', '.').toDouble()
162-
else -> error("Unsupported type")
162+
else -> null
163163
}
164164
}

app/src/main/java/com/pranshulgg/weather_master_app/data/repository/LocationsRepository.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ class LocationsRepository @Inject constructor(
109109
return
110110
}
111111

112-
val formattedLatitude = "%.5f".format(location.latitude).toDouble()
113-
val formattedLongitude = "%.5f".format(location.longitude).toDouble()
112+
113+
val formattedLatitude = kotlin.math.round(location.latitude * 100000) / 100000
114+
val formattedLongitude = kotlin.math.round(location.longitude * 100000) / 100000
114115

115116
dao.updateDeviceLocationPosition(formattedLatitude, formattedLongitude)
116117
}

app/src/main/java/com/pranshulgg/weather_master_app/feature/intro/IntroScreen.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,9 @@ private fun Icon() {
258258

259259
suspend fun DeviceLocation.toDomain(context: Context): Location {
260260

261-
val formattedLatitude = "%.5f".format(latitude).toDouble()
262-
val formattedLongitude = "%.5f".format(longitude).toDouble()
261+
262+
val formattedLatitude = kotlin.math.round(latitude!! * 100000) / 100000
263+
val formattedLongitude = kotlin.math.round(longitude!! * 100000) / 100000
263264

264265
val countryCode = getCountryCode(context, formattedLatitude, formattedLongitude)
265266

app/src/main/java/com/pranshulgg/weather_master_app/widgets/pill/ui/WeatherWidgetPillMedium.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fun WeatherWidgetPillMedium(state: WidgetWeather?) {
6262
}
6363

6464
Image(
65-
provider = ImageProvider(R.drawable.weather_clear_day),
65+
provider = ImageProvider(state.currentIcon),
6666
contentDescription = null,
6767
modifier = GlanceModifier
6868
.size(140.dp)

app/src/main/java/com/pranshulgg/weather_master_app/widgets/pill/ui/WeatherWidgetPillSmall.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fun WeatherWidgetPillSmall(state: WidgetWeather?) {
5656
}
5757

5858
Image(
59-
provider = ImageProvider(R.drawable.weather_clear_day),
59+
provider = ImageProvider(state.currentIcon),
6060
contentDescription = null,
6161
modifier = GlanceModifier
6262
.size(120.dp)

0 commit comments

Comments
 (0)