improve quote style when replying with a sticker

This commit is contained in:
adbenitez 2021-04-23 18:01:16 -04:00
parent 0dccbb9789
commit e6006c874b
3 changed files with 23 additions and 6 deletions

View file

@ -549,6 +549,8 @@ public class ConversationItem extends BaseConversationItem
quoteView.dismiss(); quoteView.dismiss();
if (mediaThumbnailStub.resolved()) { if (mediaThumbnailStub.resolved()) {
ViewUtil.setTopMargin(mediaThumbnailStub.get(), 0); ViewUtil.setTopMargin(mediaThumbnailStub.get(), 0);
} else if (stickerStub.resolved()) {
ViewUtil.setTopMargin(stickerStub.get(), 0);
} }
return; return;
} }
@ -571,7 +573,8 @@ public class ConversationItem extends BaseConversationItem
msg, msg,
author, author,
quoteTxt, quoteTxt,
slideDeck); slideDeck,
current.getType() == DcMsg.DC_MSG_STICKER);
quoteView.setVisibility(View.VISIBLE); quoteView.setVisibility(View.VISIBLE);
quoteView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT; quoteView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;
@ -588,6 +591,8 @@ public class ConversationItem extends BaseConversationItem
if (mediaThumbnailStub.resolved()) { if (mediaThumbnailStub.resolved()) {
ViewUtil.setTopMargin(mediaThumbnailStub.get(), readDimen(R.dimen.message_bubble_top_padding)); ViewUtil.setTopMargin(mediaThumbnailStub.get(), readDimen(R.dimen.message_bubble_top_padding));
} else if (stickerStub.resolved()) {
ViewUtil.setTopMargin(stickerStub.get(), readDimen(R.dimen.message_bubble_top_padding));
} }
} }

View file

@ -140,7 +140,7 @@ public class InputPanel extends ConstraintLayout
@NonNull CharSequence body, @NonNull CharSequence body,
@NonNull SlideDeck attachments) @NonNull SlideDeck attachments)
{ {
this.quoteView.setQuote(glideRequests, msg, author, body, attachments); this.quoteView.setQuote(glideRequests, msg, author, body, attachments, false);
int originalHeight = this.quoteView.getVisibility() == VISIBLE ? this.quoteView.getMeasuredHeight() int originalHeight = this.quoteView.getVisibility() == VISIBLE ? this.quoteView.getMeasuredHeight()
: 0; : 0;

View file

@ -56,6 +56,7 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
private CharSequence body; private CharSequence body;
private SlideDeck attachments; private SlideDeck attachments;
private int messageType; private int messageType;
private boolean hasSticker;
public QuoteView(Context context) { public QuoteView(Context context) {
super(context); super(context);
@ -115,13 +116,19 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
DcMsg msg, DcMsg msg,
@Nullable Recipient author, @Nullable Recipient author,
@Nullable CharSequence body, @Nullable CharSequence body,
@NonNull SlideDeck attachments) @NonNull SlideDeck attachments,
boolean hasSticker)
{ {
quotedMsg = msg; quotedMsg = msg;
this.author = author != null ? author.getDcContact() : null; this.author = author != null ? author.getDcContact() : null;
this.body = body; this.body = body;
this.attachments = attachments; this.attachments = attachments;
this.hasSticker = hasSticker;
if (hasSticker) {
this.setBackgroundResource(R.drawable.conversation_item_update_background);
bodyView.setTextColor(getResources().getColor(R.color.core_dark_05));
}
setQuoteAuthor(author); setQuoteAuthor(author);
setQuoteText(body, attachments); setQuoteText(body, attachments);
setQuoteAttachment(glideRequests, attachments); setQuoteAttachment(glideRequests, attachments);
@ -161,11 +168,16 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
} else { } else {
authorView.setVisibility(VISIBLE); authorView.setVisibility(VISIBLE);
authorView.setText(quotedMsg.getSenderName(contact, true)); authorView.setText(quotedMsg.getSenderName(contact, true));
if (hasSticker) {
authorView.setTextColor(getResources().getColor(R.color.core_dark_05));
quoteBarView.setBackgroundColor(getResources().getColor(R.color.core_dark_05));
} else {
authorView.setTextColor(Util.rgbToArgbColor(contact.getColor())); authorView.setTextColor(Util.rgbToArgbColor(contact.getColor()));
quoteBarView.setBackgroundColor(Util.rgbToArgbColor(contact.getColor())); quoteBarView.setBackgroundColor(Util.rgbToArgbColor(contact.getColor()));
} }
} }
} }
}
private void setQuoteText(@Nullable CharSequence body, @NonNull SlideDeck attachments) { private void setQuoteText(@Nullable CharSequence body, @NonNull SlideDeck attachments) {
if (!TextUtils.isEmpty(body) || !attachments.containsMediaSlide()) { if (!TextUtils.isEmpty(body) || !attachments.containsMediaSlide()) {
@ -233,6 +245,6 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
} }
private int getForwardedColor() { private int getForwardedColor() {
return getResources().getColor(R.color.unknown_sender); return getResources().getColor(hasSticker? R.color.core_dark_05 : R.color.unknown_sender);
} }
} }