mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
differentiate unread counters
differentiate unread counters for group mentions and direct mentions Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
74867b416d
commit
a6397b0392
@ -42,6 +42,7 @@ import com.facebook.drawee.view.SimpleDraweeView;
|
|||||||
import com.google.android.material.chip.Chip;
|
import com.google.android.material.chip.Chip;
|
||||||
import com.nextcloud.talk.R;
|
import com.nextcloud.talk.R;
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
|
import com.nextcloud.talk.models.database.CapabilitiesUtil;
|
||||||
import com.nextcloud.talk.models.database.UserEntity;
|
import com.nextcloud.talk.models.database.UserEntity;
|
||||||
import com.nextcloud.talk.models.json.chat.ChatMessage;
|
import com.nextcloud.talk.models.json.chat.ChatMessage;
|
||||||
import com.nextcloud.talk.models.json.conversations.Conversation;
|
import com.nextcloud.talk.models.json.conversations.Conversation;
|
||||||
@ -136,20 +137,45 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
|
|||||||
holder.dialogUnreadBubble.setText(R.string.tooManyUnreadMessages);
|
holder.dialogUnreadBubble.setText(R.string.tooManyUnreadMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conversation.isUnreadMention() || conversation.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
|
ColorStateList lightBubbleFillColor = ColorStateList.valueOf(
|
||||||
|
ContextCompat.getColor(context,
|
||||||
|
R.color.conversation_unread_bubble));
|
||||||
|
int lightBubbleTextColor = ContextCompat.getColor(
|
||||||
|
context,
|
||||||
|
R.color.conversation_unread_bubble_text);
|
||||||
|
ColorStateList lightBubbleStrokeColor = ColorStateList.valueOf(
|
||||||
|
ContextCompat.getColor(context,
|
||||||
|
R.color.colorPrimary));
|
||||||
|
|
||||||
|
if (conversation.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
|
||||||
holder.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
holder.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
||||||
holder.dialogUnreadBubble.setTextColor(Color.WHITE);
|
holder.dialogUnreadBubble.setTextColor(Color.WHITE);
|
||||||
|
} else if (conversation.isUnreadMention()) {
|
||||||
|
if (CapabilitiesUtil.hasSpreedFeatureCapability(userEntity, "direct-mention-flag")){
|
||||||
|
if (conversation.getUnreadMentionDirect()) {
|
||||||
|
holder.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
||||||
|
holder.dialogUnreadBubble.setTextColor(Color.WHITE);
|
||||||
|
} else {
|
||||||
|
holder.dialogUnreadBubble.setChipBackgroundColor(ColorStateList.valueOf(
|
||||||
|
ContextCompat.getColor(context, R.color.white)));
|
||||||
|
holder.dialogUnreadBubble.setTextColor(ContextCompat.getColor(
|
||||||
|
context,
|
||||||
|
R.color.colorPrimary));
|
||||||
|
holder.dialogUnreadBubble.setChipStrokeWidth(6.0f);
|
||||||
|
holder.dialogUnreadBubble.setChipStrokeColor(lightBubbleStrokeColor);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
holder.dialogUnreadBubble.setChipBackgroundColorResource(R.color.colorPrimary);
|
||||||
|
holder.dialogUnreadBubble.setTextColor(Color.WHITE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
holder.dialogUnreadBubble.setChipBackgroundColor(
|
holder.dialogUnreadBubble.setChipBackgroundColor(lightBubbleFillColor);
|
||||||
ColorStateList.valueOf(ContextCompat.getColor(context, R.color.conversation_unread_bubble)));
|
holder.dialogUnreadBubble.setTextColor(lightBubbleTextColor);
|
||||||
holder.dialogUnreadBubble.setTextColor(
|
|
||||||
ContextCompat.getColor(context, R.color.conversation_unread_bubble_text));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
holder.dialogName.setTypeface(null, Typeface.NORMAL);
|
holder.dialogName.setTypeface(null, Typeface.NORMAL);
|
||||||
holder.dialogDate.setTypeface(null, Typeface.NORMAL);
|
holder.dialogDate.setTypeface(null, Typeface.NORMAL);
|
||||||
holder.dialogLastMessage.setTypeface(null, Typeface.NORMAL);
|
holder.dialogLastMessage.setTypeface(null, Typeface.NORMAL);
|
||||||
|
|
||||||
holder.dialogUnreadBubble.setVisibility(View.GONE);
|
holder.dialogUnreadBubble.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ public class ConversationsListController extends BaseController implements Searc
|
|||||||
Conversation conversationItem = ((ConversationItem) flexItem).getModel();
|
Conversation conversationItem = ((ConversationItem) flexItem).getModel();
|
||||||
int position = adapter.getGlobalPositionOf(flexItem);
|
int position = adapter.getGlobalPositionOf(flexItem);
|
||||||
if (conversationItem.unreadMention && position > lastVisibleItem) {
|
if (conversationItem.unreadMention && position > lastVisibleItem) {
|
||||||
if(!newMentionPopupBubble.isShown()){
|
if (!newMentionPopupBubble.isShown()){
|
||||||
newMentionPopupBubble.show();
|
newMentionPopupBubble.show();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -98,6 +98,9 @@ public class Conversation {
|
|||||||
@JsonField(name = "canDeleteConversation")
|
@JsonField(name = "canDeleteConversation")
|
||||||
public Boolean canDeleteConversation;
|
public Boolean canDeleteConversation;
|
||||||
|
|
||||||
|
@JsonField(name = "unreadMentionDirect")
|
||||||
|
public Boolean unreadMentionDirect;
|
||||||
|
|
||||||
public boolean isPublic() {
|
public boolean isPublic() {
|
||||||
return (ConversationType.ROOM_PUBLIC_CALL.equals(type));
|
return (ConversationType.ROOM_PUBLIC_CALL.equals(type));
|
||||||
}
|
}
|
||||||
@ -254,6 +257,10 @@ public class Conversation {
|
|||||||
return this.callFlag;
|
return this.callFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getUnreadMentionDirect() {
|
||||||
|
return unreadMentionDirect;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRoomId(String roomId) {
|
public void setRoomId(String roomId) {
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
}
|
}
|
||||||
@ -359,6 +366,10 @@ public class Conversation {
|
|||||||
this.callFlag = callFlag;
|
this.callFlag = callFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUnreadMentionDirect(Boolean unreadMentionDirect) {
|
||||||
|
this.unreadMentionDirect = unreadMentionDirect;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) {
|
if (this == o) {
|
||||||
|
Loading…
Reference in New Issue
Block a user