Search in sources :

Example 6 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative 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 7 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative 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 8 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.

the class NativeThumbnailFragment method init_card_thumb_custom_source.

/**
     * This method builds a card with a custom source thumbnail
     */
private void init_card_thumb_custom_source() {
    //Create a Card
    Card card = new GplayCardCustomSource(getActivity());
    //Set card in the cardView
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_thumb_customsource);
    cardView.setCard(card);
}
Also used : GplayCardCustomSource(it.gmariotti.cardslib.demo.cards.GplayCardCustomSource) CustomThumbCard(it.gmariotti.cardslib.demo.cards.CustomThumbCard) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 9 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.

the class NativeHeaderFragment method init_standard_header_with_custom_other_button.

/**
     * This method builds a standard header with other button visible
     */
private void init_standard_header_with_custom_other_button() {
    //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));
    //Set visible the expand/collapse button
    header.setOtherButtonVisible(true);
    //Add a callback
    header.setOtherButtonClickListener(new CardHeader.OnClickCardHeaderOtherButtonListener() {

        @Override
        public void onButtonItemClick(Card card, View view) {
            Toast.makeText(getActivity(), "Click on Other Button", Toast.LENGTH_LONG).show();
        }
    });
    //Add Header to card
    card.addCardHeader(header);
    //Set card in the CardViewNative
    final CardViewNative cardViewNative = (CardViewNative) getActivity().findViewById(R.id.carddemo_header_other_button);
    cardViewNative.setCard(card);
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) ScrollView(android.widget.ScrollView) View(android.view.View) BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard) CustomExpandCard(it.gmariotti.cardslib.demo.cards.CustomExpandCard) CustomHeaderInnerCard(it.gmariotti.cardslib.demo.cards.CustomHeaderInnerCard) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 10 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.

the class NativeHeaderFragment method init_standard_header_with_custom_other_button_programmatically.

/**
     * This method builds a standard header with other button visible which drawable is defined programmatically
     */
private void init_standard_header_with_custom_other_button_programmatically() {
    //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));
    //Set visible the expand/collapse button
    header.setOtherButtonVisible(true);
    //Add a callback
    header.setOtherButtonClickListener(new CardHeader.OnClickCardHeaderOtherButtonListener() {

        @Override
        public void onButtonItemClick(Card card, View view) {
            Toast.makeText(getActivity(), "Click on Other Button", Toast.LENGTH_LONG).show();
        }
    });
    //Use this code to set your drawable
    if (Build.VERSION.SDK_INT >= Constants.API_L) {
        // Use the simple png. It is the src in image (Android-L uses the ripple)
        header.setOtherButtonDrawable(R.drawable.ic_action_add);
    } else {
        // Use a selector. It is the background in image
        header.setOtherButtonDrawable(R.drawable.card_menu_button_other_add);
    }
    //Add Header to card
    card.addCardHeader(header);
    //Set card in the CardViewNative
    final CardViewNative cardViewNative = (CardViewNative) getActivity().findViewById(R.id.carddemo_header_other_button_programmatically);
    cardViewNative.setCard(card);
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) ScrollView(android.widget.ScrollView) View(android.view.View) BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard) CustomExpandCard(it.gmariotti.cardslib.demo.cards.CustomExpandCard) CustomHeaderInnerCard(it.gmariotti.cardslib.demo.cards.CustomHeaderInnerCard) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Aggregations

CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)42 Card (it.gmariotti.cardslib.library.internal.Card)31 CardHeader (it.gmariotti.cardslib.library.internal.CardHeader)20 View (android.view.View)12 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)12 CustomCard (it.gmariotti.cardslib.demo.cards.CustomCard)11 CustomExpandCard (it.gmariotti.cardslib.demo.cards.CustomExpandCard)11 CustomHeaderInnerCard (it.gmariotti.cardslib.demo.cards.CustomHeaderInnerCard)11 ScrollView (android.widget.ScrollView)7 TextView (android.widget.TextView)6 CardExpand (it.gmariotti.cardslib.library.internal.CardExpand)6 MenuItem (android.view.MenuItem)4 CustomThumbCard (it.gmariotti.cardslib.demo.cards.CustomThumbCard)4 ViewToClickToExpand (it.gmariotti.cardslib.library.internal.ViewToClickToExpand)3 PopupMenu (android.widget.PopupMenu)2 GoogleNowBirthCard (it.gmariotti.cardslib.demo.cards.GoogleNowBirthCard)2 MayKnowCard (it.gmariotti.cardslib.demo.cards.MayKnowCard)2 SuggestedCard (it.gmariotti.cardslib.demo.cards.SuggestedCard)2 ProgressCard (it.gmariotti.cardslib.library.cards.ProgressCard)2 BaseSupplementalAction (it.gmariotti.cardslib.library.cards.actions.BaseSupplementalAction)2