Use context looper

pull/147/head
M66B 6 years ago
parent 3c4a5a9294
commit fde13733d2

@ -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();

@ -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

Loading…
Cancel
Save