Search in sources :

Example 1 with CardGridArrayAdapter

use of it.gmariotti.cardslib.library.internal.CardGridArrayAdapter 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 CardGridArrayAdapter

use of it.gmariotti.cardslib.library.internal.CardGridArrayAdapter 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 CardGridArrayAdapter

use of it.gmariotti.cardslib.library.internal.CardGridArrayAdapter in project cardslib by gabrielemariotti.

the class ListViewGridAnimationsFragment method initCard.

/**
     * This method builds a simple list of cards
     */
private void initCard() {
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 200; i++) {
        GplayGridCard card = new GplayGridCard(getActivity());
        //Only for test, use different titles and ratings
        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);
    }
    //Set the adapter
    mCardArrayAdapter = new CardGridArrayAdapter(getActivity(), cards);
    mListView = (CardGridView) getActivity().findViewById(R.id.carddemo_extras_grid_base1);
    if (mListView != null) {
        setAlphaAdapter();
    }
}
Also used : ArrayList(java.util.ArrayList) CardGridArrayAdapter(it.gmariotti.cardslib.library.internal.CardGridArrayAdapter) Card(it.gmariotti.cardslib.library.internal.Card) BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard)

Example 4 with CardGridArrayAdapter

use of it.gmariotti.cardslib.library.internal.CardGridArrayAdapter 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)4 CardGridArrayAdapter (it.gmariotti.cardslib.library.internal.CardGridArrayAdapter)4 ArrayList (java.util.ArrayList)4 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)3 CardGridView (it.gmariotti.cardslib.library.view.CardGridView)3