use of it.gmariotti.cardslib.demo.extras.cards.PicassoCard 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);
}
}
use of it.gmariotti.cardslib.demo.extras.cards.PicassoCard in project cardslib by gabrielemariotti.
the class StickyListHeadersFragment 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());
//Use the first letter for sticky
String firstLetter = calculateFirstLetter(i);
card.setTitle(firstLetter + " : simple title " + i);
card.setSecondaryTitle("Simple text..." + i);
card.setCount(i);
cards.add(card);
}
//Set the adapter
StickyCardArrayAdapter adapter = new StickyCardArrayAdapter(getActivity(), cards);
StickyCardListView stickyList = (StickyCardListView) getActivity().findViewById(R.id.carddemo_extra_sticky_list);
//stickyList.setAreHeadersSticky(false);
if (stickyList != null) {
stickyList.setAdapter(adapter);
}
}
use of it.gmariotti.cardslib.demo.extras.cards.PicassoCard in project cardslib by gabrielemariotti.
the class NativeDragDropListFragment 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 < 25; i++) {
PicassoCard card = new PicassoCard(this.getActivity());
card.setTitle("A simple card loaded with Picasso " + i);
card.setSecondaryTitle("Simple text..." + i);
card.setCount(i);
//Card must have a stable Id.
card.setId("a" + i);
card.setSwipeable(true);
cards.add(card);
}
//Set the adapter
mCardArrayAdapter = new CardDragDropArrayAdapter(getActivity(), cards);
mListView = (CardListDragDropView) getActivity().findViewById(R.id.carddemo_extra_list_dragdrop);
if (mListView != null) {
mListView.setAdapter(mCardArrayAdapter);
}
//Listener
mListView.setOnItemMovedListener(new OnItemMovedListener() {
@Override
public void onItemMoved(int originalPosition, int newPosition) {
Card card = mCardArrayAdapter.getItem(newPosition);
Toast.makeText(getActivity(), "Card " + card.getId() + " moved to position " + newPosition, Toast.LENGTH_SHORT).show();
}
});
}
use of it.gmariotti.cardslib.demo.extras.cards.PicassoCard in project cardslib by gabrielemariotti.
the class DragDropListFragment 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 < 25; i++) {
PicassoCard card = new PicassoCard(this.getActivity());
card.setTitle("A simple card loaded with Picasso " + i);
card.setSecondaryTitle("Simple text..." + i);
card.setCount(i);
//Card must have a stable Id.
card.setId("a" + i);
card.setSwipeable(true);
cards.add(card);
}
//Set the adapter
mCardArrayAdapter = new CardDragDropArrayAdapter(getActivity(), cards);
mListView = (CardListDragDropView) getActivity().findViewById(R.id.carddemo_extra_list_dragdrop);
if (mListView != null) {
mListView.setAdapter(mCardArrayAdapter);
}
//Listener
mListView.setOnItemMovedListener(new OnItemMovedListener() {
@Override
public void onItemMoved(int originalPosition, int newPosition) {
Card card = mCardArrayAdapter.getItem(newPosition);
Toast.makeText(getActivity(), "Card " + card.getId() + " moved to position " + newPosition, Toast.LENGTH_SHORT).show();
}
});
}
use of it.gmariotti.cardslib.demo.extras.cards.PicassoCard in project cardslib by gabrielemariotti.
the class NativePicassoFragment 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