summaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-01-08 04:08:21 -0600
committerSamuel Holland <samuel@sholland.org>2018-01-08 04:25:15 -0600
commitec81014c4e6e305b4720ecdf108f67a83990e14a (patch)
tree619e591cf9a5335f03599f0141c441adf967fe75 /app/src
parentd645d698475f986d8be8a0c9c96f2cd9b5dd153d (diff)
Tunnel: Add a State factory method
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/com/wireguard/android/model/Tunnel.java6
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 {