From dfe1a58e0adbf1241650178198b6d263a71e76c0 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sun, 19 May 2019 20:35:02 +0200 Subject: run postDelayed in background thread --- src/main/java/de/pixart/messenger/services/AudioPlayer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/pixart/messenger/services/AudioPlayer.java b/src/main/java/de/pixart/messenger/services/AudioPlayer.java index ca6e7c3fa..64a1ea787 100644 --- a/src/main/java/de/pixart/messenger/services/AudioPlayer.java +++ b/src/main/java/de/pixart/messenger/services/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 de.pixart.messenger.Config; import de.pixart.messenger.R; @@ -44,6 +46,7 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti private final SensorManager sensorManager; private final Sensor proximitySensor; private final PendingItem> pendingOnClickView = new PendingItem<>(); + private final ExecutorService executor = Executors.newSingleThreadExecutor(); private final Handler handler = new Handler(); @@ -86,7 +89,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); } -- cgit v1.2.3