Skip to content

Instantly share code, notes, and snippets.

@azzeddineCH
Created July 16, 2017 21:14
Show Gist options
  • Save azzeddineCH/a21deb91a176ac334102fc9b17c26dbc to your computer and use it in GitHub Desktop.
Save azzeddineCH/a21deb91a176ac334102fc9b17c26dbc to your computer and use it in GitHub Desktop.
/**
* a public method to handel the user sign up 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 handleSignUp(String email, String password, final View view){
showProgress(true,view);
FirebaseUtils.auth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(
new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
Intent intent =new Intent(LauncherActivity.this,initProfileActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}else{
showProgress(false,view);
Toast.makeText(LauncherActivity.this, task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment