Remove partially constructed accounts on resume

Resuming account setup activity when the account has been partially
constructed (the setup has not been finished) resulted in having unsaved
account with ID = -1 in the accounts list. The application would then on
resume proceed to messages list but there won't be any folders as the
setup has been aborted.

The fix clears the list of accounts on resume and create so that the
application properly reacts to the event of no setup accounts.

Fixes #3717.
This commit is contained in:
Wiktor Kwapisiewicz 2018-11-20 14:57:18 +01:00
parent f168985b0b
commit 54d71ac54a
No known key found for this signature in database
GPG key ID: B97A1EE09DB417EC

View file

@ -373,7 +373,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
createSpecialAccounts();
}
List<Account> accounts = Preferences.getPreferences(this).getAccounts();
Preferences preferences = Preferences.getPreferences(this);
preferences.loadAccounts();
List<Account> accounts = preferences.getAccounts();
Intent intent = getIntent();
//onNewIntent(intent);
@ -538,8 +540,10 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
private void refresh() {
Preferences preferences = Preferences.getPreferences(this);
preferences.loadAccounts();
accounts.clear();
accounts.addAll(Preferences.getPreferences(this).getAccounts());
accounts.addAll(preferences.getAccounts());
// see if we should show the welcome message
// if (accounts.length < 1) {