diff options
author | Samuel Holland <samuel@sholland.org> | 2018-01-08 04:08:21 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-01-08 04:25:15 -0600 |
commit | 181d36b66cc0bb36e5983ea07cd5667ed262b5df (patch) | |
tree | 619e591cf9a5335f03599f0141c441adf967fe75 | |
parent | 9c1e41ff56dc9f051b10bd460c845a65ce711a98 (diff) |
Tunnel: Add a State factory method
Signed-off-by: Samuel Holland <samuel@sholland.org>
-rw-r--r-- | app/src/main/java/com/wireguard/android/model/Tunnel.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/model/Tunnel.java b/app/src/main/java/com/wireguard/android/model/Tunnel.java index 6edb6acd..67c5144e 100644 --- a/app/src/main/java/com/wireguard/android/model/Tunnel.java +++ b/app/src/main/java/com/wireguard/android/model/Tunnel.java @@ -129,7 +129,11 @@ public class Tunnel extends BaseObservable implements Keyed<String> { public enum State { DOWN, TOGGLE, - UP + UP; + + public static State of(final boolean running) { + return running ? UP : DOWN; + } } public static class Statistics extends BaseObservable { |