Search in sources :

Example 6 with CustomCard

use of it.gmariotti.cardslib.demo.cards.CustomCard 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 7 with CustomCard

use of it.gmariotti.cardslib.demo.cards.CustomCard in project cardslib by gabrielemariotti.

the class CardFragment method init_custom_card_swipe.

/**
     * This method builds a custom card with a swipe action
     */
private void init_custom_card_swipe() {
    //Create a Card
    CustomCard card = new CustomCard(getActivity());
    //Enable a swipe action
    card.setSwipeable(true);
    //You can set a SwipeListener.
    card.setOnSwipeListener(new Card.OnSwipeListener() {

        @Override
        public void onSwipe(Card card) {
            if (mTextViewSwipe != null)
                mTextViewSwipe.setVisibility(View.GONE);
        }
    });
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card3_swipe);
    cardView.setCard(card);
}
Also used : CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard) CardView(it.gmariotti.cardslib.library.view.CardView) Card(it.gmariotti.cardslib.library.internal.Card) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard)

Example 8 with CustomCard

use of it.gmariotti.cardslib.demo.cards.CustomCard in project cardslib by gabrielemariotti.

the class CardExpandFragment method init_custom_card_expand.

/**
     * This method builds a custom card with expand/collapse action clickable in all card view
     */
private void init_custom_card_expand() {
    //Create a Card
    CustomCard card = new CustomCard(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);
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand2);
    ViewToClickToExpand viewToClickToExpand = ViewToClickToExpand.builder().setupView(cardView);
    card.setViewToClickToExpand(viewToClickToExpand);
    cardView.setCard(card);
}
Also used : ViewToClickToExpand(it.gmariotti.cardslib.library.internal.ViewToClickToExpand) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard) CardExpand(it.gmariotti.cardslib.library.internal.CardExpand) CardView(it.gmariotti.cardslib.library.view.CardView)

Aggregations

CustomCard (it.gmariotti.cardslib.demo.cards.CustomCard)8 Card (it.gmariotti.cardslib.library.internal.Card)6 CardView (it.gmariotti.cardslib.library.view.CardView)4 CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)4 View (android.view.View)2 ScrollView (android.widget.ScrollView)2 TextView (android.widget.TextView)2 CardExpand (it.gmariotti.cardslib.library.internal.CardExpand)2 ViewToClickToExpand (it.gmariotti.cardslib.library.internal.ViewToClickToExpand)2