use of it.gmariotti.cardslib.library.internal.CardThumbnail in project cardslib by gabrielemariotti.
the class GooglePlaySmallCard method init.
private void init() {
// Add thumbnail
CardThumbnail cardThumbnail = new CardThumbnail(mContext);
cardThumbnail.setDrawableResource(R.drawable.carddemo_ic_gmaps);
addCardThumbnail(cardThumbnail);
// Add ClickListener
setOnClickListener(new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getContext(), "Click Listener card=", Toast.LENGTH_LONG).show();
}
});
}
use of it.gmariotti.cardslib.library.internal.CardThumbnail in project cardslib by gabrielemariotti.
the class NativeThumbnailFragment 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
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_thumb_id);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardThumbnail in project cardslib by gabrielemariotti.
the class NativeThumbnailFragment method init_card_thumb_resourceURL.
/**
* This method builds a card with a thumbnail with a resource URL
*/
private void init_card_thumb_resourceURL() {
// 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
CardThumbnail thumb = new CardThumbnail(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_url);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardThumbnail in project cardslib by gabrielemariotti.
the class MayKnowCard method init.
private void init() {
// Add Header
CardHeader header = new MayKnowCardHeader(getContext(), R.layout.carddemo_mayknow_inner_header);
header.setTitle(getContext().getString(R.string.may_know_card_title));
addCardHeader(header);
setShadow(false);
// Add Thumbnail
CardThumbnail thumbnail = new CardThumbnail(getContext());
thumbnail.setUrlResource("https://lh5.googleusercontent.com/-squZd7FxR8Q/UyN5UrsfkqI/AAAAAAAAbAo/VoDHSYAhC_E/s72/new%2520profile%2520%25282%2529.jpg");
thumbnail.setErrorResource(R.drawable.ic_error_loadingsmall);
addCardThumbnail(thumbnail);
OnCardClickListener clickListener = new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
// Do something
}
};
addPartialOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW, clickListener);
}
use of it.gmariotti.cardslib.library.internal.CardThumbnail in project cardslib by gabrielemariotti.
the class ThumbnailFragment method init_card_thumb_resourceURL.
/**
* This method builds a card with a thumbnail with a resource URL
*/
private void init_card_thumb_resourceURL() {
// 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
CardThumbnail thumb = new CardThumbnail(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_url);
cardView.setCard(card);
}
Aggregations