diff --git a/res/drawable/circle_tintable_4dp_inset.xml b/res/drawable/circle_tintable_4dp_inset.xml new file mode 100644 index 0000000000..92b0e0830c --- /dev/null +++ b/res/drawable/circle_tintable_4dp_inset.xml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/res/layout/message_audio_view.xml b/res/layout/message_audio_view.xml index 09e5c9549d..0bb4abf2a5 100644 --- a/res/layout/message_audio_view.xml +++ b/res/layout/message_audio_view.xml @@ -15,25 +15,28 @@ - + android:layout_gravity="center_vertical" + android:min="0" + android:max="100" + tools:visibility="gone" + tools:backgroundTint="@android:color/black" + tools:indeterminateTint="@android:color/white"/> downloadListener?.onClick(v, audio) } - if (downloadProgress.isSpinning) { - downloadProgress.stopSpinning() + if (downloadProgress.isIndeterminate) { + downloadProgress.isIndeterminate = false + downloadProgress.progress = 0 } } (showControls && audio.transferState == AttachmentDatabase.TRANSFER_PROGRESS_STARTED) -> { controlToggle.displayQuick(downloadProgress) seekBar.isEnabled = false - downloadProgress.spin() + downloadProgress.isIndeterminate = true } else -> { controlToggle.displayQuick(playButton) seekBar.isEnabled = true - if (downloadProgress.isSpinning) { - downloadProgress.stopSpinning() + if (downloadProgress.isIndeterminate) { + downloadProgress.isIndeterminate = false + downloadProgress.progress = 100 } // Post to make sure it executes only when the view is attached to a window. @@ -187,7 +189,11 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener { pauseButton.imageTintList = ColorStateList.valueOf(backgroundTint) downloadButton.setColorFilter(foregroundTint, PorterDuff.Mode.SRC_IN) - downloadProgress.barColor = foregroundTint + + downloadProgress.backgroundTintList = ColorStateList.valueOf(foregroundTint) + downloadProgress.progressTintList = ColorStateList.valueOf(backgroundTint) + downloadProgress.indeterminateTintList = ColorStateList.valueOf(backgroundTint) + totalDuration.setTextColor(foregroundTint) // Seek bar's progress color is set from the XML template. Whereas the background is computed. @@ -284,7 +290,8 @@ class MessageAudioView: FrameLayout, AudioSlidePlayer.Listener { @Subscribe(sticky = true, threadMode = ThreadMode.MAIN) fun onEvent(event: PartProgressEvent) { if (audioSlidePlayer != null && event.attachment == audioSlidePlayer!!.audioSlide.asAttachment()) { - downloadProgress.setInstantProgress(event.progress.toFloat() / event.total) + val progress = ((event.progress.toFloat() / event.total) * 100f).toInt() + downloadProgress.progress = progress } }