diff options
-rw-r--r-- | app/src/main/java/com/wireguard/config/Profile.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/config/Profile.java b/app/src/main/java/com/wireguard/config/Profile.java index 1670050c..e6506c45 100644 --- a/app/src/main/java/com/wireguard/config/Profile.java +++ b/app/src/main/java/com/wireguard/config/Profile.java @@ -1,9 +1,15 @@ package com.wireguard.config; +import android.databinding.BaseObservable; +import android.databinding.Bindable; +import android.databinding.Observable; import android.databinding.ObservableArrayList; import android.databinding.ObservableList; +import com.wireguard.android.BR; + import java.io.BufferedReader; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -13,12 +19,14 @@ import java.nio.charset.StandardCharsets; * Represents a wg-quick profile. */ -public class Profile { +public class Profile extends BaseObservable implements Observable { private final Interface iface = new Interface(); + private boolean isConnected; private final String name; private final ObservableList<Peer> peers = new ObservableArrayList<>(); public Profile(String name) { + super(); this.name = name; } @@ -26,6 +34,11 @@ public class Profile { return iface; } + @Bindable + public boolean getIsConnected() { + return isConnected; + } + public String getName() { return name; } @@ -55,6 +68,11 @@ public class Profile { } } + public void setIsConnected(boolean isConnected) { + this.isConnected = isConnected; + notifyPropertyChanged(BR.isConnected); + } + @Override public String toString() { StringBuilder sb = new StringBuilder().append(iface.toString()); |