From 0cd57851ad3bf284064281b901028e3fa55944c8 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 23 Mar 2017 22:55:50 +0000 Subject: [PATCH] Journal model: call the postLoad callback on fetch too. It's really annoying that it doesn't do it automatically as it should, in the meanwhile, add this workaround. I reported it to upstream: https://github.com/requery/requery/issues/487 --- .../java/com/etesync/syncadapter/model/JournalModel.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/etesync/syncadapter/model/JournalModel.java b/app/src/main/java/com/etesync/syncadapter/model/JournalModel.java index cede1a5a..d14cd58a 100644 --- a/app/src/main/java/com/etesync/syncadapter/model/JournalModel.java +++ b/app/src/main/java/com/etesync/syncadapter/model/JournalModel.java @@ -65,7 +65,12 @@ public class JournalModel { } public static JournalEntity fetch(EntityDataStore data, String url) { - return data.select(JournalEntity.class).where(JournalEntity.UID.eq(url)).limit(1).get().firstOrNull(); + JournalEntity ret = data.select(JournalEntity.class).where(JournalEntity.UID.eq(url)).limit(1).get().firstOrNull(); + if (ret != null) { + // FIXME: For some reason this isn't always being called, manually do it here. + ret.afterLoad(); + } + return ret; } public static JournalEntity fetchOrCreate(EntityDataStore data, CollectionInfo collection) {