Use context looper

This commit is contained in:
M66B 2018-12-20 19:42:38 +01:00
parent 3c4a5a9294
commit fde13733d2
2 changed files with 3 additions and 3 deletions

View File

@ -1629,7 +1629,7 @@ public class FragmentCompose extends FragmentEx {
EntityOperation.queue(db, draft, EntityOperation.DELETE); EntityOperation.queue(db, draft, EntityOperation.DELETE);
if (!empty) { if (!empty) {
Handler handler = new Handler(Looper.getMainLooper()); Handler handler = new Handler(context.getMainLooper());
handler.post(new Runnable() { handler.post(new Runnable() {
public void run() { public void run() {
Toast.makeText(context, R.string.title_draft_deleted, Toast.LENGTH_LONG).show(); Toast.makeText(context, R.string.title_draft_deleted, Toast.LENGTH_LONG).show();
@ -1639,7 +1639,7 @@ public class FragmentCompose extends FragmentEx {
} else if (action == R.id.action_save || action == R.id.menu_encrypt) { } else if (action == R.id.action_save || action == R.id.menu_encrypt) {
EntityOperation.queue(db, draft, EntityOperation.ADD); EntityOperation.queue(db, draft, EntityOperation.ADD);
Handler handler = new Handler(Looper.getMainLooper()); Handler handler = new Handler(context.getMainLooper());
handler.post(new Runnable() { handler.post(new Runnable() {
public void run() { public void run() {
Toast.makeText(context, R.string.title_draft_saved, Toast.LENGTH_LONG).show(); Toast.makeText(context, R.string.title_draft_saved, Toast.LENGTH_LONG).show();

View File

@ -2564,7 +2564,7 @@ public class ServiceSynchronize extends LifecycleService {
if (outbox != null) { if (outbox != null) {
db.folder().setFolderError(outbox.id, null); db.folder().setFolderError(outbox.id, null);
handler = new Handler(Looper.getMainLooper()) { handler = new Handler(getMainLooper()) {
private LiveData<List<EntityOperation>> liveOperations; private LiveData<List<EntityOperation>> liveOperations;
@Override @Override