Merge pull request #1053 from owncloud/pincode_request_is_not_starting_when_rotating

Fixed: pass code request not restarted anymore when the device is rotated
This commit is contained in:
David A. Velasco 2015-07-20 11:18:15 +02:00
commit 2c3d44f47e

View file

@ -61,7 +61,9 @@ public class PassCodeActivity extends ActionBarActivity {
private EditText[] mPassCodeEditTexts = new EditText[4];
private String [] mPassCodeDigits = {"","","",""};
private static String KEY_PASSCODE_DIGITS = "PASSCODE_DIGITS";
private boolean mConfirmingPassCode = false;
private static String KEY_CONFIRMING_PASSCODE = "CONFIRMING_PASSCODE";
private boolean mBChange = true; // to control that only one blocks jump
@ -96,13 +98,22 @@ public class PassCodeActivity extends ActionBarActivity {
setCancelButtonEnabled(false); // no option to cancel
} else if (ACTION_ENABLE.equals(getIntent().getAction())) {
/// pass code preference has just been activated in Preferences;
// will receive and confirm pass code value
mPassCodeHdr.setText(R.string.pass_code_configure_your_pass_code);
//mPassCodeHdr.setText(R.string.pass_code_enter_pass_code);
// TODO choose a header, check iOS
mPassCodeHdrExplanation.setVisibility(View.VISIBLE);
setCancelButtonEnabled(true);
if (savedInstanceState != null) {
mConfirmingPassCode = savedInstanceState.getBoolean(PassCodeActivity.KEY_CONFIRMING_PASSCODE);
mPassCodeDigits = savedInstanceState.getStringArray(PassCodeActivity.KEY_PASSCODE_DIGITS);
}
if(mConfirmingPassCode){
//the app was in the passcodeconfirmation
requestPassCodeConfirmation();
}else{
/// pass code preference has just been activated in Preferences;
// will receive and confirm pass code value
mPassCodeHdr.setText(R.string.pass_code_configure_your_pass_code);
//mPassCodeHdr.setText(R.string.pass_code_enter_pass_code);
// TODO choose a header, check iOS
mPassCodeHdrExplanation.setVisibility(View.VISIBLE);
setCancelButtonEnabled(true);
}
} else if (ACTION_DISABLE.equals(getIntent().getAction())) {
/// pass code preference has just been disabled in Preferences;
@ -455,6 +466,13 @@ public class PassCodeActivity extends ActionBarActivity {
finish();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(PassCodeActivity.KEY_CONFIRMING_PASSCODE, mConfirmingPassCode);
outState.putStringArray(PassCodeActivity.KEY_PASSCODE_DIGITS, mPassCodeDigits);
}
private class PassCodeDigitTextWatcher implements TextWatcher {