theme outgoing voice message seekbar

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-07-28 00:08:19 +02:00
parent b7006230b8
commit e9d304a79b
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
2 changed files with 20 additions and 5 deletions

View File

@ -91,13 +91,19 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
colorizeMessageBubble(message) colorizeMessageBubble(message)
itemView.isSelected = false itemView.isSelected = false
binding.messageTime.setTextColor(context!!.resources.getColor(R.color.white60)) binding.messageTime.setTextColor(
ColorUtils.setAlphaComponent(
serverTheme.colorText,
ALPHA_60_INT
)
)
// parent message handling // parent message handling
setParentMessageDataOnMessageItem(message) setParentMessageDataOnMessageItem(message)
updateDownloadState(message) updateDownloadState(message)
binding.seekbar.max = message.voiceMessageDuration binding.seekbar.max = message.voiceMessageDuration
viewThemeUtils.themeHorizontalSeekBar(binding.seekbar, serverTheme.colorText)
handleIsPlayingVoiceMessageState(message) handleIsPlayingVoiceMessageState(message)
@ -135,8 +141,8 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
readStatusDrawableInt?.let { drawableInt -> readStatusDrawableInt?.let { drawableInt ->
AppCompatResources.getDrawable(context!!, drawableInt)?.let { AppCompatResources.getDrawable(context!!, drawableInt)?.let {
it.setColorFilter(context?.resources!!.getColor(R.color.white60), PorterDuff.Mode.SRC_ATOP)
binding.checkMark.setImageDrawable(it) binding.checkMark.setImageDrawable(it)
viewThemeUtils.colorImageViewText(binding.checkMark)
} }
} }
@ -159,6 +165,7 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
context!!, context!!,
R.drawable.ic_baseline_play_arrow_voice_message_24 R.drawable.ic_baseline_play_arrow_voice_message_24
) )
binding.playPauseBtn.icon.setColorFilter(serverTheme.colorText, PorterDuff.Mode.SRC_ATOP)
binding.seekbar.progress = SEEKBAR_START binding.seekbar.progress = SEEKBAR_START
message.resetVoiceMessage = false message.resetVoiceMessage = false
} }
@ -179,6 +186,7 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
context!!, context!!,
R.drawable.ic_baseline_pause_voice_message_24 R.drawable.ic_baseline_pause_voice_message_24
) )
binding.playPauseBtn.icon.setColorFilter(serverTheme.colorText, PorterDuff.Mode.SRC_ATOP)
binding.seekbar.progress = message.voiceMessagePlayedSeconds binding.seekbar.progress = message.voiceMessagePlayedSeconds
} else { } else {
binding.playPauseBtn.visibility = View.VISIBLE binding.playPauseBtn.visibility = View.VISIBLE
@ -186,6 +194,7 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
context!!, context!!,
R.drawable.ic_baseline_play_arrow_voice_message_24 R.drawable.ic_baseline_play_arrow_voice_message_24
) )
binding.playPauseBtn.icon.setColorFilter(serverTheme.colorText, PorterDuff.Mode.SRC_ATOP)
} }
} }
@ -263,7 +272,8 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
binding.messageQuote.quotedMessage.text = parentChatMessage.text binding.messageQuote.quotedMessage.text = parentChatMessage.text
binding.messageQuote.quotedMessage.setTextColor(serverTheme.colorText) binding.messageQuote.quotedMessage.setTextColor(serverTheme.colorText)
binding.messageQuote.quotedMessageAuthor.setTextColor( binding.messageQuote.quotedMessageAuthor.setTextColor(
ColorUtils.setAlphaComponent(serverTheme.colorText, ColorUtils.setAlphaComponent(
serverTheme.colorText,
ALPHA_80_INT ALPHA_80_INT
) )
) )
@ -316,5 +326,6 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
private const val SEEKBAR_START: Int = 0 private const val SEEKBAR_START: Int = 0
private const val HALF_ALPHA_INT: Int = 255 / 2 private const val HALF_ALPHA_INT: Int = 255 / 2
private val ALPHA_80_INT: Int = (255 * 0.8).roundToInt() private val ALPHA_80_INT: Int = (255 * 0.8).roundToInt()
private val ALPHA_60_INT: Int = (255 * 0.6).roundToInt()
} }
} }

View File

@ -88,10 +88,14 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme) {
fun themeHorizontalSeekBar(seekBar: SeekBar) { fun themeHorizontalSeekBar(seekBar: SeekBar) {
withElementColor(seekBar) { color -> withElementColor(seekBar) { color ->
themeHorizontalSeekBar(seekBar, color)
}
}
fun themeHorizontalSeekBar(seekBar: SeekBar, @ColorInt color: Int) {
themeHorizontalProgressBar(seekBar, color) themeHorizontalProgressBar(seekBar, color)
seekBar.thumb.setColorFilter(color, PorterDuff.Mode.SRC_IN) seekBar.thumb.setColorFilter(color, PorterDuff.Mode.SRC_IN)
} }
}
fun themeHorizontalProgressBar(progressBar: ProgressBar?, @ColorInt color: Int) { fun themeHorizontalProgressBar(progressBar: ProgressBar?, @ColorInt color: Int) {
if (progressBar != null) { if (progressBar != null) {