Allow database queries on main thread

This commit is contained in:
Stefan Niedermann 2021-04-03 16:04:40 +02:00
parent d309f5dd6b
commit c1a12299b4
2 changed files with 3 additions and 2 deletions

View file

@ -318,7 +318,8 @@ public abstract class BaseNoteFragment extends BrandedFragment implements Catego
Log.v(TAG, "... not saving, since nothing has changed");
}
} else {
new Thread(() -> note = db.updateNoteAndSync(localAccount, note, newContent, null, callback)).start();
// FIXME requires database queries on main thread!
note = db.updateNoteAndSync(localAccount, note, newContent, null, callback);
listener.onNoteUpdated(note);
requireActivity().invalidateOptionsMenu();
}

View file

@ -132,7 +132,7 @@ public abstract class NotesDatabase extends RoomDatabase {
Log.v(TAG, NotesDatabase.class.getSimpleName() + " created.");
}
})
// .allowMainThreadQueries() // FIXME remove
.allowMainThreadQueries() // FIXME Needed in BaseNoteFragment#saveNote()
.build();
}