Search in sources :

Example 1 with StickyCardListView

use of it.gmariotti.cardslib.demo.extras.stickylist.StickyCardListView 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);
    }
}
Also used : StickyCardArrayAdapter(it.gmariotti.cardslib.demo.extras.stickylist.StickyCardArrayAdapter) StickyCardListView(it.gmariotti.cardslib.demo.extras.stickylist.StickyCardListView) ArrayList(java.util.ArrayList) PicassoCard(it.gmariotti.cardslib.demo.extras.cards.PicassoCard) PicassoCard(it.gmariotti.cardslib.demo.extras.cards.PicassoCard) Card(it.gmariotti.cardslib.library.internal.Card)

Aggregations

PicassoCard (it.gmariotti.cardslib.demo.extras.cards.PicassoCard)1 StickyCardArrayAdapter (it.gmariotti.cardslib.demo.extras.stickylist.StickyCardArrayAdapter)1 StickyCardListView (it.gmariotti.cardslib.demo.extras.stickylist.StickyCardListView)1 Card (it.gmariotti.cardslib.library.internal.Card)1 ArrayList (java.util.ArrayList)1