Singleton handler

This commit is contained in:
M66B
2020-08-23 17:34:14 +02:00
parent a8a95b0953
commit c48ee83925
26 changed files with 87 additions and 127 deletions

View File

@@ -23,8 +23,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
@@ -94,8 +92,6 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
}
private void run(final Context context, final LifecycleOwner owner, final Bundle args, final String name) {
final Handler handler = new Handler(Looper.getMainLooper());
this.name = name;
if (owner instanceof TwoStateOwner)
@@ -148,7 +144,7 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
}
// Run on UI thread
handler.post(new Runnable() {
ApplicationEx.getMainHandler().post(new Runnable() {
@Override
public void run() {
Lifecycle.State state = owner.getLifecycle().getCurrentState();