use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.
the class NativeBirthDayCardFragment method init2.
private void init2() {
GoogleNowBirthCard card2 = new GoogleNowBirthCard(getActivity());
card2.setId("myId2");
card2.USE_VIGNETTE = 1;
//Set card in the cardView
CardViewNative cardView2 = (CardViewNative) getActivity().findViewById(R.id.carddemo_cardBirth2);
cardView2.setCard(card2);
}
use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.
the class NativeMiscCardFragment method initCircleCard.
private void initCircleCard() {
Card card = new Card(getActivity());
card.setTitle("Title");
//card.setBackgroundResourceId(R.color.demo_card_background_color1);
CardThumbnailCircle thumb = new CardThumbnailCircle(getActivity());
card.addCardThumbnail(thumb);
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_circleleft);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.
the class NativeShadowFragment method init_card_elevation_shadow.
/**
* This method builds a card with a different elevation
*/
private void init_card_elevation_shadow() {
//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);
//Card elevation
card.setCardElevation(getResources().getDimension(R.dimen.carddemo_shadow_elevation));
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_shadow_elevation);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.
the class NativeShadowFragment method init_card_animation_shadow.
/**
* This method builds a card with an animation
*/
private void init_card_animation_shadow() {
//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 card in the cardView
final CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_shadow_animation);
cardView.setCard(card);
cardView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch(motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
if (Build.VERSION.SDK_INT >= Constants.API_L) {
cardView.animate().setDuration(100).scaleX(1.1f).scaleY(1.1f).translationZ(10);
} else {
cardView.animate().setDuration(100).scaleX(1.1f).scaleY(1.1f);
}
return true;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (Build.VERSION.SDK_INT >= Constants.API_L) {
cardView.animate().setDuration(100).scaleX(1).scaleY(1).translationZ(0);
} else {
cardView.animate().setDuration(100).scaleX(1).scaleY(1);
}
return true;
}
return false;
}
});
}
use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.
the class NativeThumbnailFragment method init_card_thumb_resourceURL_style.
/**
* This method builds a card with a thumbnail with a resource URL with a custom style
*/
private void init_card_thumb_resourceURL_style() {
//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);
//Create thumbnail
CustomThumbCard thumb = new CustomThumbCard(getActivity());
//Set URL resource
thumb.setUrlResource("https://lh5.googleusercontent.com/-N8bz9q4Kz0I/AAAAAAAAAAI/AAAAAAAAAAs/Icl2bQMyK7c/s265-c-k-no/photo.jpg");
//Error Resource ID
thumb.setErrorResource(R.drawable.ic_error_loadingorangesmall);
//Add thumbnail to a card
card.addCardThumbnail(thumb);
//Set card in the cardView
CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_thumb_style);
cardView.setCard(card);
}
Aggregations