mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-11-04 08:43:52 +01:00 
			
		
		
		
	Check for leaky window
This commit is contained in:
		
							parent
							
								
									8b947241b9
								
							
						
					
					
						commit
						9be987cd4c
					
				
					 1 changed files with 15 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -50,11 +50,11 @@ public class LoginActivity extends AccountAuthenticatorActivity {
 | 
			
		|||
    Button signupButton;
 | 
			
		||||
    EditText usernameEdit;
 | 
			
		||||
    EditText passwordEdit;
 | 
			
		||||
    ProgressDialog dialog;
 | 
			
		||||
 | 
			
		||||
    private class LoginTask extends AsyncTask<String, String, String> {
 | 
			
		||||
 | 
			
		||||
        Activity context;
 | 
			
		||||
        ProgressDialog dialog;
 | 
			
		||||
        String username;
 | 
			
		||||
        String password;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -221,6 +221,20 @@ public class LoginActivity extends AccountAuthenticatorActivity {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onDestroy() {
 | 
			
		||||
        try {
 | 
			
		||||
            // To prevent leaked window when finish() is called, see http://stackoverflow.com/questions/32065854/activity-has-leaked-window-at-alertdialog-show-method
 | 
			
		||||
            if (dialog != null && dialog.isShowing()) {
 | 
			
		||||
                dialog.dismiss();
 | 
			
		||||
            }
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
        super.onDestroy();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void performLogin() {
 | 
			
		||||
        String username = usernameEdit.getText().toString();
 | 
			
		||||
        // Because Mediawiki is upercase-first-char-then-case-sensitive :)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue