use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class NativeFabFragment 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;
}
use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class NativeCardExpandFragment 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
CardViewNative cardView = (CardViewNative) 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 NativeCardExpandFragment method init_custom_card_expand_clicking_image.
/**
* This method builds a custom card with expand/collapse action clickable in all card view
*/
private void init_custom_card_expand_clicking_image() {
//Create a Card
Card card = new Card(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);
CustomThumbnail thumb = new CustomThumbnail(getActivity());
thumb.setDrawableResource(R.drawable.ic_smile);
card.addCardThumbnail(thumb);
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card_expand4);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class NativeCardExpandFragment method init_standard_header_with_expandcollapse_button.
/**
* This method builds a standard header with base expand/collapse
*/
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_customtitle3));
card.addCardExpand(expand);
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card_expand1);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class NativeCardExpandFragment method init_custom_card_expand_programmatic.
/**
* This method builds a card with a collpse/expand action in programmatic way
*/
private void init_custom_card_expand_programmatic() {
//Create a Card
final Card card = new Card(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);
ViewToClickToExpand viewToClickToExpand = ViewToClickToExpand.builder().enableForExpandAction();
card.setViewToClickToExpand(viewToClickToExpand);
TextView tx = (TextView) getActivity().findViewById(R.id.carddemo_example_card_expand6_text);
tx.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
card.doToogleExpand();
}
});
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card_expand6);
cardView.setCard(card);
}
Aggregations