Search in sources :

Example 1 with IconSupplementalAction

use of it.gmariotti.cardslib.library.cards.actions.IconSupplementalAction 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)

Aggregations

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