diff options
author | Parménides GV <parmegv@sdf.org> | 2014-12-09 16:22:28 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2014-12-09 16:22:28 +0100 |
commit | e980e1f888f29806ab0933495fdb0dd383c944e7 (patch) | |
tree | 52c4abafecaf25e7b7405ec670d3a8c2823666fa /app/src/main/java | |
parent | 7bbb5b69717393d87869ae6f16d6aff0578a81bf (diff) |
No duplicated providers.
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/Provider.java | 5 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/ProviderListAdapter.java | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Provider.java b/app/src/main/java/se/leap/bitmaskclient/Provider.java index a7ede2d1..f22a4bfb 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Provider.java +++ b/app/src/main/java/se/leap/bitmaskclient/Provider.java @@ -200,4 +200,9 @@ public final class Provider implements Parcelable { } return json; } + + @Override + public int hashCode() { + return main_url.hashCode(); + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderListAdapter.java b/app/src/main/java/se/leap/bitmaskclient/ProviderListAdapter.java index 72ca15c7..19a9a089 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderListAdapter.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderListAdapter.java @@ -90,10 +90,12 @@ public class ProviderListAdapter extends RendererAdapter<Provider> { @Override public void add(Provider item) { super.add(item); - boolean[] new_hidden = new boolean[hidden.length+1]; - System.arraycopy(hidden, 0, new_hidden, 0, hidden.length); - new_hidden[hidden.length] = false; - hidden = new_hidden; + if(getCollection().size() < hidden.length) { + boolean[] new_hidden = new boolean[hidden.length + 1]; + System.arraycopy(hidden, 0, new_hidden, 0, hidden.length); + new_hidden[hidden.length] = false; + hidden = new_hidden; + } } @Override |