Search in sources :

Example 1 with CustomThumbCard

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);
}
Also used : CustomThumbCard(it.gmariotti.cardslib.demo.cards.CustomThumbCard) CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) CustomThumbCard(it.gmariotti.cardslib.demo.cards.CustomThumbCard) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 2 with CustomThumbCard

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);
}
Also used : CustomThumbCard(it.gmariotti.cardslib.demo.cards.CustomThumbCard) CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) CardView(it.gmariotti.cardslib.library.view.CardView) CustomThumbCard(it.gmariotti.cardslib.demo.cards.CustomThumbCard) Card(it.gmariotti.cardslib.library.internal.Card)

Aggregations

CustomThumbCard (it.gmariotti.cardslib.demo.cards.CustomThumbCard)2 Card (it.gmariotti.cardslib.library.internal.Card)2 CardHeader (it.gmariotti.cardslib.library.internal.CardHeader)2 CardView (it.gmariotti.cardslib.library.view.CardView)1 CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)1