use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class CardFragment 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
CardView cardView = (CardView) 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_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 = (CardViewNative) getActivity().findViewById(R.id.carddemo_example_card_cab);
cardViewCab.setCard(mCardCab);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class GooglePlaySmallCard method init.
private void init() {
//Add thumbnail
CardThumbnail cardThumbnail = new CardThumbnail(mContext);
cardThumbnail.setDrawableResource(R.drawable.carddemo_ic_gmaps);
addCardThumbnail(cardThumbnail);
//Add ClickListener
setOnClickListener(new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(getContext(), "Click Listener card=", Toast.LENGTH_LONG).show();
}
});
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class MayKnowCard method init.
private void init() {
//Add Header
CardHeader header = new MayKnowCardHeader(getContext(), R.layout.carddemo_mayknow_inner_header);
header.setTitle(getContext().getString(R.string.may_know_card_title));
addCardHeader(header);
setShadow(false);
//Add Thumbnail
CardThumbnail thumbnail = new CardThumbnail(getContext());
thumbnail.setUrlResource("https://lh5.googleusercontent.com/-squZd7FxR8Q/UyN5UrsfkqI/AAAAAAAAbAo/VoDHSYAhC_E/s72/new%2520profile%2520%25282%2529.jpg");
thumbnail.setErrorResource(R.drawable.ic_error_loadingsmall);
addCardThumbnail(thumbnail);
OnCardClickListener clickListener = new OnCardClickListener() {
@Override
public void onClick(Card card, View view) {
//Do something
}
};
addPartialOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW, clickListener);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class PicassoFragment method initCard.
/**
* This method builds a simple list of cards
*/
private void initCard() {
//Init an array of Cards
ArrayList<Card> cards = new ArrayList<Card>();
for (int i = 0; i < 200; i++) {
PicassoCard card = new PicassoCard(this.getActivity());
card.setTitle("A simple card loaded with Picasso " + i);
card.setSecondaryTitle("Simple text..." + i);
card.setCount(i);
cards.add(card);
}
//Set the adapter
CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_extra_list_picasso);
if (listView != null) {
listView.setAdapter(mCardArrayAdapter);
}
}
Aggregations