diff options
Diffstat (limited to 'src/se/leap/bitmaskclient/ProviderListFragment.java')
-rw-r--r-- | src/se/leap/bitmaskclient/ProviderListFragment.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java index 53b6cb6d..45047982 100644 --- a/src/se/leap/bitmaskclient/ProviderListFragment.java +++ b/src/se/leap/bitmaskclient/ProviderListFragment.java @@ -155,7 +155,7 @@ 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);
@@ -196,23 +196,27 @@ public class ProviderListFragment extends ListFragment { mActivatedPosition = position;
}
- public void addItem(ProviderItem provider) {
- content_adapter.add(provider);
- content_adapter.notifyDataSetChanged();
- }
-
public void removeLastItem() {
unhideAll();
content_adapter.remove(content_adapter.getItem(content_adapter.getCount()-1));
content_adapter.notifyDataSetChanged();
}
+ public void addItem(ProviderItem provider) {
+ content_adapter.add(provider);
+ content_adapter.notifyDataSetChanged();
+ }
+
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() {
|