mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-04 10:19:15 +02:00
introduce color 'unknown_sender' and use it for forwarded messages, forwarded quotes, quotes with unknown sender
This commit is contained in:
parent
d4ef19b9cf
commit
12e4d6b30e
4 changed files with 28 additions and 15 deletions
|
@ -20,8 +20,8 @@
|
||||||
android:id="@+id/quote_bar"
|
android:id="@+id/quote_bar"
|
||||||
android:layout_width="@dimen/quote_corner_radius_bottom"
|
android:layout_width="@dimen/quote_corner_radius_bottom"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/purple_400"
|
android:background="@color/unknown_sender"
|
||||||
tools:tint="@color/purple_400" />
|
tools:tint="@color/unknown_sender" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -64,4 +64,8 @@
|
||||||
<color name="pinned_bg">#eeeeee</color>
|
<color name="pinned_bg">#eeeeee</color>
|
||||||
<color name="pinned_bg_dark">#222222</color>
|
<color name="pinned_bg_dark">#222222</color>
|
||||||
|
|
||||||
|
<!-- unknown_sender fits in dark mode and lite mode (also other chat/contact colors fit in both modes);
|
||||||
|
unknown_sender is used for the sender-name/quote-bar if the sender is unknown -->
|
||||||
|
<color name="unknown_sender">#ff999999</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -122,7 +122,6 @@ public class ConversationItem extends LinearLayout
|
||||||
|
|
||||||
private int incomingBubbleColor;
|
private int incomingBubbleColor;
|
||||||
private int outgoingBubbleColor;
|
private int outgoingBubbleColor;
|
||||||
private int forwardedTitleColor;
|
|
||||||
|
|
||||||
private final PassthroughClickListener passthroughClickListener = new PassthroughClickListener();
|
private final PassthroughClickListener passthroughClickListener = new PassthroughClickListener();
|
||||||
|
|
||||||
|
@ -265,13 +264,11 @@ public class ConversationItem extends LinearLayout
|
||||||
final int[] attributes = new int[] {
|
final int[] attributes = new int[] {
|
||||||
R.attr.conversation_item_incoming_bubble_color,
|
R.attr.conversation_item_incoming_bubble_color,
|
||||||
R.attr.conversation_item_outgoing_bubble_color,
|
R.attr.conversation_item_outgoing_bubble_color,
|
||||||
R.attr.conversation_item_incoming_text_secondary_color
|
|
||||||
};
|
};
|
||||||
final TypedArray attrs = context.obtainStyledAttributes(attributes);
|
final TypedArray attrs = context.obtainStyledAttributes(attributes);
|
||||||
|
|
||||||
incomingBubbleColor = attrs.getColor(0, Color.WHITE);
|
incomingBubbleColor = attrs.getColor(0, Color.WHITE);
|
||||||
outgoingBubbleColor = attrs.getColor(1, Color.WHITE);
|
outgoingBubbleColor = attrs.getColor(1, Color.WHITE);
|
||||||
forwardedTitleColor = attrs.getColor(2, Color.BLACK);
|
|
||||||
attrs.recycle();
|
attrs.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +638,7 @@ public class ConversationItem extends LinearLayout
|
||||||
private void setGroupMessageStatus() {
|
private void setGroupMessageStatus() {
|
||||||
if (messageRecord.isForwarded()) {
|
if (messageRecord.isForwarded()) {
|
||||||
this.groupSender.setText(context.getString(R.string.forwarded_message));
|
this.groupSender.setText(context.getString(R.string.forwarded_message));
|
||||||
this.groupSender.setTextColor(forwardedTitleColor);
|
this.groupSender.setTextColor(context.getResources().getColor(R.color.unknown_sender));
|
||||||
}
|
}
|
||||||
else if (groupThread && !messageRecord.isOutgoing() && dcContact !=null) {
|
else if (groupThread && !messageRecord.isOutgoing() && dcContact !=null) {
|
||||||
this.groupSender.setText(dcContact.getDisplayName());
|
this.groupSender.setText(dcContact.getDisplayName());
|
||||||
|
|
|
@ -141,15 +141,23 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
||||||
private void setQuoteAuthor(@Nullable Recipient author) {
|
private void setQuoteAuthor(@Nullable Recipient author) {
|
||||||
if (author == null) {
|
if (author == null) {
|
||||||
authorView.setVisibility(GONE);
|
authorView.setVisibility(GONE);
|
||||||
return;
|
quoteBarView.setBackgroundColor(getForwardedColor());
|
||||||
}
|
} else if (quotedMsg.isForwarded()) {
|
||||||
|
|
||||||
DcContact contact = author.getDcContact();
|
|
||||||
if (contact != null) {
|
|
||||||
authorView.setVisibility(VISIBLE);
|
authorView.setVisibility(VISIBLE);
|
||||||
authorView.setText(contact.getDisplayName());
|
authorView.setText(getContext().getString(R.string.forwarded_message));
|
||||||
quoteBarView.setBackgroundColor(contact.getArgbColor());
|
authorView.setTextColor(getForwardedColor());
|
||||||
authorView.setTextColor(contact.getArgbColor());
|
quoteBarView.setBackgroundColor(getForwardedColor());
|
||||||
|
} else {
|
||||||
|
DcContact contact = author.getDcContact();
|
||||||
|
if (contact == null) {
|
||||||
|
authorView.setVisibility(GONE);
|
||||||
|
quoteBarView.setBackgroundColor(getForwardedColor());
|
||||||
|
} else {
|
||||||
|
authorView.setVisibility(VISIBLE);
|
||||||
|
authorView.setText(contact.getDisplayName());
|
||||||
|
authorView.setTextColor(contact.getArgbColor());
|
||||||
|
quoteBarView.setBackgroundColor(contact.getArgbColor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,4 +225,8 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
||||||
public DcMsg getOriginalMsg() {
|
public DcMsg getOriginalMsg() {
|
||||||
return quotedMsg;
|
return quotedMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getForwardedColor() {
|
||||||
|
return getResources().getColor(R.color.unknown_sender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue