From: Damyan Ivanov Date: Tue, 2 Apr 2019 21:06:59 +0000 (+0300) Subject: a way to force notification on ObservableValue X-Git-Tag: v0.9~24 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=5b595a759023e207d20e6196c8a8c0c4bd3a72c8;p=mobile-ledger.git a way to force notification on ObservableValue --- diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/ObservableValue.java b/app/src/main/java/net/ktnx/mobileledger/utils/ObservableValue.java index e75b4100..393a9cdc 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/ObservableValue.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/ObservableValue.java @@ -53,11 +53,18 @@ public class ObservableValue { public int countObservers() { return impl.countObservers(); } + public void forceNotifyObservers() { + impl.setChanged(); + impl.notifyObservers(); + } private class ObservableValueImpl extends Observable { protected T value; public void setValue(T newValue) { setValue(newValue, true); } + protected void setChanged() { + super.setChanged(); + } private synchronized void setValue(T newValue, boolean notify) { if ((newValue == null) && (value == null)) return;