mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +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;
|
Button signupButton;
|
||||||
EditText usernameEdit;
|
EditText usernameEdit;
|
||||||
EditText passwordEdit;
|
EditText passwordEdit;
|
||||||
|
ProgressDialog dialog;
|
||||||
|
|
||||||
private class LoginTask extends AsyncTask<String, String, String> {
|
private class LoginTask extends AsyncTask<String, String, String> {
|
||||||
|
|
||||||
Activity context;
|
Activity context;
|
||||||
ProgressDialog dialog;
|
|
||||||
String username;
|
String username;
|
||||||
String password;
|
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() {
|
private void performLogin() {
|
||||||
String username = usernameEdit.getText().toString();
|
String username = usernameEdit.getText().toString();
|
||||||
// Because Mediawiki is upercase-first-char-then-case-sensitive :)
|
// Because Mediawiki is upercase-first-char-then-case-sensitive :)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue