mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Merge pull request #1299 from knight-shade/Fixes-#1294
Fixes #1294 Orientation change cancels the ongoing login process.
This commit is contained in:
commit
e412c9a0aa
1 changed files with 20 additions and 0 deletions
|
|
@ -84,6 +84,9 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
private AppCompatDelegate delegate;
|
||||
private LoginTextWatcher textWatcher = new LoginTextWatcher();
|
||||
|
||||
private Boolean loginCurrentlyInProgress = false;
|
||||
private static final String LOGING_IN = "logingIn";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(Utils.isDarkTheme(this) ? R.style.DarkAppTheme : R.style.LightAppTheme);
|
||||
|
|
@ -180,6 +183,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
}
|
||||
|
||||
private void performLogin() {
|
||||
loginCurrentlyInProgress = true;
|
||||
Timber.d("Login to start!");
|
||||
final String username = canonicializeUsername(usernameEdit.getText().toString());
|
||||
final String password = passwordEdit.getText().toString();
|
||||
|
|
@ -210,6 +214,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
if (result.equals("PASS")) {
|
||||
handlePassResult(username, password);
|
||||
} else {
|
||||
loginCurrentlyInProgress = false;
|
||||
handleOtherResults(result);
|
||||
}
|
||||
}
|
||||
|
|
@ -332,6 +337,21 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
return getDelegate().getMenuInflater();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(LOGING_IN, loginCurrentlyInProgress);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
loginCurrentlyInProgress = savedInstanceState.getBoolean(LOGING_IN, false);
|
||||
if(loginCurrentlyInProgress){
|
||||
performLogin();
|
||||
}
|
||||
}
|
||||
|
||||
public void askUserForTwoFactorAuth() {
|
||||
progressDialog.dismiss();
|
||||
twoFactorContainer.setVisibility(VISIBLE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue