use of it.gmariotti.cardslib.demo.cards.CustomCard in project cardslib by gabrielemariotti.
the class NativeCardFragment method init_custom_card_clickable.
/**
* This method builds a custom card clickable
*/
private void init_custom_card_clickable() {
//Create a Card
CustomCard card = new CustomCard(getActivity());
//Set onClick listener
card.setOnClickListener(new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getActivity(), "Clickable card", Toast.LENGTH_LONG).show();
}
});
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card3_clickable);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.demo.cards.CustomCard in project cardslib by gabrielemariotti.
the class CardFragment method init_custom_card_swipe.
/**
* This method builds a custom card with a swipe action
*/
private void init_custom_card_swipe() {
//Create a Card
CustomCard card = new CustomCard(getActivity());
//Enable a swipe action
card.setSwipeable(true);
//You can set a SwipeListener.
card.setOnSwipeListener(new Card.OnSwipeListener() {
@Override
public void onSwipe(Card card) {
if (mTextViewSwipe != null)
mTextViewSwipe.setVisibility(View.GONE);
}
});
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card3_swipe);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.demo.cards.CustomCard 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);
}
Aggregations