Search in sources :

Example 41 with CardHeader

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

the class NativeHeaderFragment method init_standard_header_with_expandcollapse_button.

/**
 * This method builds a standard header with base expand/collpase
 */
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_basetitle));
    card.addCardExpand(expand);
    // Set card in the CardViewNative
    CardViewNative cardViewNative = (CardViewNative) getActivity().findViewById(R.id.carddemo_header_expand);
    cardViewNative.setCard(card);
}
Also used : CardExpand(it.gmariotti.cardslib.library.internal.CardExpand) CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard) CustomExpandCard(it.gmariotti.cardslib.demo.cards.CustomExpandCard) CustomHeaderInnerCard(it.gmariotti.cardslib.demo.cards.CustomHeaderInnerCard) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 42 with CardHeader

use of it.gmariotti.cardslib.library.internal.CardHeader 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 43 with CardHeader

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

the class GplayCard method init.

private void init() {
    CardHeader header = new CardHeader(getContext());
    header.setButtonOverflowVisible(true);
    header.setTitle("Google Maps");
    header.setPopupMenu(R.menu.popupmain, new CardHeader.OnClickCardHeaderPopupMenuListener() {

        @Override
        public void onMenuItemClick(BaseCard card, MenuItem item) {
            Toast.makeText(getContext(), item.getTitle(), Toast.LENGTH_SHORT).show();
        }
    });
    addCardHeader(header);
    GoogleNowBirthThumb thumbnail = new GoogleNowBirthThumb(getContext());
    thumbnail.setDrawableResource(R.drawable.carddemo_ic_gmaps_large);
    addCardThumbnail(thumbnail);
}
Also used : BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard) CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) MenuItem(android.view.MenuItem)

Example 44 with CardHeader

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

the class ListExpandCardFragment method init_standard_header_with_expandcollapse_button_custom_area.

/**
 * This method builds a standard header with a custom expand/collpase
 */
private Card init_standard_header_with_expandcollapse_button_custom_area(String titleHeader, int i) {
    // Create a Card
    Card card = new Card(getActivity());
    // Create a CardHeader
    CardHeader header = new CardHeader(getActivity());
    // Set the header title
    header.setTitle(titleHeader);
    // Set visible the expand/collapse button
    header.setButtonExpandVisible(true);
    // Add Header to card
    card.addCardHeader(header);
    // This provides a simple (and useless) expand area
    CustomExpandCard expand = new CustomExpandCard(getActivity(), i);
    // Add Expand Area to Card
    card.addCardExpand(expand);
    // Just an example to expand a card
    if (i == 2 || i == 7 || i == 9)
        card.setExpanded(true);
    // Swipe
    card.setSwipeable(true);
    // Animator listener
    card.setOnExpandAnimatorEndListener(new Card.OnExpandAnimatorEndListener() {

        @Override
        public void onExpandEnd(Card card) {
            Toast.makeText(getActivity(), "Expand " + card.getCardHeader().getTitle(), Toast.LENGTH_SHORT).show();
        }
    });
    card.setOnCollapseAnimatorEndListener(new Card.OnCollapseAnimatorEndListener() {

        @Override
        public void onCollapseEnd(Card card) {
            Toast.makeText(getActivity(), "Collpase " + card.getCardHeader().getTitle(), Toast.LENGTH_SHORT).show();
        }
    });
    return card;
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) CustomExpandCard(it.gmariotti.cardslib.demo.cards.CustomExpandCard) CustomExpandCard(it.gmariotti.cardslib.demo.cards.CustomExpandCard) Card(it.gmariotti.cardslib.library.internal.Card)

Example 45 with CardHeader

use of it.gmariotti.cardslib.library.internal.CardHeader 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)

Aggregations

CardHeader (it.gmariotti.cardslib.library.internal.CardHeader)58 Card (it.gmariotti.cardslib.library.internal.Card)51 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)27 CustomExpandCard (it.gmariotti.cardslib.demo.cards.CustomExpandCard)20 CardView (it.gmariotti.cardslib.library.view.CardView)20 CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)20 View (android.view.View)19 CustomHeaderInnerCard (it.gmariotti.cardslib.demo.cards.CustomHeaderInnerCard)18 MenuItem (android.view.MenuItem)15 CustomCard (it.gmariotti.cardslib.demo.cards.CustomCard)12 ScrollView (android.widget.ScrollView)11 TextView (android.widget.TextView)8 CardExpand (it.gmariotti.cardslib.library.internal.CardExpand)8 CustomThumbCard (it.gmariotti.cardslib.demo.cards.CustomThumbCard)6 CardThumbnail (it.gmariotti.cardslib.library.internal.CardThumbnail)6 ArrayList (java.util.ArrayList)5 PopupMenu (android.widget.PopupMenu)4 ViewToClickToExpand (it.gmariotti.cardslib.library.internal.ViewToClickToExpand)4 CardListView (it.gmariotti.cardslib.library.view.CardListView)4 ViewGroup (android.view.ViewGroup)2