use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class GoogleNowBirthCard method init.
private void init() {
//Add Header
GoogleNowBirthHeader header = new GoogleNowBirthHeader(getContext(), R.layout.carddemo_googlenowbirth_inner_header);
header.setButtonExpandVisible(true);
header.mName = "Gabriele Mariotti";
header.mSubName = "Birthday today";
addCardHeader(header);
//Add Expand Area
CardExpand expand = new GoogleNowExpandCard(getContext());
addCardExpand(expand);
//Set clickListener
setOnClickListener(new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getContext(), "Click Listener card", Toast.LENGTH_LONG).show();
}
});
//Add Thumbnail
GoogleNowBirthThumb thumbnail = new GoogleNowBirthThumb(getContext());
float density = getContext().getResources().getDisplayMetrics().density;
int size = (int) (125 * density);
thumbnail.setUrlResource("https://lh5.googleusercontent.com/-squZd7FxR8Q/UyN5UrsfkqI/AAAAAAAAbAo/VoDHSYAhC_E/s" + size + "/new%2520profile%2520%25282%2529.jpg");
thumbnail.setErrorResource(R.drawable.ic_ic_error_loading);
addCardThumbnail(thumbnail);
}
use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class GoogleNowStockCard method init.
private void init() {
//Add Header
CardHeader header = new CardHeader(getContext());
header.setButtonExpandVisible(true);
//should use R.string.
header.setTitle("Stocks today");
addCardHeader(header);
//Add expand
CardExpand expand = new GoogleNowExpandCard(getContext());
addCardExpand(expand);
//Add onClick Listener
setOnClickListener(new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getContext(), "Click Listener card=", Toast.LENGTH_LONG).show();
}
});
//Add swipe Listener
setOnSwipeListener(new OnSwipeListener() {
@Override
public void onSwipe(Card card) {
Toast.makeText(getContext(), "Card removed", Toast.LENGTH_LONG).show();
}
});
}
use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class GoogleNowBirthCard method init.
private void init() {
//Add Header
GoogleNowBirthHeader header = new GoogleNowBirthHeader(getContext(), R.layout.carddemo_extras_googlenowbirth_inner_header);
header.setButtonExpandVisible(true);
header.mName = "Gabriele Mariotti";
header.mSubName = "Birthday today";
addCardHeader(header);
//Add Expand Area
CardExpand expand = new GoogleNowExpandCard(getContext());
addCardExpand(expand);
//Set clickListener
setOnClickListener(new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getContext(), "Click Listener card", Toast.LENGTH_LONG).show();
}
});
//Add Thumbnail
GoogleNowBirthThumb thumbnail = new GoogleNowBirthThumb(getContext());
//You need to set true to use an external library
thumbnail.setExternalUsage(true);
addCardThumbnail(thumbnail);
}
use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class CardExpandFragment method init_standard_header_with_expandcollapse_button.
/**
* This method builds a standard header with base expand/collapse
*/
private void init_standard_header_with_expandcollapse_button() {
//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));
//Set visible the expand/collapse button
header.setButtonExpandVisible(true);
//Add Header to card
card.addCardHeader(header);
//This provides a simple (and useless) expand area
CardExpand expand = new CardExpand(getActivity());
//Set inner title in Expand Area
expand.setTitle(getString(R.string.demo_expand_customtitle3));
card.addCardExpand(expand);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand1);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.CardExpand in project cardslib by gabrielemariotti.
the class CardExpandFragment method init_custom_card_expand_clicking_image.
/**
* This method builds a custom card with expand/collapse action clickable in all card view
*/
private void init_custom_card_expand_clicking_image() {
//Create a Card
Card card = new Card(getActivity());
//This provides a simple (and useless) expand area
CardExpand expand = new CardExpand(getActivity());
//Set inner title in Expand Area
expand.setTitle(getString(R.string.demo_expand_customtitle3));
card.addCardExpand(expand);
CustomThumbnail thumb = new CustomThumbnail(getActivity());
thumb.setDrawableResource(R.drawable.ic_smile);
card.addCardThumbnail(thumb);
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_example_card_expand4);
cardView.setCard(card);
}
Aggregations