mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Error messages in LoginActivity persist after orientation change. (#1407)
This commit is contained in:
parent
3c2cc26d3b
commit
0223c5ab76
1 changed files with 16 additions and 1 deletions
|
|
@ -84,6 +84,10 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
||||||
private LoginTextWatcher textWatcher = new LoginTextWatcher();
|
private LoginTextWatcher textWatcher = new LoginTextWatcher();
|
||||||
|
|
||||||
private Boolean loginCurrentlyInProgress = false;
|
private Boolean loginCurrentlyInProgress = false;
|
||||||
|
private Boolean errorMessageShown = false;
|
||||||
|
private String resultantError;
|
||||||
|
private static final String RESULTANT_ERROR = "resultantError";
|
||||||
|
private static final String ERROR_MESSAGE_SHOWN = "errorMessageShown";
|
||||||
private static final String LOGING_IN = "logingIn";
|
private static final String LOGING_IN = "logingIn";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -217,6 +221,8 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
||||||
handlePassResult(username, password);
|
handlePassResult(username, password);
|
||||||
} else {
|
} else {
|
||||||
loginCurrentlyInProgress = false;
|
loginCurrentlyInProgress = false;
|
||||||
|
errorMessageShown = true;
|
||||||
|
resultantError = result;
|
||||||
handleOtherResults(result);
|
handleOtherResults(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -343,15 +349,22 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
outState.putBoolean(LOGING_IN, loginCurrentlyInProgress);
|
outState.putBoolean(LOGING_IN, loginCurrentlyInProgress);
|
||||||
|
outState.putBoolean(ERROR_MESSAGE_SHOWN, errorMessageShown);
|
||||||
|
outState.putString(RESULTANT_ERROR, resultantError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||||
super.onRestoreInstanceState(savedInstanceState);
|
super.onRestoreInstanceState(savedInstanceState);
|
||||||
loginCurrentlyInProgress = savedInstanceState.getBoolean(LOGING_IN, false);
|
loginCurrentlyInProgress = savedInstanceState.getBoolean(LOGING_IN, false);
|
||||||
|
errorMessageShown = savedInstanceState.getBoolean(ERROR_MESSAGE_SHOWN, false);
|
||||||
if(loginCurrentlyInProgress){
|
if(loginCurrentlyInProgress){
|
||||||
performLogin();
|
performLogin();
|
||||||
}
|
}
|
||||||
|
if(errorMessageShown){
|
||||||
|
resultantError = savedInstanceState.getString(RESULTANT_ERROR);
|
||||||
|
handleOtherResults(resultantError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void askUserForTwoFactorAuth() {
|
public void askUserForTwoFactorAuth() {
|
||||||
|
|
@ -363,7 +376,9 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
||||||
|
|
||||||
public void showMessageAndCancelDialog(@StringRes int resId) {
|
public void showMessageAndCancelDialog(@StringRes int resId) {
|
||||||
showMessage(resId, R.color.secondaryDarkColor);
|
showMessage(resId, R.color.secondaryDarkColor);
|
||||||
progressDialog.cancel();
|
if(progressDialog != null){
|
||||||
|
progressDialog.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showSuccessAndDismissDialog() {
|
public void showSuccessAndDismissDialog() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue