use of it.gmariotti.cardslib.demo.extras.cards.ColorCard in project cardslib by gabrielemariotti.
the class ActionbarpullFragment 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++) {
ColorCard card = new ColorCard(this.getActivity());
//Only for test scope, use different titles and colors
card.setTitle("A simple colored card " + i);
card.setCount(i);
switch(i % 5) {
case 0:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color1);
break;
case 1:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color2);
break;
case 2:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color3);
break;
case 3:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color4);
break;
case 4:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color5);
break;
}
cards.add(card);
}
//Set the adapter
CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
if (listView != null) {
listView.setAdapter(mCardArrayAdapter);
}
}
use of it.gmariotti.cardslib.demo.extras.cards.ColorCard 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.demo.extras.cards.ColorCard in project cardslib by gabrielemariotti.
the class ListViewAnimationsFragment 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++) {
ColorCard card = new ColorCard(this.getActivity());
//Only for test scope, use different titles and colors
card.setTitle("A simple colored card " + i);
card.setCount(i);
switch(i % 5) {
case 0:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color1);
break;
case 1:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color2);
break;
case 2:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color3);
break;
case 3:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color4);
break;
case 4:
card.setBackgroundResourceId(R.drawable.demoextra_card_selector_color5);
break;
}
cards.add(card);
}
//Set the adapter
mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
mListView = (CardListView) getActivity().findViewById(R.id.carddemo_extra_list_viewanimations);
if (mListView != null) {
setAlphaAdapter();
}
}
Aggregations