use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class StaggeredGridFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
hideList(false);
//Set the arrayAdapter
ArrayList<Card> cards = new ArrayList<Card>();
mCardArrayAdapter = new CardGridStaggeredArrayAdapter(getActivity(), cards);
//Staggered grid view
CardGridStaggeredView staggeredView = (CardGridStaggeredView) getActivity().findViewById(R.id.carddemo_extras_grid_stag);
//Set the empty view
staggeredView.setEmptyView(getActivity().findViewById(android.R.id.empty));
if (staggeredView != null) {
staggeredView.setAdapter(mCardArrayAdapter);
}
//Load cards
new LoaderAsyncTask().execute();
}
use of it.gmariotti.cardslib.library.internal.Card 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.library.internal.Card in project cardslib by gabrielemariotti.
the class UniversalImageLoaderFragment method initCard.
/**
* This method builds a simple card
*/
private void initCard() {
//Init an array of Cards
ArrayList<Card> cards = new ArrayList<Card>();
for (int i = 0; i < 200; i++) {
UniversalImageLoaderCard card = new UniversalImageLoaderCard(this.getActivity(), options);
card.setTitle("A simple card loaded with Universal-Image-Loader " + i);
card.setSecondaryTitle("Simple text..." + i);
card.setCount(i);
cards.add(card);
}
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.library.internal.Card in project cardslib by gabrielemariotti.
the class StickyCardArrayAdapter method getHeaderView.
@Override
public View getHeaderView(int position, View convertView, ViewGroup viewGroup) {
// Build your custom HeaderView
//In this case I will use a Card, but you can use any view
LayoutInflater mInflater = LayoutInflater.from(getContext());
View view = mInflater.inflate(R.layout.carddemo_extras_sticky_header, null);
CardViewWrapper cardView = (CardViewWrapper) view.findViewById(R.id.carddemo_card_sticky_header_id);
Card card = getItem(position);
char headerChar = card.getTitle().subSequence(0, 1).charAt(0);
ColorCard colorCard = new ColorCard(getContext());
colorCard.setTitle("Header : " + headerChar);
switch(position / 8) {
case 0:
colorCard.setBackgroundResourceId(R.drawable.demoextra_card_selector_color1);
break;
case 1:
colorCard.setBackgroundResourceId(R.drawable.demoextra_card_selector_color2);
break;
case 2:
colorCard.setBackgroundResourceId(R.drawable.demoextra_card_selector_color3);
break;
case 3:
colorCard.setBackgroundResourceId(R.drawable.demoextra_card_selector_color4);
break;
case 4:
colorCard.setBackgroundResourceId(R.drawable.demoextra_card_selector_color5);
break;
default:
colorCard.setBackgroundResourceId(R.drawable.demoextra_card_selector_color1);
break;
}
cardView.setCard(colorCard);
return view;
}
use of it.gmariotti.cardslib.library.internal.Card in project cardslib by gabrielemariotti.
the class AnimateStaggeredGridFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
hideList(false);
//Set the arrayAdapter
ArrayList<Card> cards = new ArrayList<Card>();
mCardArrayAdapter = new CardGridStaggeredArrayAdapter(getActivity(), cards);
staggeredView = (CardGridStaggeredView) getActivity().findViewById(R.id.carddemo_extras_grid_stag);
//Load cards
new LoaderAsyncTask().execute();
//Set the empty view
staggeredView.setEmptyView(getActivity().findViewById(android.R.id.empty));
/**
* Set adapter with animations
*/
if (staggeredView != null) {
setAlphaAdapter();
}
}
Aggregations