Update progress bar for playing audio; Clear progress for any other audio that is not playing to avoid confusion

This commit is contained in:
wch423
2026-02-17 16:31:06 +01:00
parent e9ae9dc5bf
commit a044181a75
@@ -195,7 +195,6 @@ public class AudioView extends FrameLayout {
playPauseButton.setImageDrawable(playDrawable);
seekBar.setEnabled(true);
seekBar.setProgress(0);
// Get duration
Map<Integer, Long> durations = viewModel.getDurations().getValue();
@@ -270,8 +269,6 @@ public class AudioView extends FrameLayout {
this.progress = position;
this.duration = duration;
updateTimestamps();
seekBar.setProgress(position);
seekBar.setMax(duration);
}
}
@@ -316,6 +313,10 @@ public class AudioView extends FrameLayout {
updateUIForPlaybackState(state);
} else {
togglePlayPause(false);
// Also clear progress to avoid confusion
this.progress = 0;
updateTimestamps();
}
}
@@ -360,5 +361,7 @@ public class AudioView extends FrameLayout {
String progressText = DateUtils.getFormatedDuration(progress);
String durationText = DateUtils.getFormatedDuration(duration);
timestamp.setText(String.format("%s / %s", progressText, durationText));
seekBar.setProgress(progress);
seekBar.setMax(duration);
}
}