use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class CardExpandFragment method init_custom_card_expand.
/**
* This method builds a custom card with expand/collapse action clickable in all card view
*/
private void init_custom_card_expand() {
//Create a Card
CustomCard card = new CustomCard(getActivity());
//This provides a simple (and useless) expand area
CardExpand expand = new CardExpand(getActivity());
//Set inner title in Expand Area
expand.setTitle(getString(R.string.demo_expand_customtitle3));
card.addCardExpand(expand);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand2);
ViewToClickToExpand viewToClickToExpand = ViewToClickToExpand.builder().setupView(cardView);
card.setViewToClickToExpand(viewToClickToExpand);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class NativeHeaderFragment method init_standard_header_with_expandcollapse_button.
/**
* This method builds a standard header with base expand/collpase
*/
private void init_standard_header_with_expandcollapse_button() {
//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.setButtonExpandVisible(true);
//Add Header to card
card.addCardHeader(header);
//This provides a simple (and useless) expand area
CardExpand expand = new CardExpand(getActivity());
//Set inner title in Expand Area
expand.setTitle(getString(R.string.demo_expand_basetitle));
card.addCardExpand(expand);
//Set card in the CardViewNative
CardViewNative cardViewNative = (CardViewNative) getActivity().findViewById(R.id.carddemo_header_expand);
cardViewNative.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class NativeRecyclerViewFragment method initCard.
/**
* This method builds a simple list of cards
*/
private ArrayList<Card> initCard() {
//Init an array of Cards
ArrayList<Card> cards = new ArrayList<Card>();
for (int i = 0; i < 200; i++) {
Card card = new Card(this.getActivity());
card.setTitle("Application example " + i);
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
if (i < 10) {
//Add a popup menu. This method set OverFlow button to visible
header.setPopupMenu(R.menu.popupmain, new CardHeader.OnClickCardHeaderPopupMenuListener() {
@Override
public void onMenuItemClick(BaseCard card, MenuItem item) {
Toast.makeText(getActivity(), "Click on " + item.getTitle(), Toast.LENGTH_SHORT).show();
}
});
card.addCardHeader(header);
} else {
//Set visible the expand/collapse button
header.setButtonExpandVisible(true);
card.addCardHeader(header);
//This provides a simple (and useless) expand area
CardExpand expand = new CardExpand(getActivity());
//Set inner title in Expand Area
expand.setTitle(getString(R.string.demo_expand_basetitle));
card.addCardExpand(expand);
if (i == 12 || i == 17 || i == 19)
card.setExpanded(true);
}
//Add ClickListener
card.setOnClickListener(new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getActivity(), "Click Listener card=" + card.getTitle(), Toast.LENGTH_SHORT).show();
}
});
cards.add(card);
}
return cards;
}
Aggregations