summaryrefslogtreecommitdiff
path: root/src/se/leap/bitmaskclient/ProviderListFragment.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/se/leap/bitmaskclient/ProviderListFragment.java')
-rw-r--r--src/se/leap/bitmaskclient/ProviderListFragment.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java
index 84d46a11..45047982 100644
--- a/src/se/leap/bitmaskclient/ProviderListFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderListFragment.java
@@ -19,7 +19,6 @@
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.ProviderListContent.ProviderItem;
import android.app.Activity;
-import android.app.DialogFragment;
import android.app.ListFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -155,8 +154,8 @@ 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).id);
-
+ 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);
@@ -172,6 +171,9 @@ public class ProviderListFragment extends ListFragment {
}
}
+ public void notifyAdapter() {
+ content_adapter.notifyDataSetChanged();
+ }
/**
* Turns on activate-on-click mode. When this mode is on, list items will be
* given the 'activated' state when touched.
@@ -194,12 +196,27 @@ public class ProviderListFragment extends ListFragment {
mActivatedPosition = position;
}
+ 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 hide(int position) {
- content_adapter.hide(position);
+ public void hideAllBut(int position) {
+ int real_count = content_adapter.getCount();
+ for(int i = 0; i < real_count;)
+ if(i != position) {
+ content_adapter.hide(i);
+ position--;
+ real_count--;
+ } else {
+ i++;
+ }
}
public void unhideAll() {