Search in sources :

Example 1 with CardThumbnail

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();
        }
    });
}
Also used : TextView(android.widget.TextView) View(android.view.View) CardThumbnail(it.gmariotti.cardslib.library.internal.CardThumbnail) Card(it.gmariotti.cardslib.library.internal.Card)

Example 2 with CardThumbnail

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

Example 3 with CardThumbnail

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

Example 4 with CardThumbnail

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);
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) CardThumbnailView(it.gmariotti.cardslib.library.view.component.CardThumbnailView) TextView(android.widget.TextView) View(android.view.View) CardThumbnail(it.gmariotti.cardslib.library.internal.CardThumbnail) Card(it.gmariotti.cardslib.library.internal.Card)

Example 5 with CardThumbnail

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

Aggregations

CardThumbnail (it.gmariotti.cardslib.library.internal.CardThumbnail)10 Card (it.gmariotti.cardslib.library.internal.Card)9 CardHeader (it.gmariotti.cardslib.library.internal.CardHeader)6 View (android.view.View)5 CustomThumbCard (it.gmariotti.cardslib.demo.cards.CustomThumbCard)4 CardView (it.gmariotti.cardslib.library.view.CardView)4 TextView (android.widget.TextView)3 LayoutInflater (android.view.LayoutInflater)2 Crouton (de.keyboardsurfer.android.widget.crouton.Crouton)2 CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)2 PackageManager (android.content.pm.PackageManager)1 Bitmap (android.graphics.Bitmap)1 Canvas (android.graphics.Canvas)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Drawable (android.graphics.drawable.Drawable)1 MenuItem (android.view.MenuItem)1 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)1 CardThumbnailView (it.gmariotti.cardslib.library.view.component.CardThumbnailView)1