summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-12-10 20:45:35 +0100
committerParménides GV <parmegv@sdf.org>2013-12-10 20:45:35 +0100
commitf35ac034aae5c344bcb84e6bfb17fe0886a4042a (patch)
tree8e8873e25448e3fa491d262bccc9353836675f75
parentdca94d79c3391568b4228cab26ea2f02de46cde4 (diff)
Fixed algorithm to hide all but one provider.
-rw-r--r--src/se/leap/bitmaskclient/ProviderListFragment.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java
index 862177a2..501da609 100644
--- a/src/se/leap/bitmaskclient/ProviderListFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderListFragment.java
@@ -156,11 +156,6 @@ public class ProviderListFragment extends ListFragment {
// Notify the active callbacks interface (the activity, if the
// fragment is attached to one) that an item has been selected.
mCallbacks.onItemSelected(ProviderListContent.ITEMS.get(position).name());
-
- for(int item_position = 0; item_position < listView.getCount(); item_position++) {
- if(item_position != position)
- content_adapter.hide(item_position);
- }
}
@Override
@@ -203,11 +198,15 @@ public class ProviderListFragment extends ListFragment {
}
public void hideAllBut(int position) {
- for(int i = 0; i < content_adapter.getCount(); i++)
- if(i != position)
+ int real_count = content_adapter.getCount();
+ for(int i = 0; i < real_count;)
+ if(i != position) {
content_adapter.hide(i);
- else
- content_adapter.unHide(i);
+ position--;
+ real_count--;
+ } else {
+ i++;
+ }
}
public void unhideAll() {