Merge "Fix some save/restore state bugs in setup flow" into ub-mail-master

This commit is contained in:
Tony Mantler 2014-03-07 18:52:24 +00:00 committed by Android (Google) Code Review
commit 094656be6e
3 changed files with 26 additions and 4 deletions

View File

@ -139,10 +139,14 @@ public class AccountSetupCredentialsFragment extends AccountSetupFragment
@Override
public void onDestroy() {
super.onDestroy();
mImapPasswordText.removeTextChangedListener(mValidationTextWatcher);
mImapPasswordText = null;
mRegularPasswordText.removeTextChangedListener(mValidationTextWatcher);
mRegularPasswordText = null;
if (mImapPasswordText != null) {
mImapPasswordText.removeTextChangedListener(mValidationTextWatcher);
mImapPasswordText = null;
}
if (mRegularPasswordText != null) {
mRegularPasswordText.removeTextChangedListener(mValidationTextWatcher);
mRegularPasswordText = null;
}
}
public void validatePassword() {

View File

@ -210,6 +210,8 @@ public class AccountSetupFinal extends AccountSetupActivity
mIsPreConfiguredProvider =
savedInstanceState.getBoolean(SAVESTATE_KEY_IS_PRE_CONFIGURED);
mSkipAutoDiscover = savedInstanceState.getBoolean(SAVESTATE_KEY_SKIP_AUTO_DISCOVER);
// I don't know why this view state doesn't get restored
updateHeadline();
} else {
// If we're not restoring from a previous state, we want to configure the initial screen

View File

@ -17,6 +17,7 @@
package com.android.email.activity.setup;
import android.app.Fragment;
import android.os.Bundle;
/**
* Superclass for setup UI fragments.
@ -24,12 +25,27 @@ import android.app.Fragment;
* we can unwind things correctly when the user navigates the back stack.
*/
public class AccountSetupFragment extends Fragment {
private static final String SAVESTATE_STATE = "AccountSetupFragment.state";
private int mState;
public interface Callback {
void setNextButtonEnabled(boolean enabled);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
mState = savedInstanceState.getInt(SAVESTATE_STATE);
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(SAVESTATE_STATE, mState);
}
public void setState(int state) {
mState = state;
}