From 5b595a759023e207d20e6196c8a8c0c4bd3a72c8 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Wed, 3 Apr 2019 00:06:59 +0300 Subject: [PATCH] a way to force notification on ObservableValue --- .../java/net/ktnx/mobileledger/utils/ObservableValue.java | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- 2.39.5