This commit is contained in:
Tommaso Berlose
2020-05-21 13:30:15 +02:00
parent ec1c25cb4c
commit 770040ad93
15 changed files with 379 additions and 186 deletions

View File

@ -46,10 +46,10 @@ object WeatherHelper {
MainWidget.updateWidget(context)
}
fun getWeatherIconResource(icon: String): Int {
fun getWeatherIconResource(icon: String, style: Int = Preferences.weatherIconPack): Int {
return when (icon) {
"01d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.clear_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.clear_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.clear_day_4
@ -57,7 +57,7 @@ object WeatherHelper {
}
}
"02d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.partly_cloudy_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.partly_cloudy_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.partly_cloudy_4
@ -65,7 +65,7 @@ object WeatherHelper {
}
}
"03d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.mostly_cloudy_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.mostly_cloudy_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.mostly_cloudy_4
@ -73,7 +73,7 @@ object WeatherHelper {
}
}
"04d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.cloudy_weather_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.cloudy_weather_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.cloudy_weather_4
@ -81,7 +81,7 @@ object WeatherHelper {
}
}
"09d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.storm_weather_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.storm_weather_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.storm_weather_day_4
@ -89,7 +89,7 @@ object WeatherHelper {
}
}
"10d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.rainy_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rainy_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rainy_day_4
@ -97,7 +97,7 @@ object WeatherHelper {
}
}
"11d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.thunder_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.thunder_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.thunder_day_4
@ -105,7 +105,7 @@ object WeatherHelper {
}
}
"13d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.snow_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.snow_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.snow_day_4
@ -113,7 +113,7 @@ object WeatherHelper {
}
}
"50d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_day_4
@ -121,7 +121,7 @@ object WeatherHelper {
}
}
"80d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.windy_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.windy_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.windy_day_4
@ -129,7 +129,7 @@ object WeatherHelper {
}
}
"81d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.rain_snow_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rain_snow_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rain_snow_day_4
@ -137,7 +137,7 @@ object WeatherHelper {
}
}
"82d" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_weather_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_weather_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_weather_4
@ -148,7 +148,7 @@ object WeatherHelper {
"01n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.clear_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.clear_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.clear_night_4
@ -156,7 +156,7 @@ object WeatherHelper {
}
}
"02n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.partly_cloudy_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.partly_cloudy_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.partly_cloudy_night_4
@ -164,7 +164,7 @@ object WeatherHelper {
}
}
"03n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.mostly_cloudy_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.mostly_cloudy_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.mostly_cloudy_night_4
@ -172,7 +172,7 @@ object WeatherHelper {
}
}
"04n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.cloudy_weather_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.cloudy_weather_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.cloudy_weather_4
@ -180,7 +180,7 @@ object WeatherHelper {
}
}
"09n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.storm_weather_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.storm_weather_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.storm_weather_night_4
@ -188,7 +188,7 @@ object WeatherHelper {
}
}
"10n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.rainy_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rainy_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rainy_night_4
@ -196,7 +196,7 @@ object WeatherHelper {
}
}
"11n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.thunder_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.thunder_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.thunder_night_4
@ -204,7 +204,7 @@ object WeatherHelper {
}
}
"13n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.snow_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.snow_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.snow_night_4
@ -212,7 +212,7 @@ object WeatherHelper {
}
}
"50n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_night_4
@ -220,7 +220,7 @@ object WeatherHelper {
}
}
"80n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.windy_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.windy_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.windy_night_4
@ -228,7 +228,7 @@ object WeatherHelper {
}
}
"81n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.rain_snow_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rain_snow_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rain_snow_night_4
@ -236,7 +236,7 @@ object WeatherHelper {
}
}
"82n" -> {
when (Preferences.weatherIconPack) {
when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_weather_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_weather_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_weather_4