FirebaseAuth auth = FirebaseAuth.getInstance(); if (auth.getCurrentUser() != null) { startActivity(SignedInActivity.createIntent(this, null)); finish(); }
@OnClick(R.id.sign_in) public void signIn(View view) { startActivityForResult( AuthUI.getInstance().createSignInIntentBuilder() .setTheme(getSelectedTheme()) .setLogo(getSelectedLogo()) .setProviders(getSelectedProviders()) .setTosUrl(getSelectedTosUrl()) .setIsSmartLockEnabled(mEnableSmartLock.isChecked()) .build(), RC_SIGN_IN); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RC_SIGN_IN) { handleSignInResponse(resultCode, data); return; } showSnackbar(R.string.unknown_response); }
private void handleSignInResponse(int resultCode, Intent data) { IdpResponse response = IdpResponse.fromResultIntent(data); // Successfully signed in if (resultCode == ResultCodes.OK) { startActivity(SignedInActivity.createIntent(this, response)); finish(); return; } else { // handle failure conditions } }
<style name="DarkTheme" parent="FirebaseUI"> <item name="colorPrimary">@color/material_gray_900</item> <item name="colorPrimaryDark">@android:color/black</item> … </style>
@OnClick(R.id.sign_in) public void signIn(View view) { startActivityForResult( AuthUI.getInstance().createSignInIntentBuilder() .setTheme(R.style.DarkTheme) .setLogo(getSelectedLogo())