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);
}
Aggregations