@@ -58,89 +58,42 @@ public class AuthUiActivity extends AppCompatActivity {
58
58
59
59
private static final int RC_SIGN_IN = 100 ;
60
60
61
- @ BindView (R .id .default_theme )
62
- RadioButton mUseDefaultTheme ;
61
+ @ BindView (R .id .root ) View mRootView ;
62
+ @ BindView ( R . id . sign_in ) Button mSignIn ;
63
63
64
- @ BindView (R .id .green_theme )
65
- RadioButton mUseGreenTheme ;
64
+ @ BindView (R .id .google_provider ) CheckBox mUseGoogleProvider ;
65
+ @ BindView (R .id .facebook_provider ) CheckBox mUseFacebookProvider ;
66
+ @ BindView (R .id .twitter_provider ) CheckBox mUseTwitterProvider ;
67
+ @ BindView (R .id .email_provider ) CheckBox mUseEmailProvider ;
68
+ @ BindView (R .id .phone_provider ) CheckBox mUsePhoneProvider ;
66
69
67
- @ BindView (R .id .purple_theme )
68
- RadioButton mUsePurpleTheme ;
70
+ @ BindView (R .id .default_theme ) RadioButton mUseDefaultTheme ;
71
+ @ BindView (R .id .green_theme ) RadioButton mUseGreenTheme ;
72
+ @ BindView (R .id .purple_theme ) RadioButton mUsePurpleTheme ;
73
+ @ BindView (R .id .dark_theme ) RadioButton mUseDarkTheme ;
69
74
70
- @ BindView (R .id .dark_theme )
71
- RadioButton mUseDarkTheme ;
75
+ @ BindView (R .id .firebase_logo ) RadioButton mFirebaseLogo ;
76
+ @ BindView (R .id .google_logo ) RadioButton mGoogleLogo ;
77
+ @ BindView (R .id .no_logo ) RadioButton mNoLogo ;
72
78
73
- @ BindView (R .id .email_provider )
74
- CheckBox mUseEmailProvider ;
79
+ @ BindView (R .id .google_tos ) RadioButton mUseGoogleTos ;
80
+ @ BindView ( R . id . firebase_tos ) RadioButton mUseFirebaseTos ;
75
81
76
- @ BindView (R .id .phone_provider )
77
- CheckBox mUsePhoneProvider ;
82
+ @ BindView (R .id .google_privacy ) RadioButton mUseGooglePrivacyPolicy ;
83
+ @ BindView ( R . id . firebase_privacy ) RadioButton mUseFirebasePrivacyPolicy ;
78
84
79
- @ BindView (R .id .google_provider )
80
- CheckBox mUseGoogleProvider ;
85
+ @ BindView (R .id .google_scopes_header ) TextView mGoogleScopesLabel ;
86
+ @ BindView (R .id .google_scope_drive_file ) CheckBox mGoogleScopeDriveFile ;
87
+ @ BindView (R .id .google_scope_youtube_data ) CheckBox mGoogleScopeYoutubeData ;
81
88
82
- @ BindView (R .id .facebook_provider )
83
- CheckBox mUseFacebookProvider ;
89
+ @ BindView (R .id .facebook_permissions_header ) TextView mFacebookScopesLabel ;
90
+ @ BindView (R .id .facebook_permission_friends ) CheckBox mFacebookScopeFriends ;
91
+ @ BindView (R .id .facebook_permission_photos ) CheckBox mFacebookScopePhotos ;
84
92
85
- @ BindView (R .id .twitter_provider )
86
- CheckBox mUseTwitterProvider ;
87
-
88
- @ BindView (R .id .google_tos )
89
- RadioButton mUseGoogleTos ;
90
-
91
- @ BindView (R .id .firebase_tos )
92
- RadioButton mUseFirebaseTos ;
93
-
94
- @ BindView (R .id .google_privacy )
95
- RadioButton mUseGooglePrivacyPolicy ;
96
-
97
- @ BindView (R .id .firebase_privacy )
98
- RadioButton mUseFirebasePrivacyPolicy ;
99
-
100
- @ BindView (R .id .sign_in )
101
- Button mSignIn ;
102
-
103
- @ BindView (R .id .root )
104
- View mRootView ;
105
-
106
- @ BindView (R .id .firebase_logo )
107
- RadioButton mFirebaseLogo ;
108
-
109
- @ BindView (R .id .google_logo )
110
- RadioButton mGoogleLogo ;
111
-
112
- @ BindView (R .id .no_logo )
113
- RadioButton mNoLogo ;
114
-
115
- @ BindView (R .id .credential_selector_enabled )
116
- CheckBox mEnableCredentialSelector ;
117
-
118
- @ BindView (R .id .hint_selector_enabled )
119
- CheckBox mEnableHintSelector ;
120
-
121
- @ BindView (R .id .allow_new_email_accounts )
122
- CheckBox mAllowNewEmailAccounts ;
123
-
124
- @ BindView (R .id .require_name )
125
- CheckBox mRequireName ;
126
-
127
- @ BindView (R .id .facebook_scopes_label )
128
- TextView mFacebookScopesLabel ;
129
-
130
- @ BindView (R .id .facebook_scope_friends )
131
- CheckBox mFacebookScopeFriends ;
132
-
133
- @ BindView (R .id .facebook_scope_photos )
134
- CheckBox mFacebookScopePhotos ;
135
-
136
- @ BindView (R .id .google_scopes_label )
137
- TextView mGoogleScopesLabel ;
138
-
139
- @ BindView (R .id .google_scope_drive_file )
140
- CheckBox mGoogleScopeDriveFile ;
141
-
142
- @ BindView (R .id .google_scope_youtube_data )
143
- CheckBox mGoogleScopeYoutubeData ;
93
+ @ BindView (R .id .credential_selector_enabled ) CheckBox mEnableCredentialSelector ;
94
+ @ BindView (R .id .hint_selector_enabled ) CheckBox mEnableHintSelector ;
95
+ @ BindView (R .id .allow_new_email_accounts ) CheckBox mAllowNewEmailAccounts ;
96
+ @ BindView (R .id .require_name ) CheckBox mRequireName ;
144
97
145
98
public static Intent createIntent (Context context ) {
146
99
return new Intent (context , AuthUiActivity .class );
@@ -217,10 +170,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
217
170
super .onActivityResult (requestCode , resultCode , data );
218
171
if (requestCode == RC_SIGN_IN ) {
219
172
handleSignInResponse (resultCode , data );
220
- return ;
221
173
}
222
-
223
- showSnackbar (R .string .unknown_response );
224
174
}
225
175
226
176
@ Override
@@ -259,29 +209,7 @@ private void handleSignInResponse(int resultCode, Intent data) {
259
209
}
260
210
261
211
private void startSignedInActivity (IdpResponse response ) {
262
- startActivity (
263
- SignedInActivity .createIntent (
264
- this ,
265
- response ,
266
- new SignedInActivity .SignedInConfig (
267
- getSelectedLogo (),
268
- getSelectedTheme (),
269
- getSelectedProviders (),
270
- getSelectedTosUrl (),
271
- mEnableCredentialSelector .isChecked (),
272
- mEnableHintSelector .isChecked ())));
273
- }
274
-
275
- private void setGoogleScopesEnabled (boolean enabled ) {
276
- mGoogleScopesLabel .setEnabled (enabled );
277
- mGoogleScopeDriveFile .setEnabled (enabled );
278
- mGoogleScopeYoutubeData .setEnabled (enabled );
279
- }
280
-
281
- private void setFacebookScopesEnabled (boolean enabled ) {
282
- mFacebookScopesLabel .setEnabled (enabled );
283
- mFacebookScopeFriends .setEnabled (enabled );
284
- mFacebookScopePhotos .setEnabled (enabled );
212
+ startActivity (SignedInActivity .createIntent (this , response ));
285
213
}
286
214
287
215
@ OnClick ({R .id .default_theme , R .id .purple_theme , R .id .green_theme , R .id .dark_theme })
@@ -380,19 +308,16 @@ private boolean isTwitterMisconfigured() {
380
308
return twitterConfigs .contains (AuthUI .UNCONFIGURED_CONFIG_VALUE );
381
309
}
382
310
383
- private void showSnackbar (@ StringRes int errorMessageRes ) {
384
- Snackbar .make (mRootView , errorMessageRes , Snackbar .LENGTH_LONG ).show ();
311
+ private void setGoogleScopesEnabled (boolean enabled ) {
312
+ mGoogleScopesLabel .setEnabled (enabled );
313
+ mGoogleScopeDriveFile .setEnabled (enabled );
314
+ mGoogleScopeYoutubeData .setEnabled (enabled );
385
315
}
386
316
387
- private List <String > getFacebookPermissions () {
388
- List <String > result = new ArrayList <>();
389
- if (mFacebookScopeFriends .isChecked ()) {
390
- result .add ("user_friends" );
391
- }
392
- if (mFacebookScopePhotos .isChecked ()) {
393
- result .add ("user_photos" );
394
- }
395
- return result ;
317
+ private void setFacebookScopesEnabled (boolean enabled ) {
318
+ mFacebookScopesLabel .setEnabled (enabled );
319
+ mFacebookScopeFriends .setEnabled (enabled );
320
+ mFacebookScopePhotos .setEnabled (enabled );
396
321
}
397
322
398
323
private List <String > getGoogleScopes () {
@@ -405,4 +330,19 @@ private List<String> getGoogleScopes() {
405
330
}
406
331
return result ;
407
332
}
333
+
334
+ private List <String > getFacebookPermissions () {
335
+ List <String > result = new ArrayList <>();
336
+ if (mFacebookScopeFriends .isChecked ()) {
337
+ result .add ("user_friends" );
338
+ }
339
+ if (mFacebookScopePhotos .isChecked ()) {
340
+ result .add ("user_photos" );
341
+ }
342
+ return result ;
343
+ }
344
+
345
+ private void showSnackbar (@ StringRes int errorMessageRes ) {
346
+ Snackbar .make (mRootView , errorMessageRes , Snackbar .LENGTH_LONG ).show ();
347
+ }
408
348
}
0 commit comments