Search in sources :

Example 11 with CardExpand

use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.

the class GoogleNowBirthCard method init.

private void init() {
    //Add Header
    GoogleNowBirthHeader header = new GoogleNowBirthHeader(getContext(), R.layout.carddemo_googlenowbirth_inner_header);
    header.setButtonExpandVisible(true);
    header.mName = "Gabriele Mariotti";
    header.mSubName = "Birthday today";
    addCardHeader(header);
    //Add Expand Area
    CardExpand expand = new GoogleNowExpandCard(getContext());
    addCardExpand(expand);
    //Set clickListener
    setOnClickListener(new OnCardClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getContext(), "Click Listener card", Toast.LENGTH_LONG).show();
        }
    });
    //Add Thumbnail
    GoogleNowBirthThumb thumbnail = new GoogleNowBirthThumb(getContext());
    float density = getContext().getResources().getDisplayMetrics().density;
    int size = (int) (125 * density);
    thumbnail.setUrlResource("https://lh5.googleusercontent.com/-squZd7FxR8Q/UyN5UrsfkqI/AAAAAAAAbAo/VoDHSYAhC_E/s" + size + "/new%2520profile%2520%25282%2529.jpg");
    thumbnail.setErrorResource(R.drawable.ic_ic_error_loading);
    addCardThumbnail(thumbnail);
}
Also used : CardExpand(it.gmariotti.cardslib.library.internal.CardExpand) TextView(android.widget.TextView) View(android.view.View) Card(it.gmariotti.cardslib.library.internal.Card)

Example 12 with CardExpand

use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.

the class GoogleNowStockCard method init.

private void init() {
    //Add Header
    CardHeader header = new CardHeader(getContext());
    header.setButtonExpandVisible(true);
    //should use R.string.
    header.setTitle("Stocks today");
    addCardHeader(header);
    //Add expand
    CardExpand expand = new GoogleNowExpandCard(getContext());
    addCardExpand(expand);
    //Add onClick Listener
    setOnClickListener(new OnCardClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getContext(), "Click Listener card=", Toast.LENGTH_LONG).show();
        }
    });
    //Add swipe Listener
    setOnSwipeListener(new OnSwipeListener() {

        @Override
        public void onSwipe(Card card) {
            Toast.makeText(getContext(), "Card removed", Toast.LENGTH_LONG).show();
        }
    });
}
Also used : CardExpand(it.gmariotti.cardslib.library.internal.CardExpand) CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) TextView(android.widget.TextView) View(android.view.View) Card(it.gmariotti.cardslib.library.internal.Card)

Example 13 with CardExpand

use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.

the class GoogleNowBirthCard method init.

private void init() {
    //Add Header
    GoogleNowBirthHeader header = new GoogleNowBirthHeader(getContext(), R.layout.carddemo_extras_googlenowbirth_inner_header);
    header.setButtonExpandVisible(true);
    header.mName = "Gabriele Mariotti";
    header.mSubName = "Birthday today";
    addCardHeader(header);
    //Add Expand Area
    CardExpand expand = new GoogleNowExpandCard(getContext());
    addCardExpand(expand);
    //Set clickListener
    setOnClickListener(new OnCardClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getContext(), "Click Listener card", Toast.LENGTH_LONG).show();
        }
    });
    //Add Thumbnail
    GoogleNowBirthThumb thumbnail = new GoogleNowBirthThumb(getContext());
    //You need to set true to use an external library
    thumbnail.setExternalUsage(true);
    addCardThumbnail(thumbnail);
}
Also used : CardExpand(it.gmariotti.cardslib.library.internal.CardExpand) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) Card(it.gmariotti.cardslib.library.internal.Card)

Example 14 with CardExpand

use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.

the class CardExpandFragment method init_standard_header_with_expandcollapse_button.

/**
     * This method builds a standard header with base expand/collapse
     */
private void init_standard_header_with_expandcollapse_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.setButtonExpandVisible(true);
    //Add Header to card
    card.addCardHeader(header);
    //This provides a simple (and useless) expand area
    CardExpand expand = new CardExpand(getActivity());
    //Set inner title in Expand Area
    expand.setTitle(getString(R.string.demo_expand_customtitle3));
    card.addCardExpand(expand);
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand1);
    cardView.setCard(card);
}
Also used : CardExpand(it.gmariotti.cardslib.library.internal.CardExpand) CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) CardView(it.gmariotti.cardslib.library.view.CardView) Card(it.gmariotti.cardslib.library.internal.Card) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard)

Example 15 with CardExpand

use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.

the class CardExpandFragment method init_custom_card_expand_clicking_image.

/**
     * This method builds a custom card with expand/collapse action clickable in all card view
     */
private void init_custom_card_expand_clicking_image() {
    //Create a Card
    Card card = new Card(getActivity());
    //This provides a simple (and useless) expand area
    CardExpand expand = new CardExpand(getActivity());
    //Set inner title in Expand Area
    expand.setTitle(getString(R.string.demo_expand_customtitle3));
    card.addCardExpand(expand);
    CustomThumbnail thumb = new CustomThumbnail(getActivity());
    thumb.setDrawableResource(R.drawable.ic_smile);
    card.addCardThumbnail(thumb);
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand4);
    cardView.setCard(card);
}
Also used : CardExpand(it.gmariotti.cardslib.library.internal.CardExpand) CardView(it.gmariotti.cardslib.library.view.CardView) Card(it.gmariotti.cardslib.library.internal.Card) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard)

Aggregations

CardExpand (it.gmariotti.cardslib.library.internal.CardExpand)18 Card (it.gmariotti.cardslib.library.internal.Card)14 View (android.view.View)8 CustomCard (it.gmariotti.cardslib.demo.cards.CustomCard)8 CardHeader (it.gmariotti.cardslib.library.internal.CardHeader)8 CardView (it.gmariotti.cardslib.library.view.CardView)6 CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)6 TextView (android.widget.TextView)5 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)5 ViewToClickToExpand (it.gmariotti.cardslib.library.internal.ViewToClickToExpand)4 MenuItem (android.view.MenuItem)3 ImageView (android.widget.ImageView)3 ArrayList (java.util.ArrayList)3 ScrollView (android.widget.ScrollView)2 CustomExpandCard (it.gmariotti.cardslib.demo.cards.CustomExpandCard)2 CustomHeaderInnerCard (it.gmariotti.cardslib.demo.cards.CustomHeaderInnerCard)2 CardRecyclerView (it.gmariotti.cardslib.library.recyclerview.view.CardRecyclerView)2 CardListView (it.gmariotti.cardslib.library.view.CardListView)1