mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -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>();
|
accounts = new HashMap<String, Account>();
|
||||||
refreshAccounts();
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void refreshAccounts() {
|
|
||||||
Map<String, Account> newAccountMap = new HashMap<String, Account>();
|
|
||||||
accountsInOrder = new LinkedList<Account>();
|
accountsInOrder = new LinkedList<Account>();
|
||||||
String accountUuids = getPreferences().getString("accountUuids", null);
|
String accountUuids = getPreferences().getString("accountUuids", null);
|
||||||
if ((accountUuids != null) && (accountUuids.length() != 0)) {
|
if ((accountUuids != null) && (accountUuids.length() != 0)) {
|
||||||
String[] uuids = accountUuids.split(",");
|
String[] uuids = accountUuids.split(",");
|
||||||
for (String uuid : uuids) {
|
for (String uuid : uuids) {
|
||||||
Account account = accounts.get(uuid);
|
Account newAccount = new Account(this, uuid);
|
||||||
if (account != null) {
|
accounts.put(uuid, newAccount);
|
||||||
newAccountMap.put(uuid, account);
|
accountsInOrder.add(newAccount);
|
||||||
accountsInOrder.add(account);
|
|
||||||
} else {
|
|
||||||
Account newAccount = new Account(this, uuid);
|
|
||||||
newAccountMap.put(uuid, newAccount);
|
|
||||||
accountsInOrder.add(newAccount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((newAccount != null) && newAccount.getAccountNumber() != -1) {
|
if ((newAccount != null) && newAccount.getAccountNumber() != -1) {
|
||||||
newAccountMap.put(newAccount.getUuid(), newAccount);
|
accounts.put(newAccount.getUuid(), newAccount);
|
||||||
accountsInOrder.add(newAccount);
|
accountsInOrder.add(newAccount);
|
||||||
newAccount = null;
|
newAccount = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
accounts = newAccountMap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,7 +178,7 @@ public class StorageImporter {
|
|||||||
throw new StorageImportExportException("Couldn't save imported settings");
|
throw new StorageImportExportException("Couldn't save imported settings");
|
||||||
}
|
}
|
||||||
|
|
||||||
preferences.refreshAccounts();
|
preferences.loadAccounts();
|
||||||
DateFormatter.clearChosenFormat();
|
DateFormatter.clearChosenFormat();
|
||||||
K9.loadPrefs(preferences);
|
K9.loadPrefs(preferences);
|
||||||
K9.setServicesEnabled(context);
|
K9.setServicesEnabled(context);
|
||||||
|
Loading…
Reference in New Issue
Block a user