diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java index 8c3e8dfff..6119391a2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java @@ -632,8 +632,9 @@ public class GBApplication extends Application { DaoSession daoSession = db.getDaoSession(); List activeDevices = DBHelper.getActiveDevices(daoSession); for (Device dbDevice : activeDevices) { - SharedPreferences.Editor deviceSharedPrefsEdit = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier()).edit(); - if (sharedPrefs != null) { + SharedPreferences deviceSpecificSharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier()); + if (deviceSpecificSharedPrefs != null) { + SharedPreferences.Editor deviceSharedPrefsEdit = deviceSpecificSharedPrefs.edit(); String preferenceKey = dbDevice.getIdentifier() + "_lastSportsActivityTimeMillis"; long lastSportsActivityTimeMillis = sharedPrefs.getLong(preferenceKey, 0); if (lastSportsActivityTimeMillis != 0) { @@ -708,9 +709,8 @@ public class GBApplication extends Application { if (newLanguage != null) { deviceSharedPrefsEdit.putString("language", newLanguage); } + deviceSharedPrefsEdit.apply(); } - - deviceSharedPrefsEdit.apply(); } editor.remove("amazfitbip_language"); editor.remove("bip_display_items"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DbManagementActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DbManagementActivity.java index b92e2bff8..2f404d3ba 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DbManagementActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DbManagementActivity.java @@ -109,7 +109,7 @@ public class DbManagementActivity extends AbstractGBActivity { Prefs prefs = GBApplication.getPrefs(); boolean autoExportEnabled = prefs.getBoolean(GBPrefs.AUTO_EXPORT_ENABLED, false); - Integer autoExportInterval = prefs.getInt(GBPrefs.AUTO_EXPORT_INTERVAL, 0); + int autoExportInterval = prefs.getInt(GBPrefs.AUTO_EXPORT_INTERVAL, 0); //returns an ugly content://... //String autoExportLocation = prefs.getString(GBPrefs.AUTO_EXPORT_LOCATION, ""); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerM7S.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerM7S.java index 84a0ecad0..d0e5e2f97 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerM7S.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerM7S.java @@ -105,7 +105,7 @@ class AppMessageHandlerM7S extends AppMessageHandler { return HAIL; } else if (conditionCode >= 907 && conditionCode < 957) { return WIND; - } else if (conditionCode == 905 || (conditionCode >= 957 && conditionCode < 900)) { + } else if (conditionCode == 905) { return EXTREME_WIND; } else if (conditionCode == 900) { return TORNADO; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerRealWeather.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerRealWeather.java index c9f0d93f1..09c332adb 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerRealWeather.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerRealWeather.java @@ -99,7 +99,7 @@ class AppMessageHandlerRealWeather extends AppMessageHandler { return CLOUD; } else if (conditionCode >= 907 && conditionCode < 957) { return STORM; - } else if (conditionCode == 905 || (conditionCode >= 957 && conditionCode < 900)) { + } else if (conditionCode == 905) { return STORM; } else if (conditionCode == 900) { return STORM; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerSimplyLight.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerSimplyLight.java index f4ff39ca4..77ca74b76 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerSimplyLight.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerSimplyLight.java @@ -88,7 +88,7 @@ private int getConditionForConditionCode(int conditionCode) { return HAIL; } else if (conditionCode >= 907 && conditionCode < 957) { return WIND; - } else if (conditionCode == 905 || (conditionCode >= 957 && conditionCode < 900)) { + } else if (conditionCode == 905) { return EXTREME_WIND; } else if (conditionCode == 900) { return TORNADO; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerYWeather.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerYWeather.java index ada75871e..21d0ecbbd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerYWeather.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerYWeather.java @@ -130,7 +130,7 @@ class AppMessageHandlerYWeather extends AppMessageHandler { return SLEET; } else if (conditionCode >= 907 && conditionCode < 957) { return STORM; - } else if (conditionCode == 905 || (conditionCode >= 957 && conditionCode < 900)) { + } else if (conditionCode == 905) { return STORM; } else if (conditionCode == 900) { return STORM; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java index c516c8389..6432bb9f7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java @@ -2136,7 +2136,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { ZeTimeConstants.CMD_END }; - if (language.equals("default") || (language == null)) { + if (language == null || language.equals("default")) { locale = Locale.getDefault(); language = locale.getLanguage(); }