reset seekbar to zero on init, fix equals() for AudioSlide

This commit is contained in:
adbenitez
2023-10-01 00:48:44 +02:00
committed by bjoern
parent 3fd06ad27e
commit 9fa3c03048
2 changed files with 9 additions and 1 deletions
@@ -80,6 +80,7 @@ public class AudioView extends FrameLayout implements AudioSlidePlayer.Listener
{
controlToggle.displayQuick(playButton);
seekBar.setEnabled(true);
seekBar.setProgress(0);
audioSlidePlayer = AudioSlidePlayer.createFor(getContext(), audio, this);
timestamp.setText(DateUtils.getFormatedDuration(duration));
@@ -155,7 +156,7 @@ public class AudioView extends FrameLayout implements AudioSlidePlayer.Listener
@Override
public void onProgress(AudioSlide slide, double progress, long millis) {
if (audioSlidePlayer.getAudioSlide().getDcMsgId() != slide.getDcMsgId()) {
if (!audioSlidePlayer.getAudioSlide().equals(slide)) {
return;
}
int seekProgress = (int) Math.floor(progress * this.seekBar.getMax());
@@ -45,6 +45,13 @@ public class AudioSlide extends Slide {
super(context, new UriAttachment(uri, null, contentType, AttachmentDatabase.TRANSFER_PROGRESS_STARTED, dataSize, 0, 0, null, null, voiceNote));
}
@Override
public boolean equals(Object other) {
if (other == null) return false;
if (!(other instanceof AudioSlide)) return false;
return this.getDcMsgId() == ((AudioSlide)other).getDcMsgId();
}
@Override
@Nullable
public Uri getThumbnailUri() {