use of it.gmariotti.cardslib.library.cards.actions.BaseSupplementalAction 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);
}
use of it.gmariotti.cardslib.library.cards.actions.BaseSupplementalAction 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);
}
use of it.gmariotti.cardslib.library.cards.actions.BaseSupplementalAction 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;
}
Aggregations