diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-05-19 20:35:02 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-05-19 20:35:02 +0200 |
commit | dfe1a58e0adbf1241650178198b6d263a71e76c0 (patch) | |
tree | eb7754cb923576a91709b967226c079a2e82dbbd /src/main/java/de/pixart | |
parent | e2612e1f08ab959c1c534d403f0fafe1d0fc0c20 (diff) |
run postDelayed in background thread
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/AudioPlayer.java | 5 |
1 files changed, 4 insertions, 1 deletions
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<WeakReference<ImageButton>> 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); } |