Search in sources :

Example 1 with CardArrayAdapter

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

Example 2 with CardArrayAdapter

use of it.gmariotti.cardslib.library.internal.CardArrayAdapter in project cardslib by gabrielemariotti.

the class ListGplayUndoCardFragment method initCards.

private void initCards() {
    //Init an array of Cards
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 100; i++) {
        GooglePlaySmallCard card = new GooglePlaySmallCard(this.getActivity());
        card.setTitle("Application example " + i);
        card.setSecondaryTitle("A company inc..." + i);
        card.setRating((float) (Math.random() * (5.0)));
        card.setId("" + i);
        //Only for test, change some icons
        if ((i > 10 && i < 15) || (i > 35 && i < 45)) {
            card.setResourceIdThumbnail(R.drawable.ic_launcher);
        }
        card.init();
        cards.add(card);
    }
    mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
    mCardArrayAdapter.setUndoBarUIElements(new UndoBarController.DefaultUndoBarUIElements() {

        @Override
        public SwipeDirectionEnabled isEnabledUndoBarSwipeAction() {
            return SwipeDirectionEnabled.TOPBOTTOM;
        }

        @Override
        public AnimationType getAnimationType() {
            return AnimationType.TOPBOTTOM;
        }
    });
    //Enable undo controller!
    mCardArrayAdapter.setEnableUndo(true);
    //CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_gplaycard);
    if (mListView != null) {
        mListView.setAdapter(mCardArrayAdapter);
    }
}
Also used : ArrayList(java.util.ArrayList) UndoBarController(it.gmariotti.cardslib.library.view.listener.UndoBarController) CardArrayAdapter(it.gmariotti.cardslib.library.internal.CardArrayAdapter) Card(it.gmariotti.cardslib.library.internal.Card)

Example 3 with CardArrayAdapter

use of it.gmariotti.cardslib.library.internal.CardArrayAdapter in project cardslib by gabrielemariotti.

the class ListGplayUndoCardFragment2 method initCards.

private void initCards() {
    //Init an array of Cards
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 100; i++) {
        GooglePlaySmallCard card = new GooglePlaySmallCard(this.getActivity());
        card.setTitle("Application example " + i);
        card.setSecondaryTitle("A company inc..." + i);
        card.setRating((float) (Math.random() * (5.0)));
        card.setId("" + i);
        //Only for test, change some icons
        if ((i > 10 && i < 15) || (i > 35 && i < 45)) {
            card.setResourceIdThumbnail(R.drawable.ic_launcher);
        }
        card.init();
        cards.add(card);
    }
    mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
    //Enable undo controller!
    mCardArrayAdapter.setEnableUndo(true);
    //CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_gplaycard);
    if (mListView != null) {
        mListView.setAdapter(mCardArrayAdapter);
    }
}
Also used : ArrayList(java.util.ArrayList) CardArrayAdapter(it.gmariotti.cardslib.library.internal.CardArrayAdapter) Card(it.gmariotti.cardslib.library.internal.Card)

Example 4 with CardArrayAdapter

use of it.gmariotti.cardslib.library.internal.CardArrayAdapter in project cardslib by gabrielemariotti.

the class ListColorFragment method initCards.

private void initCards() {
    //Init an array of Cards
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 5; i++) {
        ColorCard card = new ColorCard(this.getActivity());
        card.setTitle("A simple colored card " + i);
        card.setCount(i);
        switch(i) {
            case 0:
                card.setBackgroundResourceId(R.drawable.demo_card_selector_color5);
                break;
            case 1:
                card.setBackgroundResourceId(R.drawable.demo_card_selector_color4);
                break;
            case 2:
                card.setBackgroundResourceId(R.drawable.demo_card_selector_color3);
                break;
            case 3:
                card.setBackgroundResourceId(R.drawable.demo_card_selector_color2);
                break;
            case 4:
                card.setBackgroundResourceId(R.drawable.demo_card_selector_color1);
                break;
        }
        cards.add(card);
    }
    CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
    CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_colors);
    if (listView != null) {
        listView.setAdapter(mCardArrayAdapter);
    }
}
Also used : CardListView(it.gmariotti.cardslib.library.view.CardListView) ArrayList(java.util.ArrayList) CardArrayAdapter(it.gmariotti.cardslib.library.internal.CardArrayAdapter) ColorCard(it.gmariotti.cardslib.demo.cards.ColorCard) Card(it.gmariotti.cardslib.library.internal.Card) ColorCard(it.gmariotti.cardslib.demo.cards.ColorCard)

Example 5 with CardArrayAdapter

use of it.gmariotti.cardslib.library.internal.CardArrayAdapter in project cardslib by gabrielemariotti.

the class ListExpandCardFragment method initCards.

private void initCards() {
    //Init an array of Cards
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 200; i++) {
        Card card = init_standard_header_with_expandcollapse_button_custom_area("Header " + i, i);
        cards.add(card);
    }
    CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
    CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_expand);
    if (listView != null) {
        listView.setAdapter(mCardArrayAdapter);
    }
}
Also used : CardListView(it.gmariotti.cardslib.library.view.CardListView) ArrayList(java.util.ArrayList) CardArrayAdapter(it.gmariotti.cardslib.library.internal.CardArrayAdapter) CustomExpandCard(it.gmariotti.cardslib.demo.cards.CustomExpandCard) Card(it.gmariotti.cardslib.library.internal.Card)

Aggregations

CardArrayAdapter (it.gmariotti.cardslib.library.internal.CardArrayAdapter)27 Card (it.gmariotti.cardslib.library.internal.Card)26 ArrayList (java.util.ArrayList)26 CardListView (it.gmariotti.cardslib.library.view.CardListView)21 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)5 AnimationAdapter (com.nhaarman.listviewanimations.appearance.AnimationAdapter)2 AlphaInAnimationAdapter (com.nhaarman.listviewanimations.appearance.simple.AlphaInAnimationAdapter)2 ColorCard (it.gmariotti.cardslib.demo.cards.ColorCard)2 CustomExpandCard (it.gmariotti.cardslib.demo.cards.CustomExpandCard)2 MayKnowCard (it.gmariotti.cardslib.demo.cards.MayKnowCard)2 ColorCard (it.gmariotti.cardslib.demo.extras.cards.ColorCard)2 PicassoCard (it.gmariotti.cardslib.demo.extras.cards.PicassoCard)2 CardHeader (it.gmariotti.cardslib.library.internal.CardHeader)2 ViewToClickToExpand (it.gmariotti.cardslib.library.internal.ViewToClickToExpand)2 UndoBarController (it.gmariotti.cardslib.library.view.listener.UndoBarController)2 AbsListView (android.widget.AbsListView)1 AboutCard (com.a5corp.weather.cards.AboutCard)1 FloatingActionButton (com.melnykov.fab.FloatingActionButton)1 GoogleNowWeatherCard (it.gmariotti.cardslib.demo.cards.GoogleNowWeatherCard)1 IonCard (it.gmariotti.cardslib.demo.extras.cards.IonCard)1