|
|
@ -54,7 +54,6 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener
|
|
|
|
|
|
|
|
|
|
|
|
private long id;
|
|
|
|
private long id;
|
|
|
|
private Recipient author;
|
|
|
|
private Recipient author;
|
|
|
|
private Recipient conversation;
|
|
|
|
|
|
|
|
private String body;
|
|
|
|
private String body;
|
|
|
|
private TextView mediaDescriptionText;
|
|
|
|
private TextView mediaDescriptionText;
|
|
|
|
private TextView missingLinkText;
|
|
|
|
private TextView missingLinkText;
|
|
|
@ -155,24 +154,22 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener
|
|
|
|
public void setQuote(GlideRequests glideRequests,
|
|
|
|
public void setQuote(GlideRequests glideRequests,
|
|
|
|
long id,
|
|
|
|
long id,
|
|
|
|
@NonNull Recipient author,
|
|
|
|
@NonNull Recipient author,
|
|
|
|
@NonNull Recipient conversation,
|
|
|
|
|
|
|
|
@Nullable String body,
|
|
|
|
@Nullable String body,
|
|
|
|
boolean originalMissing,
|
|
|
|
boolean originalMissing,
|
|
|
|
@NonNull SlideDeck attachments)
|
|
|
|
@NonNull SlideDeck attachments)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (this.author != null) this.author.removeListener(this);
|
|
|
|
if (this.author != null) this.author.removeListener(this);
|
|
|
|
|
|
|
|
|
|
|
|
this.id = id;
|
|
|
|
this.id = id;
|
|
|
|
this.author = author;
|
|
|
|
this.author = author;
|
|
|
|
this.conversation = conversation;
|
|
|
|
this.body = body;
|
|
|
|
this.body = body;
|
|
|
|
this.attachments = attachments;
|
|
|
|
this.attachments = attachments;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
author.addListener(this);
|
|
|
|
author.addListener(this);
|
|
|
|
setQuoteAuthor(author, conversation);
|
|
|
|
setQuoteAuthor(author);
|
|
|
|
setQuoteText(body, attachments);
|
|
|
|
setQuoteText(body, attachments);
|
|
|
|
setQuoteAttachment(glideRequests, attachments);
|
|
|
|
setQuoteAttachment(glideRequests, attachments);
|
|
|
|
setQuoteMissingFooter(originalMissing, conversation);
|
|
|
|
setQuoteMissingFooter(originalMissing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setTopCornerSizes(boolean topLeftLarge, boolean topRightLarge) {
|
|
|
|
public void setTopCornerSizes(boolean topLeftLarge, boolean topRightLarge) {
|
|
|
@ -194,21 +191,21 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener
|
|
|
|
public void onModified(Recipient recipient) {
|
|
|
|
public void onModified(Recipient recipient) {
|
|
|
|
Util.runOnMain(() -> {
|
|
|
|
Util.runOnMain(() -> {
|
|
|
|
if (recipient == author) {
|
|
|
|
if (recipient == author) {
|
|
|
|
setQuoteAuthor(recipient, conversation);
|
|
|
|
setQuoteAuthor(recipient);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setQuoteAuthor(@NonNull Recipient author, @NonNull Recipient conversation) {
|
|
|
|
private void setQuoteAuthor(@NonNull Recipient author) {
|
|
|
|
boolean outgoing = messageType == MESSAGE_TYPE_OUTGOING;
|
|
|
|
boolean outgoing = messageType != MESSAGE_TYPE_INCOMING;
|
|
|
|
boolean isOwnNumber = Util.isOwnNumber(getContext(), author.getAddress());
|
|
|
|
boolean isOwnNumber = Util.isOwnNumber(getContext(), author.getAddress());
|
|
|
|
|
|
|
|
|
|
|
|
authorView.setText(isOwnNumber ? getContext().getString(R.string.QuoteView_you)
|
|
|
|
authorView.setText(isOwnNumber ? getContext().getString(R.string.QuoteView_you)
|
|
|
|
: author.toShortString());
|
|
|
|
: author.toShortString());
|
|
|
|
|
|
|
|
|
|
|
|
// We use the raw color resource because Android 4.x was struggling with tints here
|
|
|
|
// We use the raw color resource because Android 4.x was struggling with tints here
|
|
|
|
quoteBarView.setImageResource(conversation.getColor().toQuoteBarColorResource(getContext(), outgoing));
|
|
|
|
quoteBarView.setImageResource(author.getColor().toQuoteBarColorResource(getContext(), outgoing));
|
|
|
|
mainView.setBackgroundColor(conversation.getColor().toQuoteBackgroundColor(getContext(), outgoing));
|
|
|
|
mainView.setBackgroundColor(author.getColor().toQuoteBackgroundColor(getContext(), outgoing));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setQuoteText(@Nullable String body, @NonNull SlideDeck attachments) {
|
|
|
|
private void setQuoteText(@Nullable String body, @NonNull SlideDeck attachments) {
|
|
|
@ -271,9 +268,9 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setQuoteMissingFooter(boolean missing, @NonNull Recipient conversation) {
|
|
|
|
private void setQuoteMissingFooter(boolean missing) {
|
|
|
|
footerView.setVisibility(missing ? VISIBLE : GONE);
|
|
|
|
footerView.setVisibility(missing ? VISIBLE : GONE);
|
|
|
|
footerView.setBackgroundColor(conversation.getColor().toQuoteFooterColor(getContext(), messageType == MESSAGE_TYPE_OUTGOING));
|
|
|
|
footerView.setBackgroundColor(author.getColor().toQuoteFooterColor(getContext(), messageType != MESSAGE_TYPE_INCOMING));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getQuoteId() {
|
|
|
|
public long getQuoteId() {
|
|
|
|