Skip to content

Commit

Permalink
Remoção do ProgressDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbmarcio committed Nov 20, 2017
1 parent ad6732a commit 8f8dece
Showing 1 changed file with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
public class MainActivity extends AppCompatActivity {
EditText editMail, editSenha;
String mail, senha;
ProgressDialog progressDialog;
FirebaseAuth firebaseAuth;

@Override
Expand All @@ -28,8 +27,6 @@ protected void onCreate(Bundle savedInstanceState) {

editMail = findViewById(R.id.editMail);
editSenha = findViewById(R.id.editSenha);

progressDialog = new ProgressDialog(this);
}

public void entrar(View view){
Expand All @@ -46,22 +43,17 @@ public void entrar(View view){
return;
}

progressDialog.setMessage("Entrando...");
progressDialog.show();

firebaseAuth = FirebaseAuth.getInstance();

firebaseAuth.signInWithEmailAndPassword(mail, senha)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
progressDialog.dismiss();
finish();
startActivity(new Intent(getApplicationContext(), Dashboard.class));
} else {
Toast.makeText(MainActivity.this, "Usuário/senha inválidos.", Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
}
}
});
Expand Down

0 comments on commit 8f8dece

Please sign in to comment.