@@ -40,6 +40,7 @@ public class LoginActivity extends FragmentActivity implements View.OnClickListe
40
40
private GoogleApiClient mGoogleApiClient ;
41
41
private EditText mServerEditText ;
42
42
private View mGoogleSignInButton ;
43
+ private CheckBox mUseZulipCheckbox ;
43
44
44
45
@ Override
45
46
protected void onCreate (Bundle savedInstanceState ) {
@@ -50,11 +51,13 @@ protected void onCreate(Bundle savedInstanceState) {
50
51
// Progress bar to be displayed if the connection failure is not resolved.
51
52
connectionProgressDialog = new ProgressDialog (this );
52
53
connectionProgressDialog .setMessage (getString (R .string .signing_in ));
53
- findViewById (R .id .google_sign_in_button ).setOnClickListener (this );
54
- findViewById (R .id .zulip_login ).setOnClickListener (this );
55
- ((CheckBox ) findViewById (R .id .checkbox_usezulip )).setOnCheckedChangeListener (this );
54
+
55
+ mUseZulipCheckbox = ((CheckBox ) findViewById (R .id .checkbox_usezulip ));
56
56
mServerEditText = (EditText ) findViewById (R .id .server_url );
57
57
mGoogleSignInButton = findViewById (R .id .google_sign_in_button );
58
+ findViewById (R .id .google_sign_in_button ).setOnClickListener (this );
59
+ findViewById (R .id .zulip_login ).setOnClickListener (this );
60
+ mUseZulipCheckbox .setOnCheckedChangeListener (this );
58
61
}
59
62
60
63
@ Override
@@ -85,6 +88,11 @@ protected void onStop() {
85
88
}
86
89
87
90
private void saveServerURL () {
91
+ if (mUseZulipCheckbox .isChecked ()) {
92
+ ((ZulipApp ) getApplication ()).useDefaultServerURL ();
93
+ return ;
94
+ }
95
+
88
96
String serverURL = mServerEditText .getText ().toString ();
89
97
int errorMessage = R .string .invalid_server_domain ;
90
98
@@ -217,8 +225,9 @@ public void onClick(View v) {
217
225
setupGoogleSignIn ();
218
226
break ;
219
227
case R .id .zulip_login :
220
- connectionProgressDialog .show ();
221
228
saveServerURL ();
229
+ connectionProgressDialog .show ();
230
+ if (!mUseZulipCheckbox .isChecked ()) saveServerURL ();
222
231
AsyncLogin alog = new AsyncLogin (LoginActivity .this , ((EditText ) findViewById (R .id .username )).getText ().toString (),
223
232
((EditText ) findViewById (R .id .password )).getText ().toString ());
224
233
// Remove the CPD when done
0 commit comments