Audio view and message bubbles properly themed.

This commit is contained in:
Anton Chekulaev 2020-08-24 18:38:48 +10:00
parent afe90200f1
commit 5e5b88148d
17 changed files with 63 additions and 33 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<solid android:color="#99ffffff" />
<solid android:color="?android:colorBackground" />
</shape>

View File

@ -0,0 +1,5 @@
<vector android:height="48dp" android:tint="?attr/colorControlNormal"
android:viewportHeight="24" android:viewportWidth="24"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,16L9,16L9,8h2v8zM15,16h-2L13,8h2v8z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="48dp" android:tint="?attr/colorControlNormal"
android:viewportHeight="24" android:viewportWidth="24"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,16.5v-9l6,4.5 -6,4.5z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="12"
android:viewportHeight="12"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,1C3.24,1 1,3.24 1,6 1,8.76 3.24,11 6,11 8.76,11 11,8.76 11,6 11,3.24 8.76,1 6,1ZM4.8584,3.8105H7.1313V6.0337H8.708L5.9854,8.7563 3.2632,6.0337h1.5952z" />
</vector>

View File

@ -39,10 +39,10 @@
android:clickable="true"
android:visibility="gone"
android:background="@drawable/circle_touch_highlight_background"
android:src="@drawable/ic_play_circle_fill_white_48dp"
android:src="@drawable/ic_baseline_play_circle_filled_48"
android:scaleType="centerInside"
tools:visibility="gone"
android:contentDescription="@string/audio_view__play_accessibility_description"/>
android:contentDescription="@string/audio_view__play_accessibility_description"
tools:visibility="visible"/>
<ImageView android:id="@+id/pause"
android:layout_width="wrap_content"
@ -52,9 +52,10 @@
android:clickable="true"
android:visibility="gone"
android:background="@drawable/circle_touch_highlight_background"
android:src="@drawable/ic_pause_circle_fill_white_48dp"
android:src="@drawable/ic_baseline_pause_circle_filled_48"
android:scaleType="centerInside"
android:contentDescription="@string/audio_view__pause_accessibility_description"/>
android:contentDescription="@string/audio_view__pause_accessibility_description"
tools:visibility="gone"/>
<ImageView android:id="@+id/download"
android:layout_width="wrap_content"
@ -63,8 +64,9 @@
android:clickable="true"
android:visibility="gone"
android:background="@drawable/circle_touch_highlight_background"
android:src="@drawable/ic_download_circle_fill_white_48dp"
android:contentDescription="@string/audio_view__download_accessibility_description"/>
android:src="@drawable/ic_download_circle_filled_48"
android:contentDescription="@string/audio_view__download_accessibility_description"
tools:visibility="gone"/>
</org.thoughtcrime.securesms.components.AnimatingToggle>

View File

@ -30,7 +30,7 @@
app:minWidth="100dp"
app:maxWidth="300dp"
app:minHeight="100dp"
app:maxHeight="300dp" />
app:maxHeight="300dp"/>
<org.thoughtcrime.securesms.components.AudioView
android:id="@+id/attachment_audio"
@ -40,7 +40,7 @@
android:paddingTop="15dp"
android:paddingBottom="15dp"
app:widgetBackground="?conversation_item_bubble_background"
app:foregroundTintColor="@color/grey_500"
app:foregroundTintColor="?android:colorControlNormal"
app:backgroundTintColor="?conversation_item_bubble_background"/>
<org.thoughtcrime.securesms.components.DocumentView

View File

@ -7,6 +7,6 @@
android:layout_width="210dp"
android:layout_height="wrap_content"
android:visibility="gone"
app:foregroundTintColor="@color/white"
app:backgroundTintColor="@color/blue_500"
app:foregroundTintColor="?android:colorControlNormal"
app:backgroundTintColor="?message_received_background_color"
tools:visibility="visible"/>

View File

@ -5,6 +5,6 @@
android:id="@+id/audio_view"
android:layout_width="210dp"
android:layout_height="wrap_content"
app:foregroundTintColor="@color/black"
app:backgroundTintColor="@color/white"
app:foregroundTintColor="?android:colorControlNormal"
app:backgroundTintColor="?message_sent_background_color"
android:visibility="gone"/>

View File

@ -174,13 +174,12 @@
<ImageView
android:id="@+id/quote_dismiss"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginEnd="6dp"
android:layout_marginTop="6dp"
android:layout_gravity="top|end"
android:background="@drawable/dismiss_background"
android:src="@drawable/ic_close_white_18dp"
android:tint="#99FFFFFF" />
android:src="@drawable/ic_baseline_clear_24"/>
</merge>

View File

@ -15,8 +15,6 @@
<color name="dialog_border">#212121</color>
<color name="compose_view_background">#FCFCFC</color>
<color name="compose_text_view_background">#EDEDED</color>
<color name="received_message_background">#F5F5F5</color>
<color name="sent_message_background">@color/accent</color>
<color name="new_conversation_button_collapsed_background">#F5F5F5</color>
<color name="pn_option_background">#FCFCFC</color>
<color name="fake_chat_bubble_background">#F5F5F5</color>

View File

@ -8,6 +8,9 @@
<item name="home_gradient_start">#00FFFFFF</item>
<item name="home_gradient_end">#FFFFFFFF</item>
<item name="message_received_background_color">#F5F5F5</item>
<item name="message_sent_background_color">?colorAccent</item>
</style>
<style name="TextSecure.DarkNoActionBar" parent="@style/TextSecure.BaseDarkNoActionBar">
@ -94,7 +97,7 @@
<item name="emoji_category_emoticons">@drawable/ic_emoji_emoticon_light_20</item>
<item name="emoji_variation_selector_background">@drawable/emoji_variation_selector_background_light</item>
<item name="conversation_item_bubble_background">@color/sent_message_background</item>
<item name="conversation_item_bubble_background">?message_sent_background_color</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>

View File

@ -157,6 +157,9 @@
<attr name="home_gradient_start" format="color|reference" />
<attr name="home_gradient_end" format="color|reference" />
<attr name="message_received_background_color" format="color|reference" />
<attr name="message_sent_background_color" format="color|reference" />
<declare-styleable name="CustomDefaultPreference">
<attr name="custom_pref_toggle" format="string"/>
</declare-styleable>

View File

@ -22,8 +22,6 @@
<color name="progress_bar_background">#0AFFFFFF</color>
<color name="compose_view_background">#1B1B1B</color>
<color name="compose_text_view_background">#141414</color>
<color name="received_message_background">#222325</color>
<color name="sent_message_background">#3F4146</color>
<color name="quote_not_found_background">#99FFFFFF</color>
<color name="new_conversation_button_collapsed_background">#1F1F1F</color>
<color name="pn_option_background">#1B1B1B</color>

View File

@ -43,6 +43,9 @@
<item name="home_gradient_start">#00000000</item>
<item name="home_gradient_end">#FF000000</item>
<item name="message_received_background_color">#222325</item>
<item name="message_sent_background_color">#3F4146</item>
<item name="menu_accept_icon">@drawable/ic_baseline_done_24</item>
<item name="menu_trash_icon">@drawable/ic_baseline_delete_24</item>
<item name="menu_block_icon">@drawable/ic_baseline_block_24</item>
@ -279,7 +282,7 @@
<item name="emoji_category_emoticons">@drawable/ic_emoji_emoticon_light_20</item>
<item name="emoji_variation_selector_background">@drawable/emoji_variation_selector_background_light</item>
<item name="conversation_item_bubble_background">@color/sent_message_background</item>
<item name="conversation_item_bubble_background">?message_sent_background_color</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>
@ -414,7 +417,7 @@
<item name="conversation_group_member_name">#99ffffff</item>
<item name="conversation_item_bubble_background">@color/sent_message_background</item>
<item name="conversation_item_bubble_background">?message_sent_background_color</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_25</item>
<item name="conversation_item_sent_icon_color">@color/core_grey_25</item>

View File

@ -10,6 +10,7 @@ import android.widget.LinearLayout;
import org.thoughtcrime.securesms.mms.GlideRequests;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.ThemeUtil;
import java.util.List;
@ -41,7 +42,10 @@ public class ConversationTypingView extends LinearLayout {
}
Recipient typist = typists.get(0);
bubble.getBackground().setColorFilter(getResources().getColor(R.color.received_message_background), PorterDuff.Mode.MULTIPLY);
bubble.getBackground().setColorFilter(
ThemeUtil.getThemedColor(getContext(), R.attr.message_received_background_color),
PorterDuff.Mode.MULTIPLY);
if (isGroupThread) {
avatar.setAvatar(glideRequests, typist, false);

View File

@ -210,7 +210,8 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener
// We use the raw color resource because Android 4.x was struggling with tints here
quoteBarView.setImageResource(R.color.accent);
mainView.setBackgroundColor(getResources().getColor(outgoing ? R.color.received_message_background : R.color.sent_message_background));
mainView.setBackgroundColor(ThemeUtil.getThemedColor(getContext(),
outgoing ? R.attr.message_received_background_color : R.attr.message_sent_background_color));
}
private void setQuoteText(@Nullable String body, @NonNull SlideDeck attachments) {

View File

@ -352,11 +352,10 @@ public class ConversationItem extends LinearLayout
/// MessageRecord Attribute Parsers
private void setBubbleState(MessageRecord messageRecord) {
if (messageRecord.isOutgoing()) {
bodyBubble.getBackground().setColorFilter(getResources().getColor(R.color.sent_message_background), PorterDuff.Mode.MULTIPLY);
} else {
bodyBubble.getBackground().setColorFilter(getResources().getColor(R.color.received_message_background), PorterDuff.Mode.MULTIPLY);
}
int bubbleColor = ThemeUtil.getThemedColor(getContext(), messageRecord.isOutgoing() ?
R.attr.message_sent_background_color :
R.attr.message_received_background_color);
bodyBubble.getBackground().setColorFilter(bubbleColor, PorterDuff.Mode.MULTIPLY);
if (audioViewStub.resolved()) {
setAudioViewTint(messageRecord, this.conversationRecipient);
@ -364,7 +363,7 @@ public class ConversationItem extends LinearLayout
}
private void setAudioViewTint(MessageRecord messageRecord, Recipient recipient) {
audioViewStub.get().setTint(Color.WHITE, getResources().getColor(R.color.action_bar_background));
// audioViewStub.get().setTint(Color.WHITE, getResources().getColor(R.color.action_bar_background));
}
private void setInteractionState(MessageRecord messageRecord, boolean pulseHighlight) {