mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Always reload all accounts after importing one or more accounts
This commit is contained in:
parent
12d87854ac
commit
8240d7ff10
@ -49,36 +49,23 @@ public class Preferences {
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void loadAccounts() {
|
||||
public synchronized void loadAccounts() {
|
||||
accounts = new HashMap<String, Account>();
|
||||
refreshAccounts();
|
||||
}
|
||||
|
||||
public synchronized void refreshAccounts() {
|
||||
Map<String, Account> newAccountMap = new HashMap<String, Account>();
|
||||
accountsInOrder = new LinkedList<Account>();
|
||||
String accountUuids = getPreferences().getString("accountUuids", null);
|
||||
if ((accountUuids != null) && (accountUuids.length() != 0)) {
|
||||
String[] uuids = accountUuids.split(",");
|
||||
for (String uuid : uuids) {
|
||||
Account account = accounts.get(uuid);
|
||||
if (account != null) {
|
||||
newAccountMap.put(uuid, account);
|
||||
accountsInOrder.add(account);
|
||||
} else {
|
||||
Account newAccount = new Account(this, uuid);
|
||||
newAccountMap.put(uuid, newAccount);
|
||||
accountsInOrder.add(newAccount);
|
||||
}
|
||||
Account newAccount = new Account(this, uuid);
|
||||
accounts.put(uuid, newAccount);
|
||||
accountsInOrder.add(newAccount);
|
||||
}
|
||||
}
|
||||
if ((newAccount != null) && newAccount.getAccountNumber() != -1) {
|
||||
newAccountMap.put(newAccount.getUuid(), newAccount);
|
||||
accounts.put(newAccount.getUuid(), newAccount);
|
||||
accountsInOrder.add(newAccount);
|
||||
newAccount = null;
|
||||
}
|
||||
|
||||
accounts = newAccountMap;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,7 +178,7 @@ public class StorageImporter {
|
||||
throw new StorageImportExportException("Couldn't save imported settings");
|
||||
}
|
||||
|
||||
preferences.refreshAccounts();
|
||||
preferences.loadAccounts();
|
||||
DateFormatter.clearChosenFormat();
|
||||
K9.loadPrefs(preferences);
|
||||
K9.setServicesEnabled(context);
|
||||
|
Loading…
Reference in New Issue
Block a user