use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CroutonFragment method crouton1.
/**
* This method builds a crouton card
*/
private void crouton1() {
LayoutInflater mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = mInflater.inflate(R.layout.carddemo_extras_crouton_card, null);
//CardView
CardView cardView = (CardView) view.findViewById(R.id.carddemo_card_crouton_id);
//Card
Card card = new Card(getActivity());
card.setTitle("Crouton Card");
card.setBackgroundResourceId(R.color.demoextra_card_background_color2);
//Add a cardThumbnail
CardThumbnail thumb = new CardThumbnail(getActivity());
thumb.setDrawableResource(R.drawable.ic_action_bulb);
card.addCardThumbnail(thumb);
cardView.setCard(card);
//Make the crouton view
final Crouton crouton;
crouton = Crouton.make(getActivity(), view);
crouton.show();
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CardFragment method init_custom_card_swipe.
/**
* This method builds a custom card with a swipe action
*/
private void init_custom_card_swipe() {
//Create a Card
CustomCard card = new CustomCard(getActivity());
//Enable a swipe action
card.setSwipeable(true);
//You can set a SwipeListener.
card.setOnSwipeListener(new Card.OnSwipeListener() {
@Override
public void onSwipe(Card card) {
if (mTextViewSwipe != null)
mTextViewSwipe.setVisibility(View.GONE);
}
});
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card3_swipe);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CardFragment method init_custom_card_partial_listener.
/**
* This method builds a custom card with a swipe action
*/
private void init_custom_card_partial_listener() {
//Create a Card
Card card1 = new Card(getActivity(), R.layout.carddemo_example_inner_content);
CardHeader header1 = new CardHeader(getActivity());
header1.setTitle(getString(R.string.demo_custom_shorttitle));
card1.addCardHeader(header1);
//Set the card inner text
card1.setTitle(getString(R.string.demo_card_shorttitle));
//Set a clickListener on ContentArea
card1.addPartialOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW, new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getActivity(), "Click on Content Area", Toast.LENGTH_LONG).show();
}
});
//Set card in the cardView
CardView cardView1 = (CardView) getActivity().findViewById(R.id.carddemo_example_card3_listeners1);
cardView1.setCard(card1);
//----------------------------------------------------------------------------------
//Create a Card
Card card2 = new Card(getActivity(), R.layout.carddemo_example_inner_content);
CardHeader header2 = new CardHeader(getActivity());
header2.setTitle(getString(R.string.demo_custom_shorttitle));
card2.addCardHeader(header2);
//Set the card inner text
card2.setTitle(getString(R.string.demo_card_shorttitle));
//Set a clickListener on Header Area
card2.addPartialOnClickListener(Card.CLICK_LISTENER_HEADER_VIEW, new Card.OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getActivity(), "Click on Header Area", Toast.LENGTH_LONG).show();
}
});
//Set card in the cardView
CardView cardView2 = (CardView) getActivity().findViewById(R.id.carddemo_example_card3_listeners2);
cardView2.setCard(card2);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class CardFragment method init_cab.
/**
* Card with a CAB
*/
private void init_cab() {
//Create a Card
mCardCab = new Card(getActivity());
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_title_cab1));
mCardCab.addCardHeader(header);
//Set the card inner text
mCardCab.setTitle(getString(R.string.demo_card_basetitle));
//Set onClick listener
mCardCab.setOnLongClickListener(new Card.OnLongCardClickListener() {
@Override
public boolean onLongClick(Card card, View view) {
if (mActionMode != null) {
view.setActivated(false);
mActionMode.finish();
return false;
}
// Start the CAB using the ActionMode.Callback defined above
mActionMode = getActivity().startActionMode(mActionModeCallback);
view.setActivated(true);
return true;
}
});
//Set card in the cardView
cardViewCab = (CardView) getActivity().findViewById(R.id.carddemo_example_card_cab);
cardViewCab.setCard(mCardCab);
}
use of it.gmariotti.cardslib.library.view.CardView in project cardslib by gabrielemariotti.
the class GPlayCardFragment method initCardGooglePlay.
/**
* This method builds a simple card
*/
private void initCardGooglePlay() {
//Create a Card
GplayCard card = new GplayCard(getActivity());
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_Gplay1);
cardView.setCard(card);
//Create a Card
GplayCard card2 = new GplayCard(getActivity());
//Set card in the cardView
CardView cardView2 = (CardView) getActivity().findViewById(R.id.carddemo_Gplay2);
cardView2.setCard(card2);
if (Utils.isTablet(getActivity())) {
//Create a Card
GplayCard card3 = new GplayCard(getActivity());
//Set card in the cardView
CardView cardView3 = (CardView) getActivity().findViewById(R.id.carddemo_Gplay3);
if (cardView3 != null)
cardView3.setCard(card3);
}
}
Aggregations