From c2c385052470cac2f8c2a6bb481db788b930f3ed Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Wed, 21 Dec 2022 09:33:37 +0100 Subject: [PATCH] Fallback to the forecast city --- .../java/foundation/e/blisslauncher/core/Preferences.java | 4 ++-- .../e/blisslauncher/features/weather/ForecastBuilder.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/Preferences.java b/app/src/main/java/foundation/e/blisslauncher/core/Preferences.java index 859b4892fc..70e6db98d6 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/Preferences.java +++ b/app/src/main/java/foundation/e/blisslauncher/core/Preferences.java @@ -242,8 +242,8 @@ public class Preferences { editor.apply(); } - public static String getCachedCity(Context context) { - return getPrefs(context).getString(Constants.CACHED_CITY, "Unknown"); + public static String getCachedCity(Context context, String fallbackCity) { + return getPrefs(context).getString(Constants.CACHED_CITY, fallbackCity); } public static long lastWeatherUpdateTimestamp(Context context) { diff --git a/app/src/main/java/foundation/e/blisslauncher/features/weather/ForecastBuilder.java b/app/src/main/java/foundation/e/blisslauncher/features/weather/ForecastBuilder.java index f0ba009b9d..7b927e29f9 100644 --- a/app/src/main/java/foundation/e/blisslauncher/features/weather/ForecastBuilder.java +++ b/app/src/main/java/foundation/e/blisslauncher/features/weather/ForecastBuilder.java @@ -73,7 +73,7 @@ public class ForecastBuilder { // City TextView textCity = weatherPanel.findViewById(R.id.weather_city); - textCity.setText(Preferences.getCachedCity(context)); + textCity.setText(Preferences.getCachedCity(context, w.getCity())); // Weather Condition TextView weatherCondition = weatherPanel.findViewById(R.id.weather_condition); -- GitLab