diff --git a/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java b/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java index 33f475812..5e89fca49 100644 --- a/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java +++ b/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java @@ -23,6 +23,8 @@ import android.widget.TextView; import java.lang.ref.WeakReference; import java.util.Locale; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -46,6 +48,8 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti private final Sensor proximitySensor; private final PendingItem> pendingOnClickView = new PendingItem<>(); + private final ExecutorService executor = Executors.newSingleThreadExecutor(); + private final Handler handler = new Handler(); public AudioPlayer(MessageAdapter adapter) { @@ -87,7 +91,7 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti audioPlayer.setTag(message); if (init(ViewHolder.get(audioPlayer), message)) { this.audioPlayerLayouts.addWeakReferenceTo(audioPlayer); - this.stopRefresher(true); + executor.execute(()-> this.stopRefresher(true)); } else { this.audioPlayerLayouts.removeWeakReferenceTo(audioPlayer); }