summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/com/wireguard/config/Config.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/config/Config.java b/app/src/main/java/com/wireguard/config/Config.java
index 414b4894..e39832ba 100644
--- a/app/src/main/java/com/wireguard/config/Config.java
+++ b/app/src/main/java/com/wireguard/config/Config.java
@@ -5,6 +5,7 @@ import android.databinding.Bindable;
import android.databinding.Observable;
import android.databinding.ObservableArrayList;
import android.databinding.ObservableList;
+import android.support.annotation.NonNull;
import com.wireguard.android.BR;
@@ -19,7 +20,8 @@ import java.util.regex.Pattern;
* Represents a wg-quick configuration file, its name, and its connection state.
*/
-public class Config extends BaseObservable implements Copyable<Config>, Observable {
+public class Config extends BaseObservable
+ implements Comparable<Config>, Copyable<Config>, Observable {
private static final Pattern PATTERN = Pattern.compile("^[a-zA-Z0-9_=+.-]{1,16}$");
private static boolean isNameValid(final String name) {
@@ -32,6 +34,11 @@ public class Config extends BaseObservable implements Copyable<Config>, Observab
private final ObservableList<Peer> peers = new ObservableArrayList<>();
@Override
+ public int compareTo(@NonNull final Config config) {
+ return getName().compareTo(config.getName());
+ }
+
+ @Override
public Config copy() {
final Config copy = new Config();
copy.copyFrom(this);