diff options
Diffstat (limited to 'src/cgeo/geocaching/cgSettings.java')
| -rw-r--r-- | src/cgeo/geocaching/cgSettings.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cgeo/geocaching/cgSettings.java b/src/cgeo/geocaching/cgSettings.java index 57cdf51..404248c 100644 --- a/src/cgeo/geocaching/cgSettings.java +++ b/src/cgeo/geocaching/cgSettings.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; +import org.apache.commons.lang3.StringUtils; import org.mapsforge.android.maps.MapDatabase; import android.content.Context; @@ -16,6 +17,7 @@ import android.util.Log; import cgeo.geocaching.googlemaps.googleMapFactory; import cgeo.geocaching.mapinterfaces.MapFactory; import cgeo.geocaching.mapsforge.mfMapFactory; +import cgeo.geocaching.utils.CollectionUtils; /** * General c:geo preferences/settings set by the user @@ -272,7 +274,7 @@ public class cgSettings { final String preUsername = prefs.getString(KEY_USERNAME, null); final String prePassword = prefs.getString(KEY_PASSWORD, null); - if (preUsername == null || prePassword == null || preUsername.length() == 0 || prePassword.length() == 0) { + if (StringUtils.isBlank(preUsername) || StringUtils.isBlank(prePassword)) { return false; } else { return true; @@ -329,7 +331,7 @@ public class cgSettings { @Override public void edit(Editor edit) { - if (username == null || username.length() == 0 || password == null || password.length() == 0) { + if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) { // erase username and password edit.remove(KEY_USERNAME); edit.remove(KEY_PASSWORD); @@ -346,7 +348,7 @@ public class cgSettings { final String preUsername = prefs.getString(KEY_USERNAME, null); final String prePassword = prefs.getString(KEY_GCVOTE_PASSWORD, null); - if (preUsername == null || prePassword == null || preUsername.length() == 0 || prePassword.length() == 0) { + if (StringUtils.isBlank(preUsername) || StringUtils.isBlank(prePassword)) { return false; } else { return true; @@ -358,7 +360,7 @@ public class cgSettings { @Override public void edit(Editor edit) { - if (password == null || password.length() == 0) { + if (StringUtils.isBlank(password)) { // erase password edit.remove(KEY_GCVOTE_PASSWORD); } else { @@ -397,7 +399,7 @@ public class cgSettings { @Override public void edit(Editor edit) { - if (signature == null || signature.length() == 0) { + if (StringUtils.isBlank(signature)) { // erase signature edit.remove(KEY_SIGNATURE); } else { @@ -431,7 +433,7 @@ public class cgSettings { // delete cookies Map<String, ?> prefsValues = prefs.getAll(); - if (prefsValues != null && prefsValues.size() > 0) { + if (CollectionUtils.isNotEmpty(prefsValues)) { Log.i(cgSettings.tag, "Removing cookies"); for (String key : prefsValues.keySet()) { |
