use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class NativeCardFragment 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
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card3_swipe);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class NativeCardFragment method init_simple_card.
/**
* This method builds a simple card
*/
private void init_simple_card() {
//Create a Card
Card card = new Card(getActivity());
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
card.addCardHeader(header);
//Set the card inner text
card.setTitle(getString(R.string.demo_card_basetitle));
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_card_id);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class NativeCardFragment method init_custom_card.
/**
* This method builds a custom card
*/
private void init_custom_card() {
//Create a Card
Card card = new CustomCard(getActivity());
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card3);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class NativeCardFragment method init_card_inner_layout.
/**
* This method builds a simple card with a custom inner layout
*/
private void init_card_inner_layout() {
//Create a Card
Card card = new Card(getActivity(), R.layout.carddemo_example_inner_content);
//Create a CardHeader
CardHeader header = new CardHeader(getActivity());
//Set the header title
header.setTitle(getString(R.string.demo_header_basetitle));
card.addCardHeader(header);
//Set the card inner text
card.setTitle(getString(R.string.demo_card_basetitle));
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_card_inner);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class NativeCardFragment 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
CardViewNative cardView1 = (CardViewNative) 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
CardViewNative cardView2 = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card3_listeners2);
cardView2.setCard(card2);
}
Aggregations