theme incoming voice message

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-07-27 23:59:16 +02:00
parent f68384e69d
commit b7006230b8
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 23 additions and 0 deletions

View file

@ -48,6 +48,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.databinding.ItemCustomIncomingVoiceMessageBinding
import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.preferences.AppPreferences
@ -66,6 +67,9 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message
@Inject
var context: Context? = null
@Inject
lateinit var viewThemeUtils: ViewThemeUtils
@JvmField
@Inject
var appPreferences: AppPreferences? = null
@ -93,6 +97,7 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message
updateDownloadState(message)
binding.seekbar.max = message.voiceMessageDuration
viewThemeUtils.themeHorizontalSeekBar(binding.seekbar)
if (message.isPlayingVoiceMessage) {
showPlayButton()

View file

@ -25,13 +25,17 @@ import android.content.Context
import android.content.res.ColorStateList
import android.content.res.Configuration
import android.graphics.Color
import android.graphics.PorterDuff
import android.graphics.drawable.Drawable
import android.view.View
import android.widget.CheckBox
import android.widget.EditText
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.RadioButton
import android.widget.SeekBar
import android.widget.TextView
import androidx.annotation.ColorInt
import androidx.appcompat.content.res.AppCompatResources
import androidx.appcompat.widget.SwitchCompat
import androidx.core.content.ContextCompat
@ -82,6 +86,20 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme) {
}
}
fun themeHorizontalSeekBar(seekBar: SeekBar) {
withElementColor(seekBar) { color ->
themeHorizontalProgressBar(seekBar, color)
seekBar.thumb.setColorFilter(color, PorterDuff.Mode.SRC_IN)
}
}
fun themeHorizontalProgressBar(progressBar: ProgressBar?, @ColorInt color: Int) {
if (progressBar != null) {
progressBar.indeterminateDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN)
progressBar.progressDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN)
}
}
fun colorTextViewElement(textView: TextView) {
withElementColor(textView) { color ->
textView.setTextColor(color)