From e667c6ee7ed46e2d31d75ace03b47ecbcbaa8f34 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Thu, 29 Oct 2020 10:16:49 +1100 Subject: [PATCH] Make style consistent across platforms --- ...sation_activity_attachment_editor_stub.xml | 4 +-- .../conversation_item_received_audio.xml | 4 +-- res/layout/conversation_item_sent_audio.xml | 4 +-- res/values-notnight-v21/themes.xml | 3 ++- res/values/attrs.xml | 6 +++-- res/values/themes.xml | 4 ++- .../securesms/loki/views/MessageAudioView.kt | 26 +++++++++---------- 7 files changed, 28 insertions(+), 23 deletions(-) diff --git a/res/layout/conversation_activity_attachment_editor_stub.xml b/res/layout/conversation_activity_attachment_editor_stub.xml index 12da06a249..3ee19aac0b 100644 --- a/res/layout/conversation_activity_attachment_editor_stub.xml +++ b/res/layout/conversation_activity_attachment_editor_stub.xml @@ -41,8 +41,8 @@ android:paddingBottom="15dp" app:widgetBackground="?conversation_item_bubble_background" app:foregroundTintColor="?android:colorControlNormal" - app:backgroundTintColor="?conversation_item_bubble_background" - app:waveformFillColor="?conversation_item_audio_seek_bar_color"/> + app:waveformFillColor="?conversation_item_audio_seek_bar_color_outgoing" + app:waveformBackgroundColor="?conversation_item_audio_seek_bar_background_color"/> diff --git a/res/layout/conversation_item_sent_audio.xml b/res/layout/conversation_item_sent_audio.xml index 7a28a82dad..cb7889fa1f 100644 --- a/res/layout/conversation_item_sent_audio.xml +++ b/res/layout/conversation_item_sent_audio.xml @@ -6,6 +6,6 @@ android:layout_width="210dp" android:layout_height="wrap_content" app:foregroundTintColor="?android:colorControlNormal" - app:backgroundTintColor="?message_sent_background_color" - app:waveformFillColor="?conversation_item_audio_seek_bar_color" + app:waveformFillColor="?conversation_item_audio_seek_bar_color_outgoing" + app:waveformBackgroundColor="?conversation_item_audio_seek_bar_background_color" android:visibility="gone"/> diff --git a/res/values-notnight-v21/themes.xml b/res/values-notnight-v21/themes.xml index b49a5cc706..2807ff2ed7 100644 --- a/res/values-notnight-v21/themes.xml +++ b/res/values-notnight-v21/themes.xml @@ -28,7 +28,8 @@ @drawable/ic_outline_info_24 - ?colorControlNormal + @color/accent + @color/white diff --git a/src/org/thoughtcrime/securesms/loki/views/MessageAudioView.kt b/src/org/thoughtcrime/securesms/loki/views/MessageAudioView.kt index 2262578ead..3cccb6f4b8 100644 --- a/src/org/thoughtcrime/securesms/loki/views/MessageAudioView.kt +++ b/src/org/thoughtcrime/securesms/loki/views/MessageAudioView.kt @@ -30,6 +30,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory import org.thoughtcrime.securesms.events.PartProgressEvent import org.thoughtcrime.securesms.logging.Log import org.thoughtcrime.securesms.loki.api.PrepareAttachmentAudioExtrasJob +import org.thoughtcrime.securesms.loki.utilities.getColorWithID import org.thoughtcrime.securesms.mms.AudioSlide import org.thoughtcrime.securesms.mms.SlideClickListener import java.io.IOException @@ -115,8 +116,8 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener { if (attrs != null) { val typedArray = context.theme.obtainStyledAttributes(attrs, R.styleable.MessageAudioView, 0, 0) setTint(typedArray.getColor(R.styleable.MessageAudioView_foregroundTintColor, Color.WHITE), - typedArray.getColor(R.styleable.MessageAudioView_backgroundTintColor, Color.WHITE), - typedArray.getColor(R.styleable.MessageAudioView_waveformFillColor, Color.WHITE)) + typedArray.getColor(R.styleable.MessageAudioView_waveformFillColor, Color.WHITE), + typedArray.getColor(R.styleable.MessageAudioView_waveformBackgroundColor, Color.WHITE)) container.setBackgroundColor(typedArray.getColor(R.styleable.MessageAudioView_widgetBackground, Color.TRANSPARENT)) typedArray.recycle() } @@ -182,23 +183,22 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener { downloadListener = listener } - fun setTint(@ColorInt foregroundTint: Int, @ColorInt backgroundTint: Int, @ColorInt waveformFill: Int) { - playButton.backgroundTintList = ColorStateList.valueOf(foregroundTint) - playButton.imageTintList = ColorStateList.valueOf(backgroundTint) - pauseButton.backgroundTintList = ColorStateList.valueOf(foregroundTint) - pauseButton.imageTintList = ColorStateList.valueOf(backgroundTint) + fun setTint(@ColorInt foregroundTint: Int, @ColorInt waveformFill: Int, @ColorInt waveformBackground: Int) { + playButton.backgroundTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.white, context.theme)) + playButton.imageTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.black, context.theme)) + pauseButton.backgroundTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.white, context.theme)) + pauseButton.imageTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.black, context.theme)) downloadButton.setColorFilter(foregroundTint, PorterDuff.Mode.SRC_IN) - downloadProgress.backgroundTintList = ColorStateList.valueOf(foregroundTint) - downloadProgress.progressTintList = ColorStateList.valueOf(backgroundTint) - downloadProgress.indeterminateTintList = ColorStateList.valueOf(backgroundTint) + downloadProgress.backgroundTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.white, context.theme)) + downloadProgress.progressTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.black, context.theme)) + downloadProgress.indeterminateTintList = ColorStateList.valueOf(resources.getColorWithID(R.color.black, context.theme)) totalDuration.setTextColor(foregroundTint) - // Seek bar's progress color is set from the XML template. Whereas the background is computed. seekBar.barProgressColor = waveformFill - seekBar.barBackgroundColor = ColorUtils.blendARGB(foregroundTint, backgroundTint, 0.75f) + seekBar.barBackgroundColor = waveformBackground } override fun onPlayerStart(player: AudioSlidePlayer) { @@ -309,7 +309,7 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener { private var active = false companion object { - private const val UPDATE_PERIOD = 350L // In milliseconds. + private const val UPDATE_PERIOD = 250L // In milliseconds. private val random = Random() }