From 181d36b66cc0bb36e5983ea07cd5667ed262b5df Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 8 Jan 2018 04:08:21 -0600 Subject: Tunnel: Add a State factory method Signed-off-by: Samuel Holland --- app/src/main/java/com/wireguard/android/model/Tunnel.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 { public enum State { DOWN, TOGGLE, - UP + UP; + + public static State of(final boolean running) { + return running ? UP : DOWN; + } } public static class Statistics extends BaseObservable { -- cgit v1.2.3