Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 6c2e48d

Browse files
committed
Change Title in LoginActivity if started from add realm
1 parent 6daca3f commit 6c2e48d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/src/main/java/com/zulip/android/LoginActivity.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@
2626
import com.google.android.gms.common.GooglePlayServicesUtil;
2727
import com.zulip.android.ZulipAsyncPushTask.AsyncTaskCompleteListener;
2828

29+
import org.json.JSONException;
30+
import org.json.JSONObject;
2931
public class LoginActivity extends Activity implements View.OnClickListener,
3032
OnConnectionFailedListener {
3133
private static final int REQUEST_ACCOUNT_PICKER = 2;
3234
private static final int REQUEST_CODE_RESOLVE_ERR = 9000;
3335

36+
public boolean startedFromAddRealm = false;
3437
EditText serverUrlText;
3538
EditText realmNameET;
3639
LoginActivity that = this; // self-ref
@@ -47,12 +50,21 @@ protected void onCreate(Bundle savedInstanceState) {
4750
setContentView(R.layout.login);
4851
realmNameET = (EditText) findViewById(R.id.realmName);
4952
serverUrlText = (EditText) findViewById(R.id.server);
53+
if (getIntent().getBooleanExtra("FROM_ADDREALM", false)) {
54+
startedFromAddRealm = true;
55+
((TextView)findViewById(R.id.textView1)).setText("Add new Realm");
56+
((Button) findViewById(R.id.login)).setText("Add");
57+
}
5058

5159
((Button) findViewById(R.id.login))
5260
.setOnClickListener(new View.OnClickListener() {
5361
@Override
5462
public void onClick(View v) {
5563
connectionProgressDialog.show();
64+
if (app.serverStringSet.contains(realmNameET.getText().toString())) {
65+
Toast.makeText(LoginActivity.this, R.string.realm_exists, Toast.LENGTH_SHORT).show();
66+
return;
67+
}
5668
AsyncLogin alog = new AsyncLogin(that,
5769
((EditText) findViewById(R.id.username))
5870
.getText().toString(),

0 commit comments

Comments
 (0)