use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class HeaderFragment method init_standard_header_with_custom_other_button_programmatically.
/**
* This method builds a standard header with other button visible which drawable is defined programmatically
*/
private void init_standard_header_with_custom_other_button_programmatically() {
//Create a Card
Card card = new Card(getActivity());
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
//Set visible the expand/collapse button
header.setOtherButtonVisible(true);
//Add a callback
header.setOtherButtonClickListener(new CardHeader.OnClickCardHeaderOtherButtonListener() {
@Override
public void onButtonItemClick(Card card, View view) {
Toast.makeText(getActivity(), "Click on Other Button", Toast.LENGTH_LONG).show();
}
});
//Use this code to set your drawable
header.setOtherButtonDrawable(R.drawable.card_menu_button_other_add);
//Add Header to card
card.addCardHeader(header);
//Set card in the CardView
final CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_header_other_button_programmatically);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class ListColorFragment method initCards.
private void initCards() {
//Init an array of Cards
ArrayList<Card> cards = new ArrayList<Card>();
for (int i = 0; i < 5; i++) {
ColorCard card = new ColorCard(this.getActivity());
card.setTitle("A simple colored card " + i);
card.setCount(i);
switch(i) {
case 0:
card.setBackgroundResourceId(R.drawable.demo_card_selector_color5);
break;
case 1:
card.setBackgroundResourceId(R.drawable.demo_card_selector_color4);
break;
case 2:
card.setBackgroundResourceId(R.drawable.demo_card_selector_color3);
break;
case 3:
card.setBackgroundResourceId(R.drawable.demo_card_selector_color2);
break;
case 4:
card.setBackgroundResourceId(R.drawable.demo_card_selector_color1);
break;
}
cards.add(card);
}
CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_colors);
if (listView != null) {
listView.setAdapter(mCardArrayAdapter);
}
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class ListExpandCardFragment method initCards.
private void initCards() {
//Init an array of Cards
ArrayList<Card> cards = new ArrayList<Card>();
for (int i = 0; i < 200; i++) {
Card card = init_standard_header_with_expandcollapse_button_custom_area("Header " + i, i);
cards.add(card);
}
CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_expand);
if (listView != null) {
listView.setAdapter(mCardArrayAdapter);
}
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class ListGplayCardFragment method initCards.
private void initCards() {
//Init an array of Cards
ArrayList<Card> cards = new ArrayList<Card>();
for (int i = 0; i < 200; i++) {
GooglePlaySmallCard card = new GooglePlaySmallCard(this.getActivity());
card.setTitle("Application example " + i);
card.setSecondaryTitle("A company inc..." + i);
card.setRating((float) (Math.random() * (5.0)));
card.count = i;
//Only for test, change some icons
if ((i > 10 && i < 15) || (i > 35 && i < 45)) {
card.setResourceIdThumbnail(R.drawable.ic_launcher);
}
card.init();
cards.add(card);
}
CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_gplaycard);
if (listView != null) {
listView.setAdapter(mCardArrayAdapter);
}
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class CardFragment method init_custom_card.
/**
* This method builds a custom card
*/
private void init_custom_card() {
//Create a Card
Card card = new CustomCard(getActivity());
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card3);
cardView.setCard(card);
}
Aggregations