forked from
lass.pds.lassul.us/superconfig
This repository has no description
675 B
28 lines
1package us.lassul.assist;
2
3import java.util.ArrayList;
4import java.util.List;
5
6/**
7 * Tells the screens that the call state or a conversation changed, so they redraw while a call
8 * runs. Main thread only; the app's screens and CallService share the process.
9 */
10final class Live {
11 private static final List<Runnable> watchers = new ArrayList<>();
12
13 private Live() {}
14
15 static void watch(Runnable watcher) {
16 watchers.add(watcher);
17 }
18
19 static void unwatch(Runnable watcher) {
20 watchers.remove(watcher);
21 }
22
23 static void changed() {
24 for (Runnable watcher : new ArrayList<>(watchers)) {
25 watcher.run();
26 }
27 }
28}