Search in sources :

Example 26 with CardViewNative

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

the class NativeCardFragment method init_custom_card_partial_listener.

/**
     * This method builds a custom card with a swipe action
     */
private void init_custom_card_partial_listener() {
    //Create a Card
    Card card1 = new Card(getActivity(), R.layout.carddemo_example_inner_content);
    CardHeader header1 = new CardHeader(getActivity());
    header1.setTitle(getString(R.string.demo_custom_shorttitle));
    card1.addCardHeader(header1);
    //Set the card inner text
    card1.setTitle(getString(R.string.demo_card_shorttitle));
    //Set a clickListener on ContentArea
    card1.addPartialOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW, new Card.OnCardClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getActivity(), "Click on Content Area", Toast.LENGTH_LONG).show();
        }
    });
    //Set card in the cardView
    CardViewNative cardView1 = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card3_listeners1);
    cardView1.setCard(card1);
    //----------------------------------------------------------------------------------
    //Create a Card
    Card card2 = new Card(getActivity(), R.layout.carddemo_example_inner_content);
    CardHeader header2 = new CardHeader(getActivity());
    header2.setTitle(getString(R.string.demo_custom_shorttitle));
    card2.addCardHeader(header2);
    //Set the card inner text
    card2.setTitle(getString(R.string.demo_card_shorttitle));
    //Set a clickListener on Header Area
    card2.addPartialOnClickListener(Card.CLICK_LISTENER_HEADER_VIEW, new Card.OnCardClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getActivity(), "Click on Header Area", Toast.LENGTH_LONG).show();
        }
    });
    //Set card in the cardView
    CardViewNative cardView2 = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card3_listeners2);
    cardView2.setCard(card2);
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View) Card(it.gmariotti.cardslib.library.internal.Card) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 27 with CardViewNative

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

the class NativeCardFragment method init_custom_card_clickable.

/**
     * This method builds a custom card clickable
     */
private void init_custom_card_clickable() {
    //Create a Card
    CustomCard card = new CustomCard(getActivity());
    //Set onClick listener
    card.setOnClickListener(new Card.OnCardClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getActivity(), "Clickable card", Toast.LENGTH_LONG).show();
        }
    });
    //Set card in the cardView
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card3_clickable);
    cardView.setCard(card);
}
Also used : CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View) Card(it.gmariotti.cardslib.library.internal.Card) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 28 with CardViewNative

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

the class NativeBirthDayCardFragment method init3.

private void init3() {
    GoogleNowBirthCard card3 = new GoogleNowBirthCard(getActivity());
    card3.setId("myId3");
    card3.USE_VIGNETTE = 2;
    //Set card in the cardView
    CardViewNative cardView3 = (CardViewNative) getActivity().findViewById(R.id.carddemo_cardBirth3);
    cardView3.setCard(card3);
}
Also used : GoogleNowBirthCard(it.gmariotti.cardslib.demo.cards.GoogleNowBirthCard) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 29 with CardViewNative

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

the class NativeCardExpandFragment method init_custom_card_expand_inside.

/**
     * This method builds a card with a collpse/expand section inside
     */
private void init_custom_card_expand_inside() {
    //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_expand_area_inside));
    //Add Header to card
    card.addCardHeader(header);
    //This provides a simple (and useless) expand area
    CardExpandInside expand = new CardExpandInside(getActivity());
    card.addCardExpand(expand);
    //Set card in the cardView
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card_expand5);
    ViewToClickToExpand viewToClickToExpand = ViewToClickToExpand.builder().highlightView(false).setupView(cardView);
    card.setViewToClickToExpand(viewToClickToExpand);
    card.setOnExpandAnimatorEndListener(new Card.OnExpandAnimatorEndListener() {

        @Override
        public void onExpandEnd(Card card) {
        /*
                if (mScrollView!=null){
                    mScrollView.post(new Runnable() {
                        public void run() {
                            mScrollView.scrollTo(0, mScrollView.getBottom());
                        }
                    });
                }*/
        }
    });
    cardView.setCard(card);
}
Also used : ViewToClickToExpand(it.gmariotti.cardslib.library.internal.ViewToClickToExpand) CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) Card(it.gmariotti.cardslib.library.internal.Card) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 30 with CardViewNative

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

the class NativeCardExpandFragment method init_custom_card_expand_programmatic.

/**
     * This method builds a card with a collpse/expand action in programmatic way
     */
private void init_custom_card_expand_programmatic() {
    //Create a Card
    final 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);
    ViewToClickToExpand viewToClickToExpand = ViewToClickToExpand.builder().enableForExpandAction();
    card.setViewToClickToExpand(viewToClickToExpand);
    TextView tx = (TextView) getActivity().findViewById(R.id.carddemo_example_card_expand6_text);
    tx.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            card.doToogleExpand();
        }
    });
    //Set card in the cardView
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card_expand6);
    cardView.setCard(card);
}
Also used : ViewToClickToExpand(it.gmariotti.cardslib.library.internal.ViewToClickToExpand) CardExpand(it.gmariotti.cardslib.library.internal.CardExpand) TextView(android.widget.TextView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View) Card(it.gmariotti.cardslib.library.internal.Card) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard) 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