Dialog
General definitions
Dialog d;
ProgressDialog progressDialog;
public void createLoginDialog() {
d = new Dialog(this);
d.setContentView(R.layout.login_dialog);
d.setTitle("Login");
d.setCancelable(true);
etEmail = (EditText) d.findViewById(R.id.etEmail);
etPass = (EditText) d.findViewById(R.id.etPass);
btnLogin = (Button) d.findViewById(R.id.btnLogin);
btnLogin.setOnClickListener(this);
d.show();
}
public void login() {
progressDialog.setMessage("Login Please Wait...");
progressDialog.show();
firebaseAuth.signInWithEmailAndPassword(etEmail.getText().toString(), etPass.getText().toString())
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(Task<AuthResult> task) {
if (task.isSuccessful()) {
Toast.makeText(MainActivity.this, "auth_success", Toast.LENGTH_SHORT).show();
loginBTN.setText("התנתק");
} else {
Toast.makeText(MainActivity.this, "auth_failed", Toast.LENGTH_SHORT).show();
}
d.dismiss();
progressDialog.dismiss();
}
});
}