use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CardExpandFragment 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
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand6);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CardFragment 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
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card3_clickable);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CardFragment method init_card_inner_layout.
/**
* This method builds a simple card with a custom inner layout
*/
private void init_card_inner_layout() {
//Create a Card
Card card = new Card(getActivity(), R.layout.carddemo_example_inner_content);
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
card.addCardHeader(header);
//Set the card inner text
card.setTitle(getString(R.string.demo_card_basetitle));
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_card_inner);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CardWithListFragment method initCard.
/**
* This method builds a simple card
*/
private void initCard() {
//Weather Card
card = new WeatherCard(getActivity());
card.init();
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_weathercard);
cardView.setCard(card);
//May know card
GoogleKnowwithList card2 = new GoogleKnowwithList(getActivity());
card2.init();
//Set card in the cardView
CardView cardView2 = (CardView) getActivity().findViewById(R.id.carddemo_mayknowcard);
cardView2.setCard(card2);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CroutonFragment method crouton2.
/**
* This method builds another crouton card
*/
private void crouton2() {
LayoutInflater mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = mInflater.inflate(R.layout.carddemo_extras_crouton_card, null);
//Card View
CardView cardView = (CardView) view.findViewById(R.id.carddemo_card_crouton_id);
//Card
Card card = new Card(getActivity());
card.setTitle("Crouton Card");
//Add a CardThumbnail
CardThumbnail thumb = new CardThumbnail(getActivity());
thumb.setDrawableResource(R.drawable.ic_action_halt);
card.addCardThumbnail(thumb);
cardView.setCard(card);
//Make the crouton view
final Crouton crouton;
crouton = Crouton.make(getActivity(), view);
crouton.show();
}
Aggregations