use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class ShadowFragment method init_card_custom_shadow_layout.
/**
* This methods builds a card with a custom shadow layout (compound view)
* <b>WARNING</b>
* See https://github.com/gabrielemariotti/cardslib/tree/master/SHADOW.md for more information.
* You can quickly modify your shadow with your style and drawable files without modifying shadow layout.
*/
private void init_card_custom_shadow_layout() {
//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
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_shadow_layout);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class ThumbnailFragment method init_card_thumb_custom_source.
/**
* This method builds a card with a custom source thumbnail
*/
private void init_card_thumb_custom_source() {
//Create a Card
Card card = new GplayCardCustomSource(getActivity());
//Set card in the cardView
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_customsource);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class ThumbnailFragment method init_card_thumb_resourceURL.
/**
* This method builds a card with a thumbnail with a resource URL
*/
private void init_card_thumb_resourceURL() {
//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
CardThumbnail thumb = new CardThumbnail(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
CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_url);
cardView.setCard(card);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class CardDragDropArrayAdapter method swapItems.
@Override
public void swapItems(final int locationOne, final int locationTwo) {
Card temp = getItem(locationOne);
set(locationOne, getItem(locationTwo));
set(locationTwo, temp);
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class GridGplayFragment method initCards.
private void initCards() {
ArrayList<Card> cards = new ArrayList<Card>();
for (int i = 0; i < 200; i++) {
GplayGridCard card = new GplayGridCard(getActivity());
card.headerTitle = "App example " + i;
card.secondaryTitle = "Some text here " + i;
card.rating = (float) (Math.random() * (5.0));
//Only for test, change some icons
if ((i % 6 == 0)) {
card.resourceIdThumbnail = R.drawable.ic_ic_dh_bat;
} else if ((i % 6 == 1)) {
card.resourceIdThumbnail = R.drawable.ic_ic_dh_net;
} else if ((i % 6 == 2)) {
card.resourceIdThumbnail = R.drawable.ic_tris;
} else if ((i % 6 == 3)) {
card.resourceIdThumbnail = R.drawable.ic_info;
} else if ((i % 6 == 4)) {
card.resourceIdThumbnail = R.drawable.ic_smile;
}
card.init();
cards.add(card);
}
CardGridArrayAdapter mCardArrayAdapter = new CardGridArrayAdapter(getActivity(), cards);
CardGridView listView = (CardGridView) getActivity().findViewById(R.id.carddemo_grid_base1);
if (listView != null) {
listView.setAdapter(mCardArrayAdapter);
}
}
Aggregations