Switch the conversation color back to incoming messages.

This commit is contained in:
Greyson Parrelli 2018-10-09 12:52:32 -07:00
parent b1d653a230
commit 710fa4a6f0
12 changed files with 49 additions and 44 deletions

View File

@ -53,8 +53,8 @@
android:paddingLeft="@dimen/message_bubble_horizontal_padding"
android:paddingRight="@dimen/message_bubble_horizontal_padding"
android:background="@drawable/message_bubble_background_sent_alone"
app:doc_titleColor="?attr/conversation_item_received_text_primary_color"
app:doc_captionColor="?attr/conversation_item_received_text_secondary_color"/>
app:doc_titleColor="?attr/conversation_item_sent_text_primary_color"
app:doc_captionColor="?attr/conversation_item_sent_text_secondary_color"/>
</org.thoughtcrime.securesms.components.RemovableEditableMediaView>

View File

@ -41,8 +41,8 @@
android:layout_marginTop="6dp"
android:visibility="gone"
app:message_type="preview"
app:quote_colorPrimary="?attr/conversation_item_received_text_primary_color"
app:quote_colorSecondary="?attr/conversation_item_received_text_primary_color"
app:quote_colorPrimary="?attr/conversation_item_sent_text_primary_color"
app:quote_colorSecondary="?attr/conversation_item_sent_text_primary_color"
tools:visibility="visible"/>
<FrameLayout

View File

@ -127,7 +127,6 @@
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
android:clipChildren="false"
android:clipToPadding="false"
android:alpha="0.8"
app:footer_text_color="?attr/conversation_item_sent_text_secondary_color"
app:footer_icon_color="?attr/conversation_item_sent_icon_color"/>

View File

@ -18,7 +18,7 @@
android:padding="15dp"
android:gravity="center"
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:textSize="16dp"
android:visibility="gone"

View File

@ -13,7 +13,7 @@
<color name="core_grey_15">#d5d6d6</color>
<color name="core_grey_25">#bbbdbe</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_85">#23252a</color>
<color name="core_grey_90">#17191d</color>

View File

@ -174,7 +174,7 @@
<item name="android:background">@null</item>
<item name="android:maxLines">4</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:autoText">true</item>
<item name="android:gravity">center_vertical</item>

View File

@ -188,12 +188,12 @@
<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_secondary_color">@color/core_white</item>
<item name="conversation_item_sent_icon_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_grey_60</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_received_text_primary_color">@color/core_grey_90</item>
<item name="conversation_item_received_text_secondary_color">@color/core_grey_60</item>
<item name="conversation_item_received_text_primary_color">@color/core_white</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_last_seen_text_color">@color/core_grey_90</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_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_icon_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_25</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_secondary_color">@color/core_grey_25</item>

View File

@ -2246,14 +2246,12 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
inputPanel.setQuote(GlideApp.with(this),
messageRecord.getDateSent(),
author,
recipient,
body,
slideDeck);
} else {
inputPanel.setQuote(GlideApp.with(this),
messageRecord.getDateSent(),
author,
recipient,
messageRecord.getBody(),
messageRecord.isMms() ? ((MmsMessageRecord) messageRecord).getSlideDeck() : new SlideDeck());
}

View File

@ -303,9 +303,8 @@ public class ConversationItem extends LinearLayout
private void setBubbleState(MessageRecord messageRecord) {
if (messageRecord.isOutgoing()) {
bodyBubble.getBackground().setColorFilter(defaultBubbleColor, PorterDuff.Mode.MULTIPLY);
bodyBubble.getBackground().setColorFilter(messageRecord.getRecipient().getColor().toConversationColor(context), PorterDuff.Mode.MULTIPLY);
} else {
bodyBubble.getBackground().setColorFilter(defaultBubbleColor, PorterDuff.Mode.MULTIPLY);
bodyBubble.getBackground().setColorFilter(messageRecord.getRecipient().getColor().toConversationColor(context), PorterDuff.Mode.MULTIPLY);
}
if (audioViewStub.resolved()) {
@ -315,13 +314,13 @@ public class ConversationItem extends LinearLayout
private void setAudioViewTint(MessageRecord messageRecord, Recipient recipient) {
if (messageRecord.isOutgoing()) {
audioViewStub.get().setTint(Color.WHITE, recipient.getColor().toConversationColor(context));
} else {
if (DynamicTheme.LIGHT.equals(TextSecurePreferences.getTheme(context))) {
audioViewStub.get().setTint(getContext().getResources().getColor(R.color.core_grey_60), defaultBubbleColor);
} else {
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) {
Quote quote = ((MediaMmsMessageRecord)current).getQuote();
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.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;

View File

@ -82,17 +82,29 @@ public enum MaterialColor {
public @ColorRes int toQuoteBarColorResource(@NonNull Context context, boolean 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) {
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) {
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) {

View File

@ -120,8 +120,8 @@ public class InputPanel extends LinearLayout
composeText.setMediaListener(listener);
}
public void setQuote(@NonNull GlideRequests glideRequests, long id, @NonNull Recipient author, @NonNull Recipient conversation, @NonNull String body, @NonNull SlideDeck attachments) {
this.quoteView.setQuote(glideRequests, id, author, conversation, body, false, attachments);
public void setQuote(@NonNull GlideRequests glideRequests, long id, @NonNull Recipient author, @NonNull String body, @NonNull SlideDeck attachments) {
this.quoteView.setQuote(glideRequests, id, author, body, false, attachments);
this.quoteView.setVisibility(View.VISIBLE);
}

View File

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