Search in sources :

Example 56 with Card

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();
}
Also used : ArrayList(java.util.ArrayList) CardGridStaggeredArrayAdapter(it.gmariotti.cardslib.library.extra.staggeredgrid.internal.CardGridStaggeredArrayAdapter) CardGridStaggeredView(it.gmariotti.cardslib.library.extra.staggeredgrid.view.CardGridStaggeredView) Card(it.gmariotti.cardslib.library.internal.Card)

Example 57 with Card

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);
    }
}
Also used : StickyCardArrayAdapter(it.gmariotti.cardslib.demo.extras.stickylist.StickyCardArrayAdapter) StickyCardListView(it.gmariotti.cardslib.demo.extras.stickylist.StickyCardListView) ArrayList(java.util.ArrayList) PicassoCard(it.gmariotti.cardslib.demo.extras.cards.PicassoCard) PicassoCard(it.gmariotti.cardslib.demo.extras.cards.PicassoCard) Card(it.gmariotti.cardslib.library.internal.Card)

Example 58 with Card

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);
    }
}
Also used : CardListView(it.gmariotti.cardslib.library.view.CardListView) ArrayList(java.util.ArrayList) UniversalImageLoaderCard(it.gmariotti.cardslib.demo.extras.cards.UniversalImageLoaderCard) CardArrayAdapter(it.gmariotti.cardslib.library.internal.CardArrayAdapter) Card(it.gmariotti.cardslib.library.internal.Card) UniversalImageLoaderCard(it.gmariotti.cardslib.demo.extras.cards.UniversalImageLoaderCard)

Example 59 with Card

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;
}
Also used : LayoutInflater(android.view.LayoutInflater) CardViewWrapper(it.gmariotti.cardslib.library.view.base.CardViewWrapper) CardListView(it.gmariotti.cardslib.library.view.CardListView) View(android.view.View) ColorCard(it.gmariotti.cardslib.demo.extras.cards.ColorCard) Card(it.gmariotti.cardslib.library.internal.Card) ColorCard(it.gmariotti.cardslib.demo.extras.cards.ColorCard)

Example 60 with Card

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();
    }
}
Also used : ArrayList(java.util.ArrayList) CardGridStaggeredArrayAdapter(it.gmariotti.cardslib.library.extra.staggeredgrid.internal.CardGridStaggeredArrayAdapter) Card(it.gmariotti.cardslib.library.internal.Card)

Aggregations

Card (it.gmariotti.cardslib.library.internal.Card)134 ArrayList (java.util.ArrayList)53 CardHeader (it.gmariotti.cardslib.library.internal.CardHeader)51 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)39 View (android.view.View)35 CardView (it.gmariotti.cardslib.library.view.CardView)31 CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)31 CustomExpandCard (it.gmariotti.cardslib.demo.cards.CustomExpandCard)26 CardArrayAdapter (it.gmariotti.cardslib.library.internal.CardArrayAdapter)26 CardListView (it.gmariotti.cardslib.library.view.CardListView)24 CustomCard (it.gmariotti.cardslib.demo.cards.CustomCard)22 CustomHeaderInnerCard (it.gmariotti.cardslib.demo.cards.CustomHeaderInnerCard)22 ScrollView (android.widget.ScrollView)15 TextView (android.widget.TextView)14 CardExpand (it.gmariotti.cardslib.library.internal.CardExpand)14 MenuItem (android.view.MenuItem)10 CardThumbnail (it.gmariotti.cardslib.library.internal.CardThumbnail)9 CustomThumbCard (it.gmariotti.cardslib.demo.cards.CustomThumbCard)8 PicassoCard (it.gmariotti.cardslib.demo.extras.cards.PicassoCard)7 CardRecyclerView (it.gmariotti.cardslib.library.recyclerview.view.CardRecyclerView)7