Only show the delivery status icon for 'sending' on remote deletes.

master
Greyson Parrelli 2020-10-08 16:29:13 -04:00
parent f642de9c41
commit 0ca2c781c3
3 changed files with 48 additions and 11 deletions

View File

@ -35,6 +35,7 @@ public class ConversationItemFooter extends LinearLayout {
private ExpirationTimerView timerView; private ExpirationTimerView timerView;
private ImageView insecureIndicatorView; private ImageView insecureIndicatorView;
private DeliveryStatusView deliveryStatusView; private DeliveryStatusView deliveryStatusView;
private boolean onlyShowSendingStatus;
public ConversationItemFooter(Context context) { public ConversationItemFooter(Context context) {
super(context); super(context);
@ -93,6 +94,11 @@ public class ConversationItemFooter extends LinearLayout {
deliveryStatusView.setTint(color); deliveryStatusView.setTint(color);
} }
public void setOnlyShowSendingStatus(boolean onlyShowSending, MessageRecord messageRecord) {
this.onlyShowSendingStatus = onlyShowSending;
presentDeliveryStatus(messageRecord);
}
private void presentDate(@NonNull MessageRecord messageRecord, @NonNull Locale locale) { private void presentDate(@NonNull MessageRecord messageRecord, @NonNull Locale locale) {
dateView.forceLayout(); dateView.forceLayout();
if (messageRecord.isFailed()) { if (messageRecord.isFailed()) {
@ -173,14 +179,29 @@ public class ConversationItemFooter extends LinearLayout {
} }
private void presentDeliveryStatus(@NonNull MessageRecord messageRecord) { private void presentDeliveryStatus(@NonNull MessageRecord messageRecord) {
if (!messageRecord.isFailed() && !messageRecord.isPendingInsecureSmsFallback()) { if (messageRecord.isFailed() || messageRecord.isPendingInsecureSmsFallback()) {
if (!messageRecord.isOutgoing()) deliveryStatusView.setNone(); deliveryStatusView.setNone();
else if (messageRecord.isPending()) deliveryStatusView.setPending(); return;
else if (messageRecord.isRemoteRead()) deliveryStatusView.setRead(); }
else if (messageRecord.isDelivered()) deliveryStatusView.setDelivered();
else deliveryStatusView.setSent(); if (onlyShowSendingStatus) {
if (messageRecord.isOutgoing() && messageRecord.isPending()) {
deliveryStatusView.setPending();
} else { } else {
deliveryStatusView.setNone(); deliveryStatusView.setNone();
} }
} else {
if (!messageRecord.isOutgoing()) {
deliveryStatusView.setNone();
} else if (messageRecord.isPending()) {
deliveryStatusView.setPending();
} else if (messageRecord.isRemoteRead()) {
deliveryStatusView.setRead();
} else if (messageRecord.isDelivered()) {
deliveryStatusView.setDelivered();
} else {
deliveryStatusView.setSent();
}
}
} }
} }

View File

@ -420,14 +420,17 @@ public class ConversationItem extends LinearLayout implements BindableConversati
bodyBubble.getBackground().setColorFilter(defaultBubbleColor, PorterDuff.Mode.MULTIPLY); bodyBubble.getBackground().setColorFilter(defaultBubbleColor, PorterDuff.Mode.MULTIPLY);
footer.setTextColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_sent_text_secondary_color)); footer.setTextColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_sent_text_secondary_color));
footer.setIconColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_sent_icon_color)); footer.setIconColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_sent_icon_color));
footer.setOnlyShowSendingStatus(false, messageRecord);
} else if (messageRecord.isRemoteDelete() || (isViewOnceMessage(messageRecord) && ViewOnceUtil.isViewed((MmsMessageRecord) messageRecord))) { } else if (messageRecord.isRemoteDelete() || (isViewOnceMessage(messageRecord) && ViewOnceUtil.isViewed((MmsMessageRecord) messageRecord))) {
bodyBubble.getBackground().setColorFilter(ThemeUtil.getThemedColor(context, R.attr.conversation_item_reveal_viewed_background_color), PorterDuff.Mode.MULTIPLY); bodyBubble.getBackground().setColorFilter(ThemeUtil.getThemedColor(context, R.attr.conversation_item_reveal_viewed_background_color), PorterDuff.Mode.MULTIPLY);
footer.setTextColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_sent_text_secondary_color)); footer.setTextColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_sent_text_secondary_color));
footer.setIconColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_sent_icon_color)); footer.setIconColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_sent_icon_color));
footer.setOnlyShowSendingStatus(messageRecord.isRemoteDelete(), messageRecord);
} else { } else {
bodyBubble.getBackground().setColorFilter(messageRecord.getRecipient().getColor().toConversationColor(context), PorterDuff.Mode.MULTIPLY); bodyBubble.getBackground().setColorFilter(messageRecord.getRecipient().getColor().toConversationColor(context), PorterDuff.Mode.MULTIPLY);
footer.setTextColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_received_text_secondary_color)); footer.setTextColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_received_text_secondary_color));
footer.setIconColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_received_text_secondary_color)); footer.setIconColor(ThemeUtil.getThemedColor(context, R.attr.conversation_item_received_text_secondary_color));
footer.setOnlyShowSendingStatus(false, messageRecord);
} }
outliner.setColor(ThemeUtil.getThemedColor(getContext(), R.attr.conversation_item_sent_text_secondary_color)); outliner.setColor(ThemeUtil.getThemedColor(getContext(), R.attr.conversation_item_sent_text_secondary_color));

View File

@ -377,10 +377,23 @@ public final class ConversationListItem extends RelativeLayout
} else { } else {
alertView.setNone(); alertView.setNone();
if (thread.isPending()) deliveryStatusIndicator.setPending(); if (thread.getExtra() != null && thread.getExtra().isRemoteDelete()) {
else if (thread.isRemoteRead()) deliveryStatusIndicator.setRead(); if (thread.isPending()) {
else if (thread.isDelivered()) deliveryStatusIndicator.setDelivered(); deliveryStatusIndicator.setPending();
else deliveryStatusIndicator.setSent(); } else {
deliveryStatusIndicator.setNone();
}
} else {
if (thread.isPending()) {
deliveryStatusIndicator.setPending();
} else if (thread.isRemoteRead()) {
deliveryStatusIndicator.setRead();
} else if (thread.isDelivered()) {
deliveryStatusIndicator.setDelivered();
} else {
deliveryStatusIndicator.setSent();
}
}
} }
} }