summaryrefslogtreecommitdiff
path: root/src/se/leap/bitmaskclient
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-08-29 10:13:56 +0200
committercyBerta <richy@cyborgsociety.org>2013-11-15 23:25:16 +0100
commit54cd37ae861e57b33c0a6f1b6b5098da848ec05b (patch)
treefed36f614ac1cd6e5b106cf0ec1b5eda70b82093 /src/se/leap/bitmaskclient
parent6d5838ae7d1ffb022c28ce7d6a20a0045cb56e70 (diff)
Added a custom adapter to the ProviderListFragment
I've created a new adapter using code from http://www.sherif.mobi/2012/01/listview-with-ability-to-hide-rows.html and my own getView (moved from ProviderListFragment).
Diffstat (limited to 'src/se/leap/bitmaskclient')
-rw-r--r--src/se/leap/bitmaskclient/ProviderListFragment.java25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java
index 05cd4b78..b9a10925 100644
--- a/src/se/leap/bitmaskclient/ProviderListFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderListFragment.java
@@ -26,8 +26,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
-import android.content.Context;
-import android.widget.TwoLineListItem;
/**
* A list fragment representing a list of Providers. This fragment
@@ -91,27 +89,12 @@ public class ProviderListFragment extends ListFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- content_adapter = new ArrayAdapter<ProviderListContent.ProviderItem>(
+ content_adapter = new ProviderListAdapter<ProviderListContent.ProviderItem>(
getActivity(),
android.R.layout.simple_list_item_activated_2,
- ProviderListContent.ITEMS) {
- @Override
- public View getView(int position, View convertView, ViewGroup parent){
- TwoLineListItem row;
- if (convertView == null) {
- LayoutInflater inflater = (LayoutInflater)getActivity().getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- row = (TwoLineListItem)inflater.inflate(android.R.layout.simple_list_item_2, null);
- } else {
- row = (TwoLineListItem)convertView;
- }
- ProviderListContent.ProviderItem data = ProviderListContent.ITEMS.get(position);
- row.getText1().setText(data.domain);
- row.getText2().setText(data.name);
-
- return row;
- }
- };
- setListAdapter(content_adapter);
+ ProviderListContent.ITEMS);
+
+ setListAdapter(content_adapter);
}
@Override