use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.
the class NativeCardFragment method init_custom_card_partial_listener.
/**
* This method builds a custom card with a swipe action
*/
private void init_custom_card_partial_listener() {
//Create a Card
Card card1 = new Card(getActivity(), R.layout.carddemo_example_inner_content);
CardHeader header1 = new CardHeader(getActivity());
header1.setTitle(getString(R.string.demo_custom_shorttitle));
card1.addCardHeader(header1);
//Set the card inner text
card1.setTitle(getString(R.string.demo_card_shorttitle));
//Set a clickListener on ContentArea
card1.addPartialOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW, new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getActivity(), "Click on Content Area", Toast.LENGTH_LONG).show();
}
});
//Set card in the cardView
CardViewNative cardView1 = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card3_listeners1);
cardView1.setCard(card1);
//----------------------------------------------------------------------------------
//Create a Card
Card card2 = new Card(getActivity(), R.layout.carddemo_example_inner_content);
CardHeader header2 = new CardHeader(getActivity());
header2.setTitle(getString(R.string.demo_custom_shorttitle));
card2.addCardHeader(header2);
//Set the card inner text
card2.setTitle(getString(R.string.demo_card_shorttitle));
//Set a clickListener on Header Area
card2.addPartialOnClickListener(Card.CLICK_LISTENER_HEADER_VIEW, new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getActivity(), "Click on Header Area", Toast.LENGTH_LONG).show();
}
});
//Set card in the cardView
CardViewNative cardView2 = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card3_listeners2);
cardView2.setCard(card2);
}
use of it.gmariotti.cardslib.library.view.CardViewNative 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.library.view.CardViewNative in project cardslib by gabrielemariotti.
the class NativeBirthDayCardFragment method init3.
private void init3() {
GoogleNowBirthCard card3 = new GoogleNowBirthCard(getActivity());
card3.setId("myId3");
card3.USE_VIGNETTE = 2;
//Set card in the cardView
CardViewNative cardView3 = (CardViewNative) getActivity().findViewById(R.id.carddemo_cardBirth3);
cardView3.setCard(card3);
}
use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.
the class NativeCardExpandFragment method init_custom_card_expand_inside.
/**
* This method builds a card with a collpse/expand section inside
*/
private void init_custom_card_expand_inside() {
//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_expand_area_inside));
//Add Header to card
card.addCardHeader(header);
//This provides a simple (and useless) expand area
CardExpandInside expand = new CardExpandInside(getActivity());
card.addCardExpand(expand);
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card_expand5);
ViewToClickToExpand viewToClickToExpand = ViewToClickToExpand.builder().highlightView(false).setupView(cardView);
card.setViewToClickToExpand(viewToClickToExpand);
card.setOnExpandAnimatorEndListener(new Card.OnExpandAnimatorEndListener() {
@Override
public void onExpandEnd(Card card) {
/*
if (mScrollView!=null){
mScrollView.post(new Runnable() {
public void run() {
mScrollView.scrollTo(0, mScrollView.getBottom());
}
});
}*/
}
});
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardViewNative 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