Browse Source

Minor change in LoginTask

pull/24/head
Ezerous 8 years ago
parent
commit
c63001f05c
  1. 37
      app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java

37
app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java

@ -49,21 +49,11 @@ public class LoginActivity extends BaseActivity {
return; return;
} }
btnLogin.setEnabled(false);
final ProgressDialog progressDialog = new ProgressDialog(LoginActivity.this,
R.style.AppTheme_Dark_Dialog);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Authenticating...");
progressDialog.show();
String username = inputUsername.getText().toString().trim(); String username = inputUsername.getText().toString().trim();
String password = inputPassword.getText().toString().trim(); String password = inputPassword.getText().toString().trim();
// login user
// login user
new LoginTask().execute(username,password); new LoginTask().execute(username,password);
progressDialog.dismiss();
} }
}); });
@ -88,7 +78,9 @@ public class LoginActivity extends BaseActivity {
btnLogin.setEnabled(true); btnLogin.setEnabled(true);
} }
private class LoginTask extends AsyncTask<String, Void, Integer> { private class LoginTask extends AsyncTask<String, Void, Integer>
{
ProgressDialog progressDialog;
@Override @Override
protected Integer doInBackground(String... params) { protected Integer doInBackground(String... params) {
@ -96,6 +88,18 @@ public class LoginActivity extends BaseActivity {
return loginData.getStatus(); return loginData.getStatus();
} }
@Override
protected void onPreExecute() {
btnLogin.setEnabled(false);
progressDialog = new ProgressDialog(LoginActivity.this,
R.style.AppTheme_Dark_Dialog);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Authenticating...");
progressDialog.show();
}
@Override @Override
protected void onPostExecute(Integer result) { protected void onPostExecute(Integer result) {
switch (result) { switch (result) {
@ -135,14 +139,7 @@ public class LoginActivity extends BaseActivity {
break; break;
} }
btnLogin.setEnabled(true); btnLogin.setEnabled(true);
} progressDialog.dismiss();
@Override
protected void onPreExecute() {
}
@Override
protected void onProgressUpdate(Void... values) {
} }
} }

Loading…
Cancel
Save