Search in sources :

Example 1 with MaterialLargeImageCard

use of it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard in project cardslib by gabrielemariotti.

the class NativeMaterialCardFragment method init_largeimage_text.

/**
     * Builds a Material Card with Large Image and Text
     */
private void init_largeimage_text() {
    ArrayList<BaseSupplementalAction> actions = new ArrayList<BaseSupplementalAction>();
    // Set supplemental actions
    TextSupplementalAction t1 = new TextSupplementalAction(getActivity(), R.id.text1);
    t1.setOnActionClickListener(new BaseSupplementalAction.OnActionClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getActivity(), " Click on Text SHARE ", Toast.LENGTH_SHORT).show();
        }
    });
    actions.add(t1);
    TextSupplementalAction t2 = new TextSupplementalAction(getActivity(), R.id.text2);
    t2.setOnActionClickListener(new BaseSupplementalAction.OnActionClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getActivity(), " Click on Text LEARN ", Toast.LENGTH_SHORT).show();
        }
    });
    actions.add(t2);
    //Create a Card, set the title over the image and set the thumbnail
    MaterialLargeImageCard card = MaterialLargeImageCard.with(getActivity()).setTextOverImage("Italian Beaches").setTitle("This is my favorite local beach").setSubTitle("A wonderful place").useDrawableId(R.drawable.sea).setupSupplementalActions(R.layout.carddemo_native_material_supplemental_actions_large, actions).build();
    card.setOnClickListener(new Card.OnCardClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getActivity(), " Click on ActionArea ", Toast.LENGTH_SHORT).show();
        }
    });
    //Set card in the CardViewNative
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_largeimage_text);
    cardView.setCard(card);
}
Also used : TextSupplementalAction(it.gmariotti.cardslib.library.cards.actions.TextSupplementalAction) ArrayList(java.util.ArrayList) BaseSupplementalAction(it.gmariotti.cardslib.library.cards.actions.BaseSupplementalAction) MaterialLargeImageCard(it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard) View(android.view.View) MaterialLargeImageCard(it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard) ProgressCard(it.gmariotti.cardslib.library.cards.ProgressCard) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 2 with MaterialLargeImageCard

use of it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard in project cardslib by gabrielemariotti.

the class NativeMaterialCardFragment method init_largeimage.

/**
     * Builds a Material Card with Large and small icons as supplemental actions
     */
private void init_largeimage() {
    // Set supplemental actions as icon
    ArrayList<BaseSupplementalAction> actions = new ArrayList<BaseSupplementalAction>();
    IconSupplementalAction t1 = new IconSupplementalAction(getActivity(), R.id.ic1);
    t1.setOnActionClickListener(new BaseSupplementalAction.OnActionClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getActivity(), " Click on Text SHARE ", Toast.LENGTH_SHORT).show();
        }
    });
    actions.add(t1);
    IconSupplementalAction t2 = new IconSupplementalAction(getActivity(), R.id.ic2);
    t2.setOnActionClickListener(new BaseSupplementalAction.OnActionClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getActivity(), " Click on Text LEARN ", Toast.LENGTH_SHORT).show();
        }
    });
    actions.add(t2);
    MaterialLargeImageCard card = MaterialLargeImageCard.with(getActivity()).setTextOverImage("Italian Beaches").useDrawableId(R.drawable.im_beach).setupSupplementalActions(R.layout.carddemo_native_material_supplemental_actions_large_icon, actions).build();
    card.setOnClickListener(new Card.OnCardClickListener() {

        @Override
        public void onClick(Card card, View view) {
            Toast.makeText(getActivity(), " Click on ActionArea ", Toast.LENGTH_SHORT).show();
        }
    });
    //Set card in the CardViewNative
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_largeimage);
    cardView.setCard(card);
}
Also used : IconSupplementalAction(it.gmariotti.cardslib.library.cards.actions.IconSupplementalAction) ArrayList(java.util.ArrayList) BaseSupplementalAction(it.gmariotti.cardslib.library.cards.actions.BaseSupplementalAction) MaterialLargeImageCard(it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard) View(android.view.View) MaterialLargeImageCard(it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard) ProgressCard(it.gmariotti.cardslib.library.cards.ProgressCard) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 3 with MaterialLargeImageCard

use of it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard in project cardslib by gabrielemariotti.

the class NativeRecyclerViewMaterialCardFragment method initCard.

/**
     * This method builds a simple list of cards
     */
private ArrayList<Card> initCard() {
    //Init an array of Cards
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 200; i++) {
        ArrayList<BaseSupplementalAction> actions = new ArrayList<BaseSupplementalAction>();
        // Set supplemental actions
        TextSupplementalAction t1 = new TextSupplementalAction(getActivity(), R.id.text1);
        t1.setOnActionClickListener(new BaseSupplementalAction.OnActionClickListener() {

            @Override
            public void onClick(Card card, View view) {
                Toast.makeText(getActivity(), " Click on Text SHARE " + card.getTitle(), Toast.LENGTH_SHORT).show();
            }
        });
        actions.add(t1);
        TextSupplementalAction t2 = new TextSupplementalAction(getActivity(), R.id.text2);
        t2.setOnActionClickListener(new BaseSupplementalAction.OnActionClickListener() {

            @Override
            public void onClick(Card card, View view) {
                Toast.makeText(getActivity(), " Click on Text LEARN " + card.getTitle(), Toast.LENGTH_SHORT).show();
            }
        });
        actions.add(t2);
        //Create a Card, set the title over the image and set the thumbnail
        MaterialLargeImageCard card = MaterialLargeImageCard.with(getActivity()).setTextOverImage("Italian Beaches " + i).setTitle("This is my favorite local beach " + i).setSubTitle("A wonderful place").useDrawableId(R.drawable.sea).setupSupplementalActions(R.layout.carddemo_native_material_supplemental_actions_large, actions).build();
        card.setOnClickListener(new Card.OnCardClickListener() {

            @Override
            public void onClick(Card card, View view) {
                Toast.makeText(getActivity(), " Click on ActionArea ", Toast.LENGTH_SHORT).show();
            }
        });
        cards.add(card);
    }
    return cards;
}
Also used : TextSupplementalAction(it.gmariotti.cardslib.library.cards.actions.TextSupplementalAction) ArrayList(java.util.ArrayList) BaseSupplementalAction(it.gmariotti.cardslib.library.cards.actions.BaseSupplementalAction) MaterialLargeImageCard(it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard) CardRecyclerView(it.gmariotti.cardslib.library.recyclerview.view.CardRecyclerView) View(android.view.View) MaterialLargeImageCard(it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard) Card(it.gmariotti.cardslib.library.internal.Card)

Aggregations

View (android.view.View)3 BaseSupplementalAction (it.gmariotti.cardslib.library.cards.actions.BaseSupplementalAction)3 MaterialLargeImageCard (it.gmariotti.cardslib.library.cards.material.MaterialLargeImageCard)3 Card (it.gmariotti.cardslib.library.internal.Card)3 ArrayList (java.util.ArrayList)3 ProgressCard (it.gmariotti.cardslib.library.cards.ProgressCard)2 TextSupplementalAction (it.gmariotti.cardslib.library.cards.actions.TextSupplementalAction)2 CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)2 IconSupplementalAction (it.gmariotti.cardslib.library.cards.actions.IconSupplementalAction)1 CardRecyclerView (it.gmariotti.cardslib.library.recyclerview.view.CardRecyclerView)1