mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-11 13:49:15 -05:00
Properly save and restore instance state in AccountSetupBasics
This commit is contained in:
parent
a4440b4042
commit
48d11fd386
@ -37,7 +37,9 @@ public class AccountSetupBasics extends K9Activity
|
|||||||
private final static String EXTRA_ACCOUNT = "com.fsck.k9.AccountSetupBasics.account";
|
private final static String EXTRA_ACCOUNT = "com.fsck.k9.AccountSetupBasics.account";
|
||||||
private final static int DIALOG_NOTE = 1;
|
private final static int DIALOG_NOTE = 1;
|
||||||
private final static String STATE_KEY_PROVIDER =
|
private final static String STATE_KEY_PROVIDER =
|
||||||
"com.fsck.k9.AccountSetupBasics.provider";
|
"com.fsck.k9.AccountSetupBasics.provider";
|
||||||
|
private final static String STATE_KEY_CHECKED_INCOMING =
|
||||||
|
"com.fsck.k9.AccountSetupBasics.checkedIncoming";
|
||||||
|
|
||||||
private EditText mEmailView;
|
private EditText mEmailView;
|
||||||
private EditText mPasswordView;
|
private EditText mPasswordView;
|
||||||
@ -68,15 +70,6 @@ public class AccountSetupBasics extends K9Activity
|
|||||||
|
|
||||||
mEmailView.addTextChangedListener(this);
|
mEmailView.addTextChangedListener(this);
|
||||||
mPasswordView.addTextChangedListener(this);
|
mPasswordView.addTextChangedListener(this);
|
||||||
|
|
||||||
if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_ACCOUNT)) {
|
|
||||||
String accountUuid = savedInstanceState.getString(EXTRA_ACCOUNT);
|
|
||||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (savedInstanceState != null && savedInstanceState.containsKey(STATE_KEY_PROVIDER)) {
|
|
||||||
mProvider = (Provider)savedInstanceState.getSerializable(STATE_KEY_PROVIDER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -94,6 +87,23 @@ public class AccountSetupBasics extends K9Activity
|
|||||||
if (mProvider != null) {
|
if (mProvider != null) {
|
||||||
outState.putSerializable(STATE_KEY_PROVIDER, mProvider);
|
outState.putSerializable(STATE_KEY_PROVIDER, mProvider);
|
||||||
}
|
}
|
||||||
|
outState.putBoolean(STATE_KEY_CHECKED_INCOMING, mCheckedIncoming);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||||
|
super.onRestoreInstanceState(savedInstanceState);
|
||||||
|
|
||||||
|
if (savedInstanceState.containsKey(EXTRA_ACCOUNT)) {
|
||||||
|
String accountUuid = savedInstanceState.getString(EXTRA_ACCOUNT);
|
||||||
|
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (savedInstanceState.containsKey(STATE_KEY_PROVIDER)) {
|
||||||
|
mProvider = (Provider) savedInstanceState.getSerializable(STATE_KEY_PROVIDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
mCheckedIncoming = savedInstanceState.getBoolean(STATE_KEY_CHECKED_INCOMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
|
Loading…
Reference in New Issue
Block a user