Example #1
0
 private void notifyChange() {
   Runtime.postToMainThread(
       () -> {
         for (ModelChangedListener<UserVM> l : listeners) {
           l.onChanged(UserVM.this);
         }
       });
 }
Example #2
0
 /**
  * Subscribe to UserVM updates
  *
  * @param listener UserVM changed listener
  */
 @MainThread
 @ObjectiveCName("subscribeWithListener:")
 public void subscribe(@NotNull ModelChangedListener<UserVM> listener) {
   // Runtime.checkMainThread();
   if (listeners.contains(listener)) {
     return;
   }
   listeners.add(listener);
   listener.onChanged(this);
 }