use of it.gmariotti.cardslib.demo.cards.CustomThumbCard in project cardslib by gabrielemariotti.
the class NativeThumbnailFragment 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
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_thumb_style);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.demo.cards.CustomThumbCard 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