mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-03 12:37:31 +01:00
Replace the player timeline (#7821)
This commit is contained in:
parent
3c3c44b344
commit
92ed663068
1
changelog.d/7821.misc
Normal file
1
changelog.d/7821.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
[Voice Broadcast] Replace the player timeline
|
@ -122,10 +122,14 @@ abstract class MessageVoiceBroadcastListeningItem : AbsMessageVoiceBroadcastItem
|
|||||||
|
|
||||||
private fun bindSeekBar(holder: Holder) {
|
private fun bindSeekBar(holder: Holder) {
|
||||||
with(holder) {
|
with(holder) {
|
||||||
durationView.text = formatPlaybackTime(duration)
|
remainingTimeView.text = formatRemainingTime(duration)
|
||||||
|
elapsedTimeView.text = formatPlaybackTime(0)
|
||||||
seekBar.max = duration
|
seekBar.max = duration
|
||||||
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
||||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) = Unit
|
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||||
|
remainingTimeView.text = formatRemainingTime(duration - progress)
|
||||||
|
elapsedTimeView.text = formatPlaybackTime(progress)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStartTrackingTouch(seekBar: SeekBar) {
|
override fun onStartTrackingTouch(seekBar: SeekBar) {
|
||||||
isUserSeeking = true
|
isUserSeeking = true
|
||||||
@ -156,6 +160,7 @@ abstract class MessageVoiceBroadcastListeningItem : AbsMessageVoiceBroadcastItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun formatPlaybackTime(time: Int) = DateUtils.formatElapsedTime((time / 1000).toLong())
|
private fun formatPlaybackTime(time: Int) = DateUtils.formatElapsedTime((time / 1000).toLong())
|
||||||
|
private fun formatRemainingTime(time: Int) = if (time < 1000) formatPlaybackTime(time) else String.format("-%s", formatPlaybackTime(time))
|
||||||
|
|
||||||
override fun unbind(holder: Holder) {
|
override fun unbind(holder: Holder) {
|
||||||
super.unbind(holder)
|
super.unbind(holder)
|
||||||
@ -177,7 +182,8 @@ abstract class MessageVoiceBroadcastListeningItem : AbsMessageVoiceBroadcastItem
|
|||||||
val fastBackwardButton by bind<ImageButton>(R.id.fastBackwardButton)
|
val fastBackwardButton by bind<ImageButton>(R.id.fastBackwardButton)
|
||||||
val fastForwardButton by bind<ImageButton>(R.id.fastForwardButton)
|
val fastForwardButton by bind<ImageButton>(R.id.fastForwardButton)
|
||||||
val seekBar by bind<SeekBar>(R.id.seekBar)
|
val seekBar by bind<SeekBar>(R.id.seekBar)
|
||||||
val durationView by bind<TextView>(R.id.playbackDuration)
|
val remainingTimeView by bind<TextView>(R.id.remainingTime)
|
||||||
|
val elapsedTimeView by bind<TextView>(R.id.elapsedTime)
|
||||||
val broadcasterNameMetadata by bind<VoiceBroadcastMetadataView>(R.id.broadcasterNameMetadata)
|
val broadcasterNameMetadata by bind<VoiceBroadcastMetadataView>(R.id.broadcasterNameMetadata)
|
||||||
val voiceBroadcastMetadata by bind<VoiceBroadcastMetadataView>(R.id.voiceBroadcastMetadata)
|
val voiceBroadcastMetadata by bind<VoiceBroadcastMetadataView>(R.id.voiceBroadcastMetadata)
|
||||||
val listenersCountMetadata by bind<VoiceBroadcastMetadataView>(R.id.listenersCountMetadata)
|
val listenersCountMetadata by bind<VoiceBroadcastMetadataView>(R.id.listenersCountMetadata)
|
||||||
|
@ -140,27 +140,40 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:layout_marginEnd="6dp"
|
|
||||||
android:paddingStart="0dp"
|
android:paddingStart="0dp"
|
||||||
android:paddingEnd="0dp"
|
android:paddingEnd="0dp"
|
||||||
android:progressDrawable="@drawable/bg_seek_bar"
|
android:progressDrawable="@drawable/bg_seek_bar"
|
||||||
android:thumbTint="?vctr_content_secondary"
|
|
||||||
android:thumbOffset="3dp"
|
android:thumbOffset="3dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:thumbTint="?vctr_content_secondary"
|
||||||
app:layout_constraintEnd_toStartOf="@id/playbackDuration"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/controllerButtonsFlow"
|
app:layout_constraintTop_toBottomOf="@id/controllerButtonsFlow"
|
||||||
tools:progress="0" />
|
tools:progress="50" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/playbackDuration"
|
android:id="@+id/elapsedTime"
|
||||||
style="@style/Widget.Vector.TextView.Caption"
|
style="@style/Widget.Vector.TextView.Caption"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginTop="-3dp"
|
||||||
|
android:textColor="?vctr_content_tertiary"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/seekBar"
|
||||||
|
tools:ignore="NegativeMargin"
|
||||||
|
tools:text="0:11" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/remainingTime"
|
||||||
|
style="@style/Widget.Vector.TextView.Caption"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-3dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
android:textColor="?vctr_content_tertiary"
|
android:textColor="?vctr_content_tertiary"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/seekBar"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/seekBar"
|
app:layout_constraintTop_toBottomOf="@id/seekBar"
|
||||||
tools:text="0:23" />
|
tools:ignore="NegativeMargin"
|
||||||
|
tools:text="-0:12" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user