aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-01-24 20:24:37 +0100
committerChristian Schneppe <christian@pix-art.de>2019-01-24 20:41:24 +0100
commit6d5c7fd4d625bc453e487335330282d4481c19ac (patch)
tree65a3d4e79341b8545aed7c34189416d44821ed10 /src/main/java
parent141a37a7c8691828ba1d2e028998897e2467f868 (diff)
count muc participants correctly
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Conversation.java13
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationsActivity.java90
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java46
3 files changed, 59 insertions, 90 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java
index 502f2638d..e64073d61 100644
--- a/src/main/java/de/pixart/messenger/entities/Conversation.java
+++ b/src/main/java/de/pixart/messenger/entities/Conversation.java
@@ -569,19 +569,6 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
}
- public String getParticipants() {
- if (getMode() == MODE_MULTI) {
- String generatedName = getMucOptions().createNameFromParticipants();
- if (generatedName != null) {
- return generatedName;
- } else {
- return null;
- }
- } else {
- return null;
- }
- }
-
public String getAccountUuid() {
return this.accountUuid;
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
index 400519ab3..7dca7d4c1 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
@@ -766,65 +766,49 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
}
}
} 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);
- }
- List<MucOptions.User> users = conversation.getMucOptions().getUsers(true);
- if (state == ChatState.COMPOSING) {
- if (userWithChatStates.size() > 0) {
- if (userWithChatStates.size() == 1) {
- MucOptions.User user = userWithChatStates.get(0);
- absubtitle.setText(EmojiWrapper.transform(getString(R.string.contact_is_typing, UIHelper.getDisplayName(user))));
- } else {
- StringBuilder builder = new StringBuilder();
- for (MucOptions.User user : userWithChatStates) {
- if (builder.length() != 0) {
- builder.append(", ");
- }
- builder.append(UIHelper.getDisplayName(user));
+ 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);
+ }
+ List<MucOptions.User> users = conversation.getMucOptions().getUsers(true);
+ if (state == ChatState.COMPOSING) {
+ if (userWithChatStates.size() > 0) {
+ if (userWithChatStates.size() == 1) {
+ MucOptions.User user = userWithChatStates.get(0);
+ absubtitle.setText(EmojiWrapper.transform(getString(R.string.contact_is_typing, UIHelper.getDisplayName(user))));
+ } else {
+ StringBuilder builder = new StringBuilder();
+ for (MucOptions.User user : userWithChatStates) {
+ if (builder.length() != 0) {
+ builder.append(", ");
}
- absubtitle.setText(EmojiWrapper.transform(getString(R.string.contacts_are_typing, builder.toString())));
+ builder.append(UIHelper.getDisplayName(user));
}
- }
- } else {
- if (users.size() == 0) {
- absubtitle.setText(getString(R.string.one_participant));
- } else {
- int size = users.size() + 1;
- absubtitle.setText(getString(R.string.more_participants, size));
+ absubtitle.setText(EmojiWrapper.transform(getString(R.string.contacts_are_typing, builder.toString())));
}
}
- absubtitle.setSelected(true);
- absubtitle.setOnClickListener(view15 -> {
- if (conversation.getMode() == Conversation.MODE_SINGLE) {
- switchToContactDetails(conversation.getContact());
- } else if (conversation.getMode() == Conversation.MODE_MULTI) {
- Intent intent = new Intent(ConversationsActivity.this, ConferenceDetailsActivity.class);
- intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
- intent.putExtra("uuid", conversation.getUuid());
- startActivity(intent);
- overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
- }
- });
} else {
- absubtitle.setText(R.string.no_participants);
- abtitle.setSelected(true);
- absubtitle.setOnClickListener(view16 -> {
- if (conversation.getMode() == Conversation.MODE_SINGLE) {
- switchToContactDetails(conversation.getContact());
- } else if (conversation.getMode() == Conversation.MODE_MULTI) {
- Intent intent = new Intent(ConversationsActivity.this, ConferenceDetailsActivity.class);
- intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
- intent.putExtra("uuid", conversation.getUuid());
- startActivity(intent);
- overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
- }
- });
+ if (users.size() == 0) {
+ absubtitle.setText(getString(R.string.one_participant));
+ } else {
+ int size = users.size() + 1;
+ absubtitle.setText(getString(R.string.more_participants, size));
+ }
}
+ absubtitle.setSelected(true);
+ absubtitle.setOnClickListener(view15 -> {
+ if (conversation.getMode() == Conversation.MODE_SINGLE) {
+ switchToContactDetails(conversation.getContact());
+ } else if (conversation.getMode() == Conversation.MODE_MULTI) {
+ Intent intent = new Intent(ConversationsActivity.this, ConferenceDetailsActivity.class);
+ intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
+ intent.putExtra("uuid", conversation.getUuid());
+ startActivity(intent);
+ overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
+ }
+ });
}
return;
}
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 d61510611..3e7bccc75 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
@@ -276,32 +276,30 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapte
viewHolder.sender.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);
- viewHolder.lastMessage.setText(activity.getString(R.string.contact_is_typing, UIHelper.getDisplayName(user)));
- viewHolder.lastMessage.setTypeface(null, Typeface.BOLD_ITALIC);
- viewHolder.sender.setVisibility(View.GONE);
- } else {
- StringBuilder builder = new StringBuilder();
- for (MucOptions.User user : userWithChatStates) {
- if (builder.length() != 0) {
- builder.append(", ");
- }
- builder.append(UIHelper.getDisplayName(user));
+ 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);
+ viewHolder.lastMessage.setText(activity.getString(R.string.contact_is_typing, UIHelper.getDisplayName(user)));
+ viewHolder.lastMessage.setTypeface(null, Typeface.BOLD_ITALIC);
+ viewHolder.sender.setVisibility(View.GONE);
+ } else {
+ StringBuilder builder = new StringBuilder();
+ for (MucOptions.User user : userWithChatStates) {
+ if (builder.length() != 0) {
+ builder.append(", ");
}
- viewHolder.lastMessage.setText(activity.getString(R.string.contacts_are_typing, builder.toString()));
- viewHolder.lastMessage.setTypeface(null, Typeface.BOLD_ITALIC);
- viewHolder.sender.setVisibility(View.GONE);
+ builder.append(UIHelper.getDisplayName(user));
}
+ viewHolder.lastMessage.setText(activity.getString(R.string.contacts_are_typing, builder.toString()));
+ viewHolder.lastMessage.setTypeface(null, Typeface.BOLD_ITALIC);
+ viewHolder.sender.setVisibility(View.GONE);
}
}
}