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

Commit 6daca3f

Browse files
committed
Add new realm button to realmDialog
1 parent d136f12 commit 6daca3f

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,24 @@ public void onClick(DialogInterface dialog, int whichButton) {
7575
.show();
7676
}
7777
});
78+
builder.setView(rootView)
79+
.setPositiveButton(R.string.realm_add, new DialogInterface.OnClickListener() {
80+
@Override
81+
public void onClick(DialogInterface dialog, int id) {
82+
((ZulipActivity) getActivity()).currentList.adapter.clear();
83+
((ZulipActivity) getActivity()).currentList.showLoadIndicatorTop(true);
84+
Intent newIntent = new Intent(context, LoginActivity.class);
85+
newIntent.putExtra("FROM_ADDREALM", true);
86+
getActivity().startActivityForResult(newIntent, ZulipActivity.ADDREALM_REQUEST_CODE);
87+
RealmDialog.this.getDialog().cancel();
88+
dialog.dismiss();
89+
}
90+
})
91+
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
92+
public void onClick(DialogInterface dialog, int id) {
93+
RealmDialog.this.getDialog().cancel();
94+
}
95+
});
7896
return builder.create();
7997
}
8098
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public class ZulipActivity extends FragmentActivity implements
5252
MessageListFragment.Listener, NarrowListener {
5353

5454
ZulipApp app;
55-
55+
public static final int ADDREALM_REQUEST_CODE = 201;
56+
5657
public void switchRealm(final ProgressDialog progressDialog, final int position) {
5758
if (event_poll != null) {
5859
event_poll.abort();

0 commit comments

Comments
 (0)