Search in sources :

Example 1 with CardGridView

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

the class GridGplayFragment method initCards.

private void initCards() {
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 200; i++) {
        GplayGridCard card = new GplayGridCard(getActivity());
        card.headerTitle = "App example " + i;
        card.secondaryTitle = "Some text here " + i;
        card.rating = (float) (Math.random() * (5.0));
        //Only for test, change some icons
        if ((i % 6 == 0)) {
            card.resourceIdThumbnail = R.drawable.ic_ic_dh_bat;
        } else if ((i % 6 == 1)) {
            card.resourceIdThumbnail = R.drawable.ic_ic_dh_net;
        } else if ((i % 6 == 2)) {
            card.resourceIdThumbnail = R.drawable.ic_tris;
        } else if ((i % 6 == 3)) {
            card.resourceIdThumbnail = R.drawable.ic_info;
        } else if ((i % 6 == 4)) {
            card.resourceIdThumbnail = R.drawable.ic_smile;
        }
        card.init();
        cards.add(card);
    }
    CardGridArrayAdapter mCardArrayAdapter = new CardGridArrayAdapter(getActivity(), cards);
    CardGridView listView = (CardGridView) getActivity().findViewById(R.id.carddemo_grid_base1);
    if (listView != null) {
        listView.setAdapter(mCardArrayAdapter);
    }
}
Also used : ArrayList(java.util.ArrayList) CardGridArrayAdapter(it.gmariotti.cardslib.library.internal.CardGridArrayAdapter) CardGridView(it.gmariotti.cardslib.library.view.CardGridView) BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard) Card(it.gmariotti.cardslib.library.internal.Card)

Example 2 with CardGridView

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

the class NativeGridGplayFragment method initCards.

private void initCards() {
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 200; i++) {
        GplayGridCard card = new GplayGridCard(getActivity());
        card.headerTitle = "App example " + i;
        card.secondaryTitle = "Some text here " + i;
        card.rating = (float) (Math.random() * (5.0));
        //Only for test, change some icons
        if ((i % 6 == 0)) {
            card.resourceIdThumbnail = R.drawable.ic_ic_dh_bat;
        } else if ((i % 6 == 1)) {
            card.resourceIdThumbnail = R.drawable.ic_ic_dh_net;
        } else if ((i % 6 == 2)) {
            card.resourceIdThumbnail = R.drawable.ic_tris;
        } else if ((i % 6 == 3)) {
            card.resourceIdThumbnail = R.drawable.ic_info;
        } else if ((i % 6 == 4)) {
            card.resourceIdThumbnail = R.drawable.ic_smile;
        }
        card.init();
        cards.add(card);
    }
    CardGridArrayAdapter mCardArrayAdapter = new CardGridArrayAdapter(getActivity(), cards);
    CardGridView listView = (CardGridView) getActivity().findViewById(R.id.carddemo_grid_base1);
    if (listView != null) {
        listView.setAdapter(mCardArrayAdapter);
    }
}
Also used : ArrayList(java.util.ArrayList) CardGridArrayAdapter(it.gmariotti.cardslib.library.internal.CardGridArrayAdapter) CardGridView(it.gmariotti.cardslib.library.view.CardGridView) BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard) Card(it.gmariotti.cardslib.library.internal.Card)

Example 3 with CardGridView

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

the class GridBaseFragment method initCards.

private void initCards() {
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 200; i++) {
        GdriveGridCard card = new GdriveGridCard(getActivity());
        card.headerTitle = "Folder " + i;
        card.init();
        cards.add(card);
    }
    CardGridArrayAdapter mCardArrayAdapter = new CardGridArrayAdapter(getActivity(), cards);
    CardGridView gridView = (CardGridView) getActivity().findViewById(R.id.carddemo_grid_base);
    if (gridView != null) {
        gridView.setAdapter(mCardArrayAdapter);
    }
}
Also used : ArrayList(java.util.ArrayList) CardGridArrayAdapter(it.gmariotti.cardslib.library.internal.CardGridArrayAdapter) CardGridView(it.gmariotti.cardslib.library.view.CardGridView) Card(it.gmariotti.cardslib.library.internal.Card)

Aggregations

Card (it.gmariotti.cardslib.library.internal.Card)3 CardGridArrayAdapter (it.gmariotti.cardslib.library.internal.CardGridArrayAdapter)3 CardGridView (it.gmariotti.cardslib.library.view.CardGridView)3 ArrayList (java.util.ArrayList)3 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)2