aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-03-14 22:59:43 +0100
committerChristian Schneppe <christian@pix-art.de>2017-03-14 22:59:43 +0100
commitb7f839e14b6aab969411ea2ae68c527a3b2ea7a5 (patch)
treebcac154aafe7e2fdd044b54a659a5ffb79525cf5 /src/main
parent9690b1baf34c9363d92bb9df6b4cba53e08dd7de (diff)
show typing info in overview
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java1
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java41
2 files changed, 37 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index 4630fbcba..62f0dcdb3 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -456,7 +456,6 @@ public class ConversationActivity extends XmppActivity
if (userWithChatStates.size() == 0) {
state = ChatState.PAUSED;
userWithChatStates = conversation.getMucOptions().getUsersWithChatState(state, 5);
-
}
List<MucOptions.User> users = conversation.getMucOptions().getUsers(true);
if (state == ChatState.COMPOSING) {
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
index 755fb4406..9b204d765 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
@@ -22,6 +22,7 @@ import java.util.concurrent.RejectedExecutionException;
import de.pixart.messenger.R;
import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.entities.Message;
+import de.pixart.messenger.entities.MucOptions;
import de.pixart.messenger.entities.Transferable;
import de.pixart.messenger.ui.ConversationActivity;
import de.pixart.messenger.ui.XmppActivity;
@@ -174,10 +175,42 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
ImageView profilePicture = (ImageView) view.findViewById(R.id.conversation_image);
loadAvatar(conversation, profilePicture);
- if (conversation.getIncomingChatState().equals(ChatState.COMPOSING)) {
- mLastMessage.setText(R.string.is_typing);
- mLastMessage.setTypeface(null, Typeface.BOLD_ITALIC);
- mSenderName.setVisibility(View.GONE);
+ if (conversation.getMode() == Conversation.MODE_SINGLE) {
+ if (conversation.getIncomingChatState().equals(ChatState.COMPOSING)) {
+ mLastMessage.setText(R.string.is_typing);
+ mLastMessage.setTypeface(null, Typeface.BOLD_ITALIC);
+ mSenderName.setVisibility(View.GONE);
+ }
+ } else {
+ if (conversation.getParticipants() != null) {
+ ChatState state = ChatState.COMPOSING;
+ List<MucOptions.User> userWithChatStates = conversation.getMucOptions().getUsersWithChatState(state, 5);
+ if (userWithChatStates.size() == 0) {
+ state = ChatState.PAUSED;
+ userWithChatStates = conversation.getMucOptions().getUsersWithChatState(state, 5);
+ }
+ if (state == ChatState.COMPOSING) {
+ if (userWithChatStates.size() > 0) {
+ if (userWithChatStates.size() == 1) {
+ MucOptions.User user = userWithChatStates.get(0);
+ mLastMessage.setText(activity.getString(R.string.contact_is_typing, UIHelper.getDisplayName(user)));
+ mLastMessage.setTypeface(null, Typeface.BOLD_ITALIC);
+ mSenderName.setVisibility(View.GONE);
+ } else {
+ StringBuilder builder = new StringBuilder();
+ for (MucOptions.User user : userWithChatStates) {
+ if (builder.length() != 0) {
+ builder.append(", ");
+ }
+ builder.append(UIHelper.getDisplayName(user));
+ }
+ mLastMessage.setText(activity.getString(R.string.contacts_are_typing, builder.toString()));
+ mLastMessage.setTypeface(null, Typeface.BOLD_ITALIC);
+ mSenderName.setVisibility(View.GONE);
+ }
+ }
+ }
+ }
}
return view;
}