Search in sources :

Example 16 with CardView

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

the class CardExpandFragment 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
    CardView cardView = (CardView) 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) CardView(it.gmariotti.cardslib.library.view.CardView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) 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 17 with CardView

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

the class CardFragment 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
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card3_clickable);
    cardView.setCard(card);
}
Also used : CustomCard(it.gmariotti.cardslib.demo.cards.CustomCard) 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 18 with CardView

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

the class CardFragment method init_card_inner_layout.

/**
     * This method builds a simple card with a custom inner layout
     */
private void init_card_inner_layout() {
    //Create a Card
    Card card = new Card(getActivity(), R.layout.carddemo_example_inner_content);
    //Create a CardHeader
    CardHeader header = new CardHeader(getActivity());
    //Set the header title
    header.setTitle(getString(R.string.demo_header_basetitle));
    card.addCardHeader(header);
    //Set the card inner text
    card.setTitle(getString(R.string.demo_card_basetitle));
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_card_inner);
    cardView.setCard(card);
}
Also used : 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 19 with CardView

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

the class CardWithListFragment method initCard.

/**
     * This method builds a simple card
     */
private void initCard() {
    //Weather Card
    card = new WeatherCard(getActivity());
    card.init();
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_weathercard);
    cardView.setCard(card);
    //May know card
    GoogleKnowwithList card2 = new GoogleKnowwithList(getActivity());
    card2.init();
    //Set card in the cardView
    CardView cardView2 = (CardView) getActivity().findViewById(R.id.carddemo_mayknowcard);
    cardView2.setCard(card2);
}
Also used : GoogleKnowwithList(it.gmariotti.cardslib.demo.extras.cards.GoogleKnowwithList) WeatherCard(it.gmariotti.cardslib.demo.extras.cards.WeatherCard) CardView(it.gmariotti.cardslib.library.view.CardView)

Example 20 with CardView

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

the class CroutonFragment method crouton2.

/**
     * This method builds another crouton card
     */
private void crouton2() {
    LayoutInflater mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = mInflater.inflate(R.layout.carddemo_extras_crouton_card, null);
    //Card View
    CardView cardView = (CardView) view.findViewById(R.id.carddemo_card_crouton_id);
    //Card
    Card card = new Card(getActivity());
    card.setTitle("Crouton Card");
    //Add a CardThumbnail
    CardThumbnail thumb = new CardThumbnail(getActivity());
    thumb.setDrawableResource(R.drawable.ic_action_halt);
    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)

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