Search in sources :

Example 1 with MayKnowCard

use of it.gmariotti.cardslib.demo.cards.MayKnowCard in project cardslib by gabrielemariotti.

the class NativeListDifferentInnerBaseFragment method initCards.

private void initCards() {
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 50; i++) {
        CardExample card = new CardExample(getActivity(), "My title " + i, "Inner text " + i);
        cards.add(card);
        CardExample2 cardx = new CardExample2(this.getActivity());
        cardx.title = "Application example " + i;
        cardx.secondaryTitle = "A company inc..." + i;
        cardx.rating = (float) (Math.random() * (5.0));
        cardx.count = i;
        cards.add(cardx);
        MayKnowCard card2 = new MayKnowCard(getActivity());
        //Very important with different inner layout
        card2.setType(2);
        card2.setSwipeable(true);
        cards.add(card2);
    }
    // Provide a custom adapter.
    // It is important to set the viewTypeCount
    // You have to provide in your card the type value with {@link Card#setType(int)} method.
    CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
    mCardArrayAdapter.setInnerViewTypeCount(3);
    // An alternative is to write a own CardArrayAdapter
    // MyCardArrayAdapter mCardArrayAdapter = new MyCardArrayAdapter(getActivity(),cards);
    CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_base1);
    if (listView != null) {
        listView.setAdapter(mCardArrayAdapter);
    }
}
Also used : MayKnowCard(it.gmariotti.cardslib.demo.cards.MayKnowCard) CardListView(it.gmariotti.cardslib.library.view.CardListView) ArrayList(java.util.ArrayList) CardArrayAdapter(it.gmariotti.cardslib.library.internal.CardArrayAdapter) BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard) Card(it.gmariotti.cardslib.library.internal.Card) MayKnowCard(it.gmariotti.cardslib.demo.cards.MayKnowCard)

Example 2 with MayKnowCard

use of it.gmariotti.cardslib.demo.cards.MayKnowCard in project cardslib by gabrielemariotti.

the class ListDifferentInnerBaseFragment method initCards.

private void initCards() {
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 50; i++) {
        CardExample card = new CardExample(getActivity(), "My title " + i, "Inner text " + i);
        cards.add(card);
        CardExample2 cardx = new CardExample2(this.getActivity());
        cardx.title = "Application example " + i;
        cardx.secondaryTitle = "A company inc..." + i;
        cardx.rating = (float) (Math.random() * (5.0));
        cardx.count = i;
        cards.add(cardx);
        MayKnowCard card2 = new MayKnowCard(getActivity());
        //Very important with different inner layout
        card2.setType(2);
        card2.setSwipeable(true);
        cards.add(card2);
    }
    // Provide a custom adapter.
    // It is important to set the viewTypeCount
    // You have to provide in your card the type value with {@link Card#setType(int)} method.
    CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
    mCardArrayAdapter.setInnerViewTypeCount(3);
    // An alternative is to write a own CardArrayAdapter
    // MyCardArrayAdapter mCardArrayAdapter = new MyCardArrayAdapter(getActivity(),cards);
    CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_base1);
    if (listView != null) {
        listView.setAdapter(mCardArrayAdapter);
    }
}
Also used : MayKnowCard(it.gmariotti.cardslib.demo.cards.MayKnowCard) CardListView(it.gmariotti.cardslib.library.view.CardListView) ArrayList(java.util.ArrayList) CardArrayAdapter(it.gmariotti.cardslib.library.internal.CardArrayAdapter) BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard) Card(it.gmariotti.cardslib.library.internal.Card) MayKnowCard(it.gmariotti.cardslib.demo.cards.MayKnowCard)

Example 3 with MayKnowCard

use of it.gmariotti.cardslib.demo.cards.MayKnowCard in project cardslib by gabrielemariotti.

the class NativeMiscCardFragment method initCardMayKnow.

/**
     * This method builds a simple card
     */
private void initCardMayKnow() {
    //Create a Card
    MayKnowCard card = new MayKnowCard(getActivity());
    card.setShadow(false);
    //Set card in the cardView
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_MayKnow);
    cardView.setCard(card);
    MayKnowCard card2 = new MayKnowCard(getActivity());
    card2.addCardHeader(null);
    card2.setShadow(true);
    CardViewNative mayView2 = (CardViewNative) getActivity().findViewById(R.id.carddemo_MayKnow2);
    mayView2.setCard(card2);
}
Also used : MayKnowCard(it.gmariotti.cardslib.demo.cards.MayKnowCard) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 4 with MayKnowCard

use of it.gmariotti.cardslib.demo.cards.MayKnowCard in project cardslib by gabrielemariotti.

the class MiscCardFragment method initCardMayKnow.

/**
     * This method builds a simple card
     */
private void initCardMayKnow() {
    //Create a Card
    MayKnowCard card = new MayKnowCard(getActivity());
    card.setShadow(false);
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_MayKnow);
    cardView.setCard(card);
    MayKnowCard card2 = new MayKnowCard(getActivity());
    card2.addCardHeader(null);
    card2.setShadow(true);
    CardView mayView2 = (CardView) getActivity().findViewById(R.id.carddemo_MayKnow2);
    mayView2.setCard(card2);
}
Also used : MayKnowCard(it.gmariotti.cardslib.demo.cards.MayKnowCard) CardView(it.gmariotti.cardslib.library.view.CardView)

Aggregations

MayKnowCard (it.gmariotti.cardslib.demo.cards.MayKnowCard)4 Card (it.gmariotti.cardslib.library.internal.Card)2 CardArrayAdapter (it.gmariotti.cardslib.library.internal.CardArrayAdapter)2 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)2 CardListView (it.gmariotti.cardslib.library.view.CardListView)2 ArrayList (java.util.ArrayList)2 CardView (it.gmariotti.cardslib.library.view.CardView)1 CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)1