Created
July 16, 2017 21:14
-
-
Save azzeddineCH/a21deb91a176ac334102fc9b17c26dbc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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