mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Switch the conversation color back to incoming messages.
This commit is contained in:
parent
b1d653a230
commit
710fa4a6f0
@ -53,8 +53,8 @@
|
|||||||
android:paddingLeft="@dimen/message_bubble_horizontal_padding"
|
android:paddingLeft="@dimen/message_bubble_horizontal_padding"
|
||||||
android:paddingRight="@dimen/message_bubble_horizontal_padding"
|
android:paddingRight="@dimen/message_bubble_horizontal_padding"
|
||||||
android:background="@drawable/message_bubble_background_sent_alone"
|
android:background="@drawable/message_bubble_background_sent_alone"
|
||||||
app:doc_titleColor="?attr/conversation_item_received_text_primary_color"
|
app:doc_titleColor="?attr/conversation_item_sent_text_primary_color"
|
||||||
app:doc_captionColor="?attr/conversation_item_received_text_secondary_color"/>
|
app:doc_captionColor="?attr/conversation_item_sent_text_secondary_color"/>
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.components.RemovableEditableMediaView>
|
</org.thoughtcrime.securesms.components.RemovableEditableMediaView>
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:message_type="preview"
|
app:message_type="preview"
|
||||||
app:quote_colorPrimary="?attr/conversation_item_received_text_primary_color"
|
app:quote_colorPrimary="?attr/conversation_item_sent_text_primary_color"
|
||||||
app:quote_colorSecondary="?attr/conversation_item_received_text_primary_color"
|
app:quote_colorSecondary="?attr/conversation_item_sent_text_primary_color"
|
||||||
tools:visibility="visible"/>
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
@ -127,7 +127,6 @@
|
|||||||
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
|
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:alpha="0.8"
|
|
||||||
app:footer_text_color="?attr/conversation_item_sent_text_secondary_color"
|
app:footer_text_color="?attr/conversation_item_sent_text_secondary_color"
|
||||||
app:footer_icon_color="?attr/conversation_item_sent_icon_color"/>
|
app:footer_icon_color="?attr/conversation_item_sent_icon_color"/>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
android:padding="15dp"
|
android:padding="15dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:longClickable="false"
|
android:longClickable="false"
|
||||||
android:textColor="?conversation_item_sent_text_primary_color"
|
android:textColor="?conversation_item_received_text_primary_color"
|
||||||
android:drawableLeft="@drawable/ic_file_download_white_36dp"
|
android:drawableLeft="@drawable/ic_file_download_white_36dp"
|
||||||
android:textSize="16dp"
|
android:textSize="16dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<color name="core_grey_15">#d5d6d6</color>
|
<color name="core_grey_15">#d5d6d6</color>
|
||||||
<color name="core_grey_25">#bbbdbe</color>
|
<color name="core_grey_25">#bbbdbe</color>
|
||||||
<color name="core_grey_45">#898a8c</color>
|
<color name="core_grey_45">#898a8c</color>
|
||||||
<color name="core_grey_60">#636467</color>
|
<color name="core_grey_60">#6b6d70</color>
|
||||||
<color name="core_grey_75">#3d3e44</color>
|
<color name="core_grey_75">#3d3e44</color>
|
||||||
<color name="core_grey_85">#23252a</color>
|
<color name="core_grey_85">#23252a</color>
|
||||||
<color name="core_grey_90">#17191d</color>
|
<color name="core_grey_90">#17191d</color>
|
||||||
|
@ -174,7 +174,7 @@
|
|||||||
<item name="android:background">@null</item>
|
<item name="android:background">@null</item>
|
||||||
<item name="android:maxLines">4</item>
|
<item name="android:maxLines">4</item>
|
||||||
<item name="android:maxLength">2000</item>
|
<item name="android:maxLength">2000</item>
|
||||||
<item name="android:textColor">?conversation_item_received_text_primary_color</item>
|
<item name="android:textColor">?conversation_item_sent_text_primary_color</item>
|
||||||
<item name="android:capitalize">sentences</item>
|
<item name="android:capitalize">sentences</item>
|
||||||
<item name="android:autoText">true</item>
|
<item name="android:autoText">true</item>
|
||||||
<item name="android:gravity">center_vertical</item>
|
<item name="android:gravity">center_vertical</item>
|
||||||
|
@ -188,12 +188,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<item name="conversation_item_bubble_background">@color/core_grey_05</item>
|
<item name="conversation_item_bubble_background">@color/core_grey_05</item>
|
||||||
<item name="conversation_item_sent_text_primary_color">@color/core_white</item>
|
<item name="conversation_item_sent_text_primary_color">@color/core_grey_90</item>
|
||||||
<item name="conversation_item_sent_text_secondary_color">@color/core_white</item>
|
<item name="conversation_item_sent_text_secondary_color">@color/core_grey_60</item>
|
||||||
<item name="conversation_item_sent_icon_color">@color/core_white</item>
|
<item name="conversation_item_sent_icon_color">@color/core_grey_60</item>
|
||||||
<item name="conversation_item_sent_text_indicator_tab_color">#99000000</item>
|
<item name="conversation_item_sent_text_indicator_tab_color">#99000000</item>
|
||||||
<item name="conversation_item_received_text_primary_color">@color/core_grey_90</item>
|
<item name="conversation_item_received_text_primary_color">@color/core_white</item>
|
||||||
<item name="conversation_item_received_text_secondary_color">@color/core_grey_60</item>
|
<item name="conversation_item_received_text_secondary_color">@color/core_white</item>
|
||||||
<item name="conversation_item_update_text_color">@color/core_grey_60</item>
|
<item name="conversation_item_update_text_color">@color/core_grey_60</item>
|
||||||
<item name="conversation_item_last_seen_text_color">@color/core_grey_90</item>
|
<item name="conversation_item_last_seen_text_color">@color/core_grey_90</item>
|
||||||
<item name="conversation_item_last_seen_line_color">@color/core_grey_60</item>
|
<item name="conversation_item_last_seen_line_color">@color/core_grey_60</item>
|
||||||
@ -293,8 +293,8 @@
|
|||||||
|
|
||||||
<item name="conversation_item_bubble_background">@color/core_grey_75</item>
|
<item name="conversation_item_bubble_background">@color/core_grey_75</item>
|
||||||
<item name="conversation_item_sent_text_primary_color">@color/core_grey_05</item>
|
<item name="conversation_item_sent_text_primary_color">@color/core_grey_05</item>
|
||||||
<item name="conversation_item_sent_text_secondary_color">@color/core_grey_05</item>
|
<item name="conversation_item_sent_text_secondary_color">@color/core_grey_25</item>
|
||||||
<item name="conversation_item_sent_icon_color">@color/core_grey_05</item>
|
<item name="conversation_item_sent_icon_color">@color/core_grey_25</item>
|
||||||
<item name="conversation_item_sent_text_indicator_tab_color">#99ffffff</item>
|
<item name="conversation_item_sent_text_indicator_tab_color">#99ffffff</item>
|
||||||
<item name="conversation_item_received_text_primary_color">@color/core_grey_05</item>
|
<item name="conversation_item_received_text_primary_color">@color/core_grey_05</item>
|
||||||
<item name="conversation_item_received_text_secondary_color">@color/core_grey_25</item>
|
<item name="conversation_item_received_text_secondary_color">@color/core_grey_25</item>
|
||||||
|
@ -2246,14 +2246,12 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
inputPanel.setQuote(GlideApp.with(this),
|
inputPanel.setQuote(GlideApp.with(this),
|
||||||
messageRecord.getDateSent(),
|
messageRecord.getDateSent(),
|
||||||
author,
|
author,
|
||||||
recipient,
|
|
||||||
body,
|
body,
|
||||||
slideDeck);
|
slideDeck);
|
||||||
} else {
|
} else {
|
||||||
inputPanel.setQuote(GlideApp.with(this),
|
inputPanel.setQuote(GlideApp.with(this),
|
||||||
messageRecord.getDateSent(),
|
messageRecord.getDateSent(),
|
||||||
author,
|
author,
|
||||||
recipient,
|
|
||||||
messageRecord.getBody(),
|
messageRecord.getBody(),
|
||||||
messageRecord.isMms() ? ((MmsMessageRecord) messageRecord).getSlideDeck() : new SlideDeck());
|
messageRecord.isMms() ? ((MmsMessageRecord) messageRecord).getSlideDeck() : new SlideDeck());
|
||||||
}
|
}
|
||||||
|
@ -303,9 +303,8 @@ public class ConversationItem extends LinearLayout
|
|||||||
private void setBubbleState(MessageRecord messageRecord) {
|
private void setBubbleState(MessageRecord messageRecord) {
|
||||||
if (messageRecord.isOutgoing()) {
|
if (messageRecord.isOutgoing()) {
|
||||||
bodyBubble.getBackground().setColorFilter(defaultBubbleColor, PorterDuff.Mode.MULTIPLY);
|
bodyBubble.getBackground().setColorFilter(defaultBubbleColor, PorterDuff.Mode.MULTIPLY);
|
||||||
bodyBubble.getBackground().setColorFilter(messageRecord.getRecipient().getColor().toConversationColor(context), PorterDuff.Mode.MULTIPLY);
|
|
||||||
} else {
|
} else {
|
||||||
bodyBubble.getBackground().setColorFilter(defaultBubbleColor, PorterDuff.Mode.MULTIPLY);
|
bodyBubble.getBackground().setColorFilter(messageRecord.getRecipient().getColor().toConversationColor(context), PorterDuff.Mode.MULTIPLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audioViewStub.resolved()) {
|
if (audioViewStub.resolved()) {
|
||||||
@ -315,13 +314,13 @@ public class ConversationItem extends LinearLayout
|
|||||||
|
|
||||||
private void setAudioViewTint(MessageRecord messageRecord, Recipient recipient) {
|
private void setAudioViewTint(MessageRecord messageRecord, Recipient recipient) {
|
||||||
if (messageRecord.isOutgoing()) {
|
if (messageRecord.isOutgoing()) {
|
||||||
audioViewStub.get().setTint(Color.WHITE, recipient.getColor().toConversationColor(context));
|
|
||||||
} else {
|
|
||||||
if (DynamicTheme.LIGHT.equals(TextSecurePreferences.getTheme(context))) {
|
if (DynamicTheme.LIGHT.equals(TextSecurePreferences.getTheme(context))) {
|
||||||
audioViewStub.get().setTint(getContext().getResources().getColor(R.color.core_grey_60), defaultBubbleColor);
|
audioViewStub.get().setTint(getContext().getResources().getColor(R.color.core_grey_60), defaultBubbleColor);
|
||||||
} else {
|
} else {
|
||||||
audioViewStub.get().setTint(Color.WHITE, defaultBubbleColor);
|
audioViewStub.get().setTint(Color.WHITE, defaultBubbleColor);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
audioViewStub.get().setTint(Color.WHITE, recipient.getColor().toConversationColor(context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,7 +598,7 @@ public class ConversationItem extends LinearLayout
|
|||||||
if (current.isMms() && !current.isMmsNotification() && ((MediaMmsMessageRecord)current).getQuote() != null) {
|
if (current.isMms() && !current.isMmsNotification() && ((MediaMmsMessageRecord)current).getQuote() != null) {
|
||||||
Quote quote = ((MediaMmsMessageRecord)current).getQuote();
|
Quote quote = ((MediaMmsMessageRecord)current).getQuote();
|
||||||
assert quote != null;
|
assert quote != null;
|
||||||
quoteView.setQuote(glideRequests, quote.getId(), Recipient.from(context, quote.getAuthor(), true), conversationRecipient, quote.getText(), quote.isOriginalMissing(), quote.getAttachment());
|
quoteView.setQuote(glideRequests, quote.getId(), Recipient.from(context, quote.getAuthor(), true), quote.getText(), quote.isOriginalMissing(), quote.getAttachment());
|
||||||
quoteView.setVisibility(View.VISIBLE);
|
quoteView.setVisibility(View.VISIBLE);
|
||||||
quoteView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
quoteView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||||
|
|
||||||
|
@ -82,17 +82,29 @@ public enum MaterialColor {
|
|||||||
|
|
||||||
public @ColorRes int toQuoteBarColorResource(@NonNull Context context, boolean outgoing) {
|
public @ColorRes int toQuoteBarColorResource(@NonNull Context context, boolean outgoing) {
|
||||||
if (outgoing) {
|
if (outgoing) {
|
||||||
return isDarkTheme(context) ? R.color.core_black : R.color.core_white;
|
return isDarkTheme(context) ? tintColor : shadeColor ;
|
||||||
}
|
}
|
||||||
return isDarkTheme(context) ? tintColor : shadeColor;
|
return R.color.core_white;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @ColorInt int toQuoteBackgroundColor(@NonNull Context context, boolean outgoing) {
|
public @ColorInt int toQuoteBackgroundColor(@NonNull Context context, boolean outgoing) {
|
||||||
return context.getResources().getColor(isDarkTheme(context) ? shadeColor : tintColor);
|
if (outgoing) {
|
||||||
|
int color = toConversationColor(context);
|
||||||
|
int alpha = isDarkTheme(context) ? (int) (0.2 * 255) : (int) (0.4 * 255);
|
||||||
|
return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
|
||||||
|
}
|
||||||
|
return context.getResources().getColor(isDarkTheme(context) ? R.color.transparent_black_70
|
||||||
|
: R.color.transparent_white_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @ColorInt int toQuoteFooterColor(@NonNull Context context, boolean outgoing) {
|
public @ColorInt int toQuoteFooterColor(@NonNull Context context, boolean outgoing) {
|
||||||
return context.getResources().getColor(isDarkTheme(context) ? tintColor : shadeColor);
|
if (outgoing) {
|
||||||
|
int color = toConversationColor(context);
|
||||||
|
int alpha = isDarkTheme(context) ? (int) (0.4 * 255) : (int) (0.6 * 255);
|
||||||
|
return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
|
||||||
|
}
|
||||||
|
return context.getResources().getColor(isDarkTheme(context) ? R.color.transparent_black_90
|
||||||
|
: R.color.transparent_white_bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean represents(Context context, int colorValue) {
|
public boolean represents(Context context, int colorValue) {
|
||||||
|
@ -120,8 +120,8 @@ public class InputPanel extends LinearLayout
|
|||||||
composeText.setMediaListener(listener);
|
composeText.setMediaListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQuote(@NonNull GlideRequests glideRequests, long id, @NonNull Recipient author, @NonNull Recipient conversation, @NonNull String body, @NonNull SlideDeck attachments) {
|
public void setQuote(@NonNull GlideRequests glideRequests, long id, @NonNull Recipient author, @NonNull String body, @NonNull SlideDeck attachments) {
|
||||||
this.quoteView.setQuote(glideRequests, id, author, conversation, body, false, attachments);
|
this.quoteView.setQuote(glideRequests, id, author, body, false, attachments);
|
||||||
this.quoteView.setVisibility(View.VISIBLE);
|
this.quoteView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user