Search in sources :

Example 21 with CardView

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

the class CroutonFragment method crouton1.

/**
     * This method builds a crouton card
     */
private void crouton1() {
    LayoutInflater mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = mInflater.inflate(R.layout.carddemo_extras_crouton_card, null);
    //CardView
    CardView cardView = (CardView) view.findViewById(R.id.carddemo_card_crouton_id);
    //Card
    Card card = new Card(getActivity());
    card.setTitle("Crouton Card");
    card.setBackgroundResourceId(R.color.demoextra_card_background_color2);
    //Add a cardThumbnail
    CardThumbnail thumb = new CardThumbnail(getActivity());
    thumb.setDrawableResource(R.drawable.ic_action_bulb);
    card.addCardThumbnail(thumb);
    cardView.setCard(card);
    //Make the crouton view
    final Crouton crouton;
    crouton = Crouton.make(getActivity(), view);
    crouton.show();
}
Also used : Crouton(de.keyboardsurfer.android.widget.crouton.Crouton) LayoutInflater(android.view.LayoutInflater) CardView(it.gmariotti.cardslib.library.view.CardView) View(android.view.View) CardView(it.gmariotti.cardslib.library.view.CardView) CardThumbnail(it.gmariotti.cardslib.library.internal.CardThumbnail) Card(it.gmariotti.cardslib.library.internal.Card)

Example 22 with CardView

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

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

the class CardFragment 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
    CardView cardView1 = (CardView) 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
    CardView cardView2 = (CardView) getActivity().findViewById(R.id.carddemo_example_card3_listeners2);
    cardView2.setCard(card2);
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) CardView(it.gmariotti.cardslib.library.view.CardView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View) CardView(it.gmariotti.cardslib.library.view.CardView) Card(it.gmariotti.cardslib.library.internal.Card) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard)

Example 24 with CardView

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

the class CardFragment method init_cab.

/**
     * Card with a CAB
     */
private void init_cab() {
    //Create a Card
    mCardCab = new Card(getActivity());
    //Create a CardHeader
    CardHeader header = new CardHeader(getActivity());
    //Set the header title
    header.setTitle(getString(R.string.demo_title_cab1));
    mCardCab.addCardHeader(header);
    //Set the card inner text
    mCardCab.setTitle(getString(R.string.demo_card_basetitle));
    //Set onClick listener
    mCardCab.setOnLongClickListener(new Card.OnLongCardClickListener() {

        @Override
        public boolean onLongClick(Card card, View view) {
            if (mActionMode != null) {
                view.setActivated(false);
                mActionMode.finish();
                return false;
            }
            // Start the CAB using the ActionMode.Callback defined above
            mActionMode = getActivity().startActionMode(mActionModeCallback);
            view.setActivated(true);
            return true;
        }
    });
    //Set card in the cardView
    cardViewCab = (CardView) getActivity().findViewById(R.id.carddemo_example_card_cab);
    cardViewCab.setCard(mCardCab);
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View) CardView(it.gmariotti.cardslib.library.view.CardView) Card(it.gmariotti.cardslib.library.internal.Card) CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard)

Example 25 with CardView

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

the class GPlayCardFragment method initCardGooglePlay.

/**
     * This method builds a simple card
     */
private void initCardGooglePlay() {
    //Create a Card
    GplayCard card = new GplayCard(getActivity());
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_Gplay1);
    cardView.setCard(card);
    //Create a Card
    GplayCard card2 = new GplayCard(getActivity());
    //Set card in the cardView
    CardView cardView2 = (CardView) getActivity().findViewById(R.id.carddemo_Gplay2);
    cardView2.setCard(card2);
    if (Utils.isTablet(getActivity())) {
        //Create a Card
        GplayCard card3 = new GplayCard(getActivity());
        //Set card in the cardView
        CardView cardView3 = (CardView) getActivity().findViewById(R.id.carddemo_Gplay3);
        if (cardView3 != null)
            cardView3.setCard(card3);
    }
}
Also used : GplayCard(it.gmariotti.cardslib.demo.cards.GplayCard) CardView(it.gmariotti.cardslib.library.view.CardView)

Aggregations

CardView (it.gmariotti.cardslib.library.view.CardView)40 Card (it.gmariotti.cardslib.library.internal.Card)31 CardHeader (it.gmariotti.cardslib.library.internal.CardHeader)20 CustomCard (it.gmariotti.cardslib.demo.cards.CustomCard)12 CustomExpandCard (it.gmariotti.cardslib.demo.cards.CustomExpandCard)11 CustomHeaderInnerCard (it.gmariotti.cardslib.demo.cards.CustomHeaderInnerCard)11 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)11 View (android.view.View)9 ScrollView (android.widget.ScrollView)7 CardExpand (it.gmariotti.cardslib.library.internal.CardExpand)6 TextView (android.widget.TextView)4 CustomThumbCard (it.gmariotti.cardslib.demo.cards.CustomThumbCard)4 CardThumbnail (it.gmariotti.cardslib.library.internal.CardThumbnail)4 MenuItem (android.view.MenuItem)3 ViewToClickToExpand (it.gmariotti.cardslib.library.internal.ViewToClickToExpand)3 LayoutInflater (android.view.LayoutInflater)2 PopupMenu (android.widget.PopupMenu)2 Crouton (de.keyboardsurfer.android.widget.crouton.Crouton)2 GoogleNowBirthCard (it.gmariotti.cardslib.demo.cards.GoogleNowBirthCard)2 MayKnowCard (it.gmariotti.cardslib.demo.cards.MayKnowCard)2