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

Commit 9971c12

Browse files
kunall17niftynei
authored andcommitted
Switch Views for sending private or stream message in the chatBox.
1 parent 14ac42a commit 9971c12

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,41 @@ public void onTaskFailure(String result) {
411411

412412
homeList = MessageListFragment.newInstance(null);
413413
pushListFragment(homeList, null);
414+
streamActv = (AutoCompleteTextView) findViewById(R.id.stream_actv);
415+
topicActv = (AutoCompleteTextView) findViewById(R.id.topic_actv);
416+
messageEt = (EditText) findViewById(R.id.message_et);
417+
textView = (TextView) findViewById(R.id.textView);
418+
sendBtn = (ImageView) findViewById(R.id.send_btn);
419+
togglePrivateStreamBtn = (ImageView) findViewById(R.id.togglePrivateStream_btn);
420+
togglePrivateStreamBtn.setOnClickListener(new View.OnClickListener() {
421+
@Override
422+
public void onClick(View v) {
423+
switchView();
424+
}
425+
});
426+
public void switchView() {
427+
if (isCurrentModeStream()) { //Person
428+
togglePrivateStreamBtn.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_action_bullhorn));
429+
tempStreamSave = topicActv.getText().toString();
430+
topicActv.setText(null);
431+
topicActv.setHint(R.string.hint_person);
432+
topicActv.setAdapter(emailActvAdapter);
433+
streamActv.setVisibility(View.GONE);
434+
textView.setVisibility(View.GONE);
435+
} else { //Stream
436+
topicActv.setText(tempStreamSave);
437+
togglePrivateStreamBtn.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_action_person));
438+
streamActv.setEnabled(true);
439+
topicActv.setHint(R.string.hint_subject);
440+
streamActv.setHint(R.string.hint_stream);
441+
streamActv.setVisibility(View.VISIBLE);
442+
textView.setVisibility(View.VISIBLE);
443+
topicActv.setVisibility(View.VISIBLE);
444+
streamActv.setAdapter(streamActvAdapter);
445+
topicActv.setAdapter(subjectActvAdapter);
446+
}
414447
}
448+
String tempStreamSave = null;
415449

416450
public void onBackPressed() {
417451
if (narrowedList != null) {

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
<string name="username_required">Username required</string>
5151
<string name="server_domain_required">Server domain required</string>
5252
<string name="invalid_domain">Invalid domain</string>
53+
<string name="hint_person">Person</string>
54+
<string name="hint_subject">Subject</string>
55+
<string name="hint_stream">Stream</string>
5356

5457

5558
<string name="tap_message">Tap on a message to send reply</string>

0 commit comments

Comments
 (0)