1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -05:00

Merge pull request #92 from andrewgaul/remove-combine-uuids

Prefer Utility.combine over Account.combinedUuids
This commit is contained in:
Andrew Chen 2011-11-03 06:41:33 -07:00
commit 981dc6cca6

View File

@ -379,18 +379,6 @@ public class Account implements BaseAccount {
mCryptoAutoSignature = prefs.getBoolean(mUuid + ".cryptoAutoSignature", false); mCryptoAutoSignature = prefs.getBoolean(mUuid + ".cryptoAutoSignature", false);
} }
private String combineUuids(String[] uuids) {
StringBuilder sb = new StringBuilder();
for (int i = 0, length = uuids.length; i < length; i++) {
if (sb.length() > 0) {
sb.append(',');
}
sb.append(uuids[i]);
}
String accountUuids = sb.toString();
return accountUuids;
}
protected synchronized void delete(Preferences preferences) { protected synchronized void delete(Preferences preferences) {
String[] uuids = preferences.getPreferences().getString("accountUuids", "").split(","); String[] uuids = preferences.getPreferences().getString("accountUuids", "").split(",");
String[] newUuids = new String[uuids.length - 1]; String[] newUuids = new String[uuids.length - 1];
@ -401,7 +389,7 @@ public class Account implements BaseAccount {
} }
} }
String accountUuids = combineUuids(newUuids); String accountUuids = Utility.combine(newUuids, ',');
SharedPreferences.Editor editor = preferences.getPreferences().edit(); SharedPreferences.Editor editor = preferences.getPreferences().edit();
editor.putString("accountUuids", accountUuids); editor.putString("accountUuids", accountUuids);
@ -519,7 +507,7 @@ public class Account implements BaseAccount {
} }
} }
} }
String accountUuids = combineUuids(newUuids); String accountUuids = Utility.combine(newUuids, ',');
editor.putString("accountUuids", accountUuids); editor.putString("accountUuids", accountUuids);
editor.commit(); editor.commit();
preferences.refreshAccounts(); preferences.refreshAccounts();