use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CardFragment method init_simple_card.
/**
* This method builds a simple card
*/
private void init_simple_card() {
//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));
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_id);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class MiscCardFragment method initCardSuggested.
/**
* This method builds a suggested card example
*/
private void initCardSuggested() {
SuggestedCard card = new SuggestedCard(getActivity());
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_suggested);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class MiscCardFragment method initCardMayKnow.
/**
* This method builds a simple card
*/
private void initCardMayKnow() {
//Create a Card
MayKnowCard card = new MayKnowCard(getActivity());
card.setShadow(false);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_MayKnow);
cardView.setCard(card);
MayKnowCard card2 = new MayKnowCard(getActivity());
card2.addCardHeader(null);
card2.setShadow(true);
CardView mayView2 = (CardView) getActivity().findViewById(R.id.carddemo_MayKnow2);
mayView2.setCard(card2);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class ThumbnailFragment method init_card_thumb_resourceId.
/**
* This method builds a card with a thumbnail with a resource ID
*/
private void init_card_thumb_resourceId() {
//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));
//Add header to a card
card.addCardHeader(header);
//Create thumbnail
CardThumbnail thumb = new CardThumbnail(getActivity());
//Set ID resource
thumb.setDrawableResource(R.drawable.carddemo_ic_gmaps_large);
//Add thumbnail to a card
card.addCardThumbnail(thumb);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_id);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class ThumbnailFragment method init_card_thumb_resourceURL_style.
/**
* This method builds a card with a thumbnail with a resource URL with a custom style
*/
private void init_card_thumb_resourceURL_style() {
//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));
card.addCardHeader(header);
//Create thumbnail
CustomThumbCard thumb = new CustomThumbCard(getActivity());
//Set URL resource
thumb.setUrlResource("https://lh5.googleusercontent.com/-N8bz9q4Kz0I/AAAAAAAAAAI/AAAAAAAAAAs/Icl2bQMyK7c/s265-c-k-no/photo.jpg");
//Error Resource ID
thumb.setErrorResource(R.drawable.ic_error_loadingorangesmall);
//Add thumbnail to a card
card.addCardThumbnail(thumb);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_style);
cardView.setCard(card);
}
Aggregations