Search in sources :

Example 1 with EdgeEffectExpandableListView

use of com.marshalchen.common.uimodule.edgeeffectoverride.EdgeEffectExpandableListView in project UltimateAndroid by cymcsg.

the class ExpandableListViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.edge_effect_expandablelistview_layout);
    //this comes from android samples
    List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
    List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
    for (int i = 0; i < 20; i++) {
        Map<String, String> curGroupMap = new HashMap<String, String>();
        groupData.add(curGroupMap);
        curGroupMap.put(NAME, "Group " + i);
        curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is even" : "This group is odd");
        List<Map<String, String>> children = new ArrayList<Map<String, String>>();
        for (int j = 0; j < 15; j++) {
            Map<String, String> curChildMap = new HashMap<String, String>();
            children.add(curChildMap);
            curChildMap.put(NAME, "Child " + j);
            curChildMap.put(IS_EVEN, (j % 2 == 0) ? "This child is even" : "This child is odd");
        }
        childData.add(children);
    }
    // Set up our adapter
    ((EdgeEffectExpandableListView) findViewById(R.id.expandablelistview)).setAdapter(new SimpleExpandableListAdapter(this, groupData, android.R.layout.simple_expandable_list_item_1, new String[] { NAME, IS_EVEN }, new int[] { android.R.id.text1, android.R.id.text2 }, childData, android.R.layout.simple_expandable_list_item_2, new String[] { NAME, IS_EVEN }, new int[] { android.R.id.text1, android.R.id.text2 }));
}
Also used : HashMap(java.util.HashMap) EdgeEffectExpandableListView(com.marshalchen.common.uimodule.edgeeffectoverride.EdgeEffectExpandableListView) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) SimpleExpandableListAdapter(android.widget.SimpleExpandableListAdapter) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

SimpleExpandableListAdapter (android.widget.SimpleExpandableListAdapter)1 EdgeEffectExpandableListView (com.marshalchen.common.uimodule.edgeeffectoverride.EdgeEffectExpandableListView)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1