use of it.gmariotti.cardslib.demo.extras.stickylist.StickyCardArrayAdapter in project cardslib by gabrielemariotti.
the class StickyListHeadersFragment method initCard.
/**
* This method builds a simple list of cards
*/
private void initCard() {
//Init an array of Cards
ArrayList<Card> cards = new ArrayList<Card>();
for (int i = 0; i < 200; i++) {
PicassoCard card = new PicassoCard(this.getActivity());
//Use the first letter for sticky
String firstLetter = calculateFirstLetter(i);
card.setTitle(firstLetter + " : simple title " + i);
card.setSecondaryTitle("Simple text..." + i);
card.setCount(i);
cards.add(card);
}
//Set the adapter
StickyCardArrayAdapter adapter = new StickyCardArrayAdapter(getActivity(), cards);
StickyCardListView stickyList = (StickyCardListView) getActivity().findViewById(R.id.carddemo_extra_sticky_list);
//stickyList.setAreHeadersSticky(false);
if (stickyList != null) {
stickyList.setAdapter(adapter);
}
}
Aggregations