mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Fixes orientation change canceling the ongoing login process.
Fixes #1294
This commit is contained in:
		
							parent
							
								
									f03407c35f
								
							
						
					
					
						commit
						57a2ce20cd
					
				
					 1 changed files with 20 additions and 0 deletions
				
			
		|  | @ -83,6 +83,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); | ||||
|  | @ -175,6 +178,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(); | ||||
|  | @ -205,6 +209,7 @@ public class LoginActivity extends AccountAuthenticatorActivity { | |||
|         if (result.equals("PASS")) { | ||||
|             handlePassResult(username, password); | ||||
|         } else { | ||||
|             loginCurrentlyInProgress = false; | ||||
|             handleOtherResults(result); | ||||
|         } | ||||
|     } | ||||
|  | @ -327,6 +332,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
	
	 knightshade
						knightshade