Fix some LGTM issues

This commit is contained in:
cpfeiffer 2019-09-19 23:18:17 +02:00
parent 235c3fb599
commit 17f24c06f8
7 changed files with 10 additions and 10 deletions

View File

@ -632,8 +632,9 @@ public class GBApplication extends Application {
DaoSession daoSession = db.getDaoSession(); DaoSession daoSession = db.getDaoSession();
List<Device> activeDevices = DBHelper.getActiveDevices(daoSession); List<Device> activeDevices = DBHelper.getActiveDevices(daoSession);
for (Device dbDevice : activeDevices) { for (Device dbDevice : activeDevices) {
SharedPreferences.Editor deviceSharedPrefsEdit = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier()).edit(); SharedPreferences deviceSpecificSharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier());
if (sharedPrefs != null) { if (deviceSpecificSharedPrefs != null) {
SharedPreferences.Editor deviceSharedPrefsEdit = deviceSpecificSharedPrefs.edit();
String preferenceKey = dbDevice.getIdentifier() + "_lastSportsActivityTimeMillis"; String preferenceKey = dbDevice.getIdentifier() + "_lastSportsActivityTimeMillis";
long lastSportsActivityTimeMillis = sharedPrefs.getLong(preferenceKey, 0); long lastSportsActivityTimeMillis = sharedPrefs.getLong(preferenceKey, 0);
if (lastSportsActivityTimeMillis != 0) { if (lastSportsActivityTimeMillis != 0) {
@ -708,9 +709,8 @@ public class GBApplication extends Application {
if (newLanguage != null) { if (newLanguage != null) {
deviceSharedPrefsEdit.putString("language", newLanguage); deviceSharedPrefsEdit.putString("language", newLanguage);
} }
deviceSharedPrefsEdit.apply();
} }
deviceSharedPrefsEdit.apply();
} }
editor.remove("amazfitbip_language"); editor.remove("amazfitbip_language");
editor.remove("bip_display_items"); editor.remove("bip_display_items");

View File

@ -109,7 +109,7 @@ public class DbManagementActivity extends AbstractGBActivity {
Prefs prefs = GBApplication.getPrefs(); Prefs prefs = GBApplication.getPrefs();
boolean autoExportEnabled = prefs.getBoolean(GBPrefs.AUTO_EXPORT_ENABLED, false); 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://... //returns an ugly content://...
//String autoExportLocation = prefs.getString(GBPrefs.AUTO_EXPORT_LOCATION, ""); //String autoExportLocation = prefs.getString(GBPrefs.AUTO_EXPORT_LOCATION, "");

View File

@ -105,7 +105,7 @@ class AppMessageHandlerM7S extends AppMessageHandler {
return HAIL; return HAIL;
} else if (conditionCode >= 907 && conditionCode < 957) { } else if (conditionCode >= 907 && conditionCode < 957) {
return WIND; return WIND;
} else if (conditionCode == 905 || (conditionCode >= 957 && conditionCode < 900)) { } else if (conditionCode == 905) {
return EXTREME_WIND; return EXTREME_WIND;
} else if (conditionCode == 900) { } else if (conditionCode == 900) {
return TORNADO; return TORNADO;

View File

@ -99,7 +99,7 @@ class AppMessageHandlerRealWeather extends AppMessageHandler {
return CLOUD; return CLOUD;
} else if (conditionCode >= 907 && conditionCode < 957) { } else if (conditionCode >= 907 && conditionCode < 957) {
return STORM; return STORM;
} else if (conditionCode == 905 || (conditionCode >= 957 && conditionCode < 900)) { } else if (conditionCode == 905) {
return STORM; return STORM;
} else if (conditionCode == 900) { } else if (conditionCode == 900) {
return STORM; return STORM;

View File

@ -88,7 +88,7 @@ private int getConditionForConditionCode(int conditionCode) {
return HAIL; return HAIL;
} else if (conditionCode >= 907 && conditionCode < 957) { } else if (conditionCode >= 907 && conditionCode < 957) {
return WIND; return WIND;
} else if (conditionCode == 905 || (conditionCode >= 957 && conditionCode < 900)) { } else if (conditionCode == 905) {
return EXTREME_WIND; return EXTREME_WIND;
} else if (conditionCode == 900) { } else if (conditionCode == 900) {
return TORNADO; return TORNADO;

View File

@ -130,7 +130,7 @@ class AppMessageHandlerYWeather extends AppMessageHandler {
return SLEET; return SLEET;
} else if (conditionCode >= 907 && conditionCode < 957) { } else if (conditionCode >= 907 && conditionCode < 957) {
return STORM; return STORM;
} else if (conditionCode == 905 || (conditionCode >= 957 && conditionCode < 900)) { } else if (conditionCode == 905) {
return STORM; return STORM;
} else if (conditionCode == 900) { } else if (conditionCode == 900) {
return STORM; return STORM;

View File

@ -2136,7 +2136,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport {
ZeTimeConstants.CMD_END ZeTimeConstants.CMD_END
}; };
if (language.equals("default") || (language == null)) { if (language == null || language.equals("default")) {
locale = Locale.getDefault(); locale = Locale.getDefault();
language = locale.getLanguage(); language = locale.getLanguage();
} }