run postDelayed in background thread
This commit is contained in:
parent
6785d8c69f
commit
5bedde7913
|
@ -23,6 +23,8 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
|
@ -46,6 +48,8 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
|
||||||
private final Sensor proximitySensor;
|
private final Sensor proximitySensor;
|
||||||
private final PendingItem<WeakReference<ImageButton>> pendingOnClickView = new PendingItem<>();
|
private final PendingItem<WeakReference<ImageButton>> pendingOnClickView = new PendingItem<>();
|
||||||
|
|
||||||
|
private final ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
private final Handler handler = new Handler();
|
private final Handler handler = new Handler();
|
||||||
|
|
||||||
public AudioPlayer(MessageAdapter adapter) {
|
public AudioPlayer(MessageAdapter adapter) {
|
||||||
|
@ -87,7 +91,7 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
|
||||||
audioPlayer.setTag(message);
|
audioPlayer.setTag(message);
|
||||||
if (init(ViewHolder.get(audioPlayer), message)) {
|
if (init(ViewHolder.get(audioPlayer), message)) {
|
||||||
this.audioPlayerLayouts.addWeakReferenceTo(audioPlayer);
|
this.audioPlayerLayouts.addWeakReferenceTo(audioPlayer);
|
||||||
this.stopRefresher(true);
|
executor.execute(()-> this.stopRefresher(true));
|
||||||
} else {
|
} else {
|
||||||
this.audioPlayerLayouts.removeWeakReferenceTo(audioPlayer);
|
this.audioPlayerLayouts.removeWeakReferenceTo(audioPlayer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue