@@ -70,6 +70,7 @@ public class AuthUiActivity extends AppCompatActivity {
7070 @ BindView (R .id .github_provider ) CheckBox mUseGitHubProvider ;
7171 @ BindView (R .id .email_provider ) CheckBox mUseEmailProvider ;
7272 @ BindView (R .id .phone_provider ) CheckBox mUsePhoneProvider ;
73+ @ BindView (R .id .anonymous_provider ) CheckBox mUseAnonymousProvider ;
7374
7475 @ BindView (R .id .default_theme ) RadioButton mDefaultTheme ;
7576 @ BindView (R .id .green_theme ) RadioButton mGreenTheme ;
@@ -103,7 +104,8 @@ public class AuthUiActivity extends AppCompatActivity {
103104 @ BindView (R .id .allow_new_email_accounts ) CheckBox mAllowNewEmailAccounts ;
104105 @ BindView (R .id .require_name ) CheckBox mRequireName ;
105106
106- public static Intent createIntent (Context context ) {
107+ @ NonNull
108+ public static Intent createIntent (@ NonNull Context context ) {
107109 return new Intent (context , AuthUiActivity .class );
108110 }
109111
@@ -177,7 +179,7 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
177179 }
178180
179181 @ OnClick (R .id .sign_in )
180- public void signIn (View view ) {
182+ public void signIn () {
181183 startActivityForResult (
182184 AuthUI .getInstance ().createSignInIntentBuilder ()
183185 .setTheme (getSelectedTheme ())
@@ -192,7 +194,7 @@ public void signIn(View view) {
192194 }
193195
194196 @ OnClick (R .id .sign_in_silent )
195- public void silentSignIn (View view ) {
197+ public void silentSignIn () {
196198 AuthUI .getInstance ().silentSignIn (this , getSelectedProviders ())
197199 .addOnCompleteListener (this , new OnCompleteListener <AuthResult >() {
198200 @ Override
@@ -207,7 +209,7 @@ public void onComplete(@NonNull Task<AuthResult> task) {
207209 }
208210
209211 @ Override
210- protected void onActivityResult (int requestCode , int resultCode , Intent data ) {
212+ protected void onActivityResult (int requestCode , int resultCode , @ Nullable Intent data ) {
211213 super .onActivityResult (requestCode , resultCode , data );
212214 if (requestCode == RC_SIGN_IN ) {
213215 handleSignInResponse (resultCode , data );
@@ -224,8 +226,8 @@ protected void onResume() {
224226 }
225227 }
226228
227- private void handleSignInResponse (int resultCode , Intent data ) {
228- final IdpResponse response = IdpResponse .fromResultIntent (data );
229+ private void handleSignInResponse (int resultCode , @ Nullable Intent data ) {
230+ IdpResponse response = IdpResponse .fromResultIntent (data );
229231
230232 // Successfully signed in
231233 if (resultCode == RESULT_OK ) {
@@ -249,7 +251,7 @@ private void handleSignInResponse(int resultCode, Intent data) {
249251 }
250252 }
251253
252- private void startSignedInActivity (IdpResponse response ) {
254+ private void startSignedInActivity (@ Nullable IdpResponse response ) {
253255 startActivity (SignedInActivity .createIntent (this , response ));
254256 }
255257
@@ -319,6 +321,10 @@ private List<IdpConfig> getSelectedProviders() {
319321 selectedProviders .add (new IdpConfig .PhoneBuilder ().build ());
320322 }
321323
324+ if (mUseAnonymousProvider .isChecked ()) {
325+ selectedProviders .add (new IdpConfig .AnonymousBuilder ().build ());
326+ }
327+
322328 return selectedProviders ;
323329 }
324330
0 commit comments