mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 21:45:20 +00:00
Waveform fill color attribute for message audio view.
This commit is contained in:
parent
efbcd0b207
commit
793e6bf10f
@ -41,7 +41,8 @@
|
||||
android:paddingBottom="15dp"
|
||||
app:widgetBackground="?conversation_item_bubble_background"
|
||||
app:foregroundTintColor="?android:colorControlNormal"
|
||||
app:backgroundTintColor="?conversation_item_bubble_background"/>
|
||||
app:backgroundTintColor="?conversation_item_bubble_background"
|
||||
app:waveformFillColor="?conversation_item_audio_seek_bar_color"/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.DocumentView
|
||||
android:id="@+id/attachment_document"
|
||||
|
@ -9,4 +9,5 @@
|
||||
android:visibility="gone"
|
||||
app:foregroundTintColor="?android:colorControlNormal"
|
||||
app:backgroundTintColor="?message_received_background_color"
|
||||
app:waveformFillColor="?conversation_item_audio_seek_bar_color"
|
||||
tools:visibility="visible"/>
|
||||
|
@ -7,4 +7,5 @@
|
||||
android:layout_height="wrap_content"
|
||||
app:foregroundTintColor="?android:colorControlNormal"
|
||||
app:backgroundTintColor="?message_sent_background_color"
|
||||
app:waveformFillColor="?conversation_item_audio_seek_bar_color"
|
||||
android:visibility="gone"/>
|
||||
|
@ -78,7 +78,6 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:bar_progress_color="?conversation_item_audio_seek_bar_color"
|
||||
app:bar_gravity="center"
|
||||
app:bar_width="4dp"
|
||||
app:bar_corner_radius="2dp"
|
||||
|
@ -174,6 +174,7 @@
|
||||
<attr name="widgetBackground" format="color"/>
|
||||
<attr name="foregroundTintColor" format="color" />
|
||||
<attr name="backgroundTintColor" format="color" />
|
||||
<attr name="waveformFillColor" format="reference|color" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="CircleColorImageView">
|
||||
|
@ -117,7 +117,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_backgroundTintColor, Color.WHITE),
|
||||
typedArray.getColor(R.styleable.MessageAudioView_waveformFillColor, Color.WHITE))
|
||||
container.setBackgroundColor(typedArray.getColor(R.styleable.MessageAudioView_widgetBackground, Color.TRANSPARENT))
|
||||
typedArray.recycle()
|
||||
}
|
||||
@ -181,7 +182,7 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
||||
downloadListener = listener
|
||||
}
|
||||
|
||||
fun setTint(@ColorInt foregroundTint: Int, @ColorInt backgroundTint: Int) {
|
||||
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)
|
||||
@ -192,6 +193,7 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener {
|
||||
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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user