mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 17:08:34 +03:00
Merge pull request #1594 from nextcloud/feature/1559/DifferenciateUnreadCounters
differentiate unread counters
This commit is contained in:
commit
f14de62279
3 changed files with 44 additions and 8 deletions
|
@ -42,6 +42,7 @@ import com.facebook.drawee.view.SimpleDraweeView;
|
|||
import com.google.android.material.chip.Chip;
|
||||
import com.nextcloud.talk.R;
|
||||
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.json.chat.ChatMessage;
|
||||
import com.nextcloud.talk.models.json.conversations.Conversation;
|
||||
|
@ -127,7 +128,6 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
|
|||
|
||||
if (conversation.getUnreadMessages() > 0) {
|
||||
holder.dialogName.setTypeface(holder.dialogName.getTypeface(), Typeface.BOLD);
|
||||
holder.dialogDate.setTypeface(holder.dialogDate.getTypeface(), Typeface.BOLD);
|
||||
holder.dialogLastMessage.setTypeface(holder.dialogLastMessage.getTypeface(), Typeface.BOLD);
|
||||
holder.dialogUnreadBubble.setVisibility(View.VISIBLE);
|
||||
if (conversation.getUnreadMessages() < 1000) {
|
||||
|
@ -136,20 +136,45 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
|
|||
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.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.conversation_unread_bubble)));
|
||||
holder.dialogUnreadBubble.setTextColor(
|
||||
ContextCompat.getColor(context, R.color.conversation_unread_bubble_text));
|
||||
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 {
|
||||
holder.dialogUnreadBubble.setChipBackgroundColor(lightBubbleFillColor);
|
||||
holder.dialogUnreadBubble.setTextColor(lightBubbleTextColor);
|
||||
}
|
||||
} else {
|
||||
holder.dialogName.setTypeface(null, Typeface.NORMAL);
|
||||
holder.dialogDate.setTypeface(null, Typeface.NORMAL);
|
||||
holder.dialogLastMessage.setTypeface(null, Typeface.NORMAL);
|
||||
|
||||
holder.dialogUnreadBubble.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -631,7 +631,7 @@ public class ConversationsListController extends BaseController implements Searc
|
|||
Conversation conversationItem = ((ConversationItem) flexItem).getModel();
|
||||
int position = adapter.getGlobalPositionOf(flexItem);
|
||||
if (conversationItem.unreadMention && position > lastVisibleItem) {
|
||||
if(!newMentionPopupBubble.isShown()){
|
||||
if (!newMentionPopupBubble.isShown()){
|
||||
newMentionPopupBubble.show();
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -98,6 +98,9 @@ public class Conversation {
|
|||
@JsonField(name = "canDeleteConversation")
|
||||
public Boolean canDeleteConversation;
|
||||
|
||||
@JsonField(name = "unreadMentionDirect")
|
||||
public Boolean unreadMentionDirect;
|
||||
|
||||
public boolean isPublic() {
|
||||
return (ConversationType.ROOM_PUBLIC_CALL.equals(type));
|
||||
}
|
||||
|
@ -254,6 +257,10 @@ public class Conversation {
|
|||
return this.callFlag;
|
||||
}
|
||||
|
||||
public Boolean getUnreadMentionDirect() {
|
||||
return unreadMentionDirect;
|
||||
}
|
||||
|
||||
public void setRoomId(String roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
@ -359,6 +366,10 @@ public class Conversation {
|
|||
this.callFlag = callFlag;
|
||||
}
|
||||
|
||||
public void setUnreadMentionDirect(Boolean unreadMentionDirect) {
|
||||
this.unreadMentionDirect = unreadMentionDirect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
|
Loading…
Reference in a new issue