From f35ac034aae5c344bcb84e6bfb17fe0886a4042a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Tue, 10 Dec 2013 20:45:35 +0100 Subject: Fixed algorithm to hide all but one provider. --- src/se/leap/bitmaskclient/ProviderListFragment.java | 17 ++++++++--------- 1 file 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() { -- cgit v1.2.3