From ec81014c4e6e305b4720ecdf108f67a83990e14a Mon Sep 17 00:00:00 2001 From: Samuel Holland <samuel@sholland.org> Date: Mon, 8 Jan 2018 04:08:21 -0600 Subject: Tunnel: Add a State factory method Signed-off-by: Samuel Holland <samuel@sholland.org> --- app/src/main/java/com/wireguard/android/model/Tunnel.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/com/wireguard/android') 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 { -- cgit v1.2.3