From 8cad9be37713870882541ddd382cb94640142879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 11 Dec 2014 12:59:33 +0100 Subject: No duplicates between preseeded and custom --- app/src/main/java/se/leap/bitmaskclient/Provider.java | 5 +++-- app/src/main/java/se/leap/bitmaskclient/ProviderManager.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/Provider.java b/app/src/main/java/se/leap/bitmaskclient/Provider.java index f22a4bfb..d7ff6633 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Provider.java +++ b/app/src/main/java/se/leap/bitmaskclient/Provider.java @@ -35,6 +35,7 @@ import java.util.Locale; /** * @author Sean Leonard + * @author Parménides GV * */ public final class Provider implements Parcelable { @@ -187,7 +188,7 @@ public final class Provider implements Parcelable { public boolean equals(Object o) { if(o instanceof Provider) { Provider p = (Provider) o; - return p.mainUrl().equals(mainUrl()); + return p.mainUrl().getHost().equals(mainUrl().getHost()); } else return false; } @@ -203,6 +204,6 @@ public final class Provider implements Parcelable { @Override public int hashCode() { - return main_url.hashCode(); + return mainUrl().getHost().hashCode(); } } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java b/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java index 911144f7..69bd7c1e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java @@ -136,7 +136,8 @@ public class ProviderManager implements AdapteeCollection { @Override public void add(Provider element) { - custom_providers.add(element); + if(!default_providers.contains(element)) + custom_providers.add(element); } @Override -- cgit v1.2.3