Search in sources :

Example 1 with CardExpandableListView

use of it.gmariotti.cardslib.library.view.CardExpandableListView in project cardslib by gabrielemariotti.

the class ExpandableListCardFragment method initCards.

private void initCards() {
    //Init an array of Cards
    SparseArray<BaseGroupExpandableCard<String>> cards = new SparseArray<BaseGroupExpandableCard<String>>();
    for (int i = 0; i < 50; i++) {
        List<String> children = new ArrayList<String>();
        for (int j = 0; j < 5; j++) {
            children.add("Sub item" + j);
        }
        BaseGroupExpandableCard card = new BaseGroupExpandableCard(this.getActivity(), children);
        card.setTitle("Application example " + i);
        cards.append(i, card);
    }
    CardExpandableListAdapter mCardArrayAdapter = new CardExpandableListAdapter(getActivity(), cards);
    CardExpandableListView listView = (CardExpandableListView) getActivity().findViewById(R.id.carddemo_list_expand);
    if (listView != null) {
        listView.setAdapter(mCardArrayAdapter);
    }
}
Also used : SparseArray(android.util.SparseArray) ArrayList(java.util.ArrayList) CardExpandableListAdapter(it.gmariotti.cardslib.library.internal.CardExpandableListAdapter) BaseGroupExpandableCard(it.gmariotti.cardslib.library.internal.BaseGroupExpandableCard) CardExpandableListView(it.gmariotti.cardslib.library.view.CardExpandableListView)

Aggregations

SparseArray (android.util.SparseArray)1 BaseGroupExpandableCard (it.gmariotti.cardslib.library.internal.BaseGroupExpandableCard)1 CardExpandableListAdapter (it.gmariotti.cardslib.library.internal.CardExpandableListAdapter)1 CardExpandableListView (it.gmariotti.cardslib.library.view.CardExpandableListView)1 ArrayList (java.util.ArrayList)1