aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/services/AudioPlayer.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AudioPlayer.java b/src/main/java/de/pixart/messenger/services/AudioPlayer.java
index ecb3f5c21..501c6b9a5 100644
--- a/src/main/java/de/pixart/messenger/services/AudioPlayer.java
+++ b/src/main/java/de/pixart/messenger/services/AudioPlayer.java
@@ -12,8 +12,6 @@ import android.media.AudioManager;
import android.os.Build;
import android.os.Handler;
import android.os.PowerManager;
-import androidx.core.app.ActivityCompat;
-import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
@@ -21,6 +19,9 @@ import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
+
import java.lang.ref.WeakReference;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
@@ -89,7 +90,7 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
audioPlayer.setTag(message);
if (init(ViewHolder.get(audioPlayer), message)) {
this.audioPlayerLayouts.addWeakReferenceTo(audioPlayer);
- executor.execute(()-> this.stopRefresher(true));
+ executor.execute(() -> this.stopRefresher(true));
} else {
this.audioPlayerLayouts.removeWeakReferenceTo(audioPlayer);
}
@@ -343,8 +344,12 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
return false;
}
final ViewHolder viewHolder = ViewHolder.get(audioPlayer);
- viewHolder.progress.setProgress(current * 100 / duration);
- viewHolder.runtime.setText(formatTime(current) + " / " + formatTime(duration));
+ if (duration <= 0) {
+ viewHolder.progress.setProgress(100);
+ } else {
+ viewHolder.progress.setProgress(current * 100 / duration);
+ }
+ viewHolder.runtime.setText(String.format("%s / %s", formatTime(current), formatTime(duration)));
return true;
}