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);
}
}
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);
}
}
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);
}
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);
}
Aggregations