Permalink
Browse files

Trim whitespace for unique id

  • Loading branch information...
1 parent 5d2a9d9 commit c1b4e1de6cebb4c57dd96933adcec4032d276fe2 @eyedol eyedol committed Jun 23, 2014
Showing with 10 additions and 5 deletions.
  1. +10 −5 smssync/src/main/java/org/addhen/smssync/Settings.java
@@ -18,6 +18,7 @@
package org.addhen.smssync;
+import org.addhen.smssync.util.Logger;
import org.addhen.smssync.util.RunServicesUtil;
import org.addhen.smssync.util.TimePreference;
import org.addhen.smssync.util.Util;
@@ -298,12 +299,16 @@ protected void savePreferences() {
Prefs.taskCheckTime, taskCheckTimes.getTimeValueAsString()));
}
- String id = uniqueId.getText().toString().trim();
- editor.putString("UniqueId", id);
- if(!Prefs.uniqueId.equals(uniqueId.getText().toString())) {
- Util.logActivities(this, getString(R.string.settings_changed, uniqueId.getTitle().toString(),
- Prefs.uniqueId, id));
+ if (!TextUtils.isEmpty(uniqueId.getText())) {
+ String id = Util.removeWhitespaces(uniqueId.getText().toString());
+ editor.putString("UniqueId", id);
+ if(!Prefs.uniqueId.equals(uniqueId.getText().toString())) {
+ Util.logActivities(this,
+ getString(R.string.settings_changed, uniqueId.getTitle().toString(),
+ Prefs.uniqueId, id));
+ }
}
+
editor.commit();
}

0 comments on commit c1b4e1d

Please sign in to comment.