Skip to content

Instantly share code, notes, and snippets.

@azzeddineCH
Created July 16, 2017 21:13
Show Gist options
  • Save azzeddineCH/219588d688d38926c3a014c3b1124e27 to your computer and use it in GitHub Desktop.
Save azzeddineCH/219588d688d38926c3a014c3b1124e27 to your computer and use it in GitHub Desktop.
/**
* a public method to handel the user sign in event from the auth fragment
*
* @param email a string holds the user email address
* @param password a string holds the user text password
* @param view a view holds the auth widgets to hide
*/
public void handleSignIn(String email, String password, final View view){
showProgress(true,view);
FirebaseUtils.auth.signInWithEmailAndPassword(email, password).addOnCompleteListener(
new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
startChatActivity();
}else{
// displaying an error message toast
Toast.makeText(LauncherActivity.this, task.getException().getMessage(), Toast.LENGTH_SHORT).show();
showProgress(false,view);
}
}
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment