Commit e0594aa4 authored by Yusuke Iwaki's avatar Yusuke Iwaki

modify RealmListObserver notification.

parent 42fb1f71
...@@ -31,10 +31,17 @@ public class RealmListObserver<T extends RealmObject> extends AbstractRealmResul ...@@ -31,10 +31,17 @@ public class RealmListObserver<T extends RealmObject> extends AbstractRealmResul
return query.queryItems(realm); return query.queryItems(realm);
} }
private String previousResultsString;
@Override public final RealmChangeListener<RealmResults<T>> getListener() { @Override public final RealmChangeListener<RealmResults<T>> getListener() {
return element -> { return results -> {
String currentResultString = results != null ? results.toString() : null;
if (previousResultsString != null && previousResultsString.equals(currentResultString)) {
return;
}
previousResultsString = currentResultString;
if (onUpdateListener != null) { if (onUpdateListener != null) {
onUpdateListener.onUpdateResults(element); onUpdateListener.onUpdateResults(results);
} }
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment