Search in sources :

Example 11 with Card

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

the class ShadowFragment method init_card_custom_shadow_layout.

/**
     * This methods builds a card with a custom shadow layout (compound view)
     * <b>WARNING</b>
     * See https://github.com/gabrielemariotti/cardslib/tree/master/SHADOW.md for more information.
     * You can quickly modify your shadow with your style and drawable files without modifying shadow layout.
     */
private void init_card_custom_shadow_layout() {
    //Create a Card
    Card card = new Card(getActivity());
    //Create a CardHeader
    CardHeader header = new CardHeader(getActivity());
    //Set the header title
    header.setTitle(getString(R.string.demo_header_basetitle));
    card.addCardHeader(header);
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_shadow_layout);
    cardView.setCard(card);
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) CardView(it.gmariotti.cardslib.library.view.CardView) Card(it.gmariotti.cardslib.library.internal.Card)

Example 12 with Card

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

the class ThumbnailFragment method init_card_thumb_custom_source.

/**
     * This method builds a card with a custom source thumbnail
     */
private void init_card_thumb_custom_source() {
    //Create a Card
    Card card = new GplayCardCustomSource(getActivity());
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_customsource);
    cardView.setCard(card);
}
Also used : GplayCardCustomSource(it.gmariotti.cardslib.demo.cards.GplayCardCustomSource) CardView(it.gmariotti.cardslib.library.view.CardView) CustomThumbCard(it.gmariotti.cardslib.demo.cards.CustomThumbCard) Card(it.gmariotti.cardslib.library.internal.Card)

Example 13 with Card

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

the class ThumbnailFragment method init_card_thumb_resourceURL.

/**
     * This method builds a card with a thumbnail with a resource URL
     */
private void init_card_thumb_resourceURL() {
    //Create a Card
    Card card = new Card(getActivity());
    //Create a CardHeader
    CardHeader header = new CardHeader(getActivity());
    //Set the header title
    header.setTitle(getString(R.string.demo_header_basetitle));
    card.addCardHeader(header);
    //Create thumbnail
    CardThumbnail thumb = new CardThumbnail(getActivity());
    //Set URL resource
    thumb.setUrlResource("https://lh5.googleusercontent.com/-N8bz9q4Kz0I/AAAAAAAAAAI/AAAAAAAAAAs/Icl2bQMyK7c/s265-c-k-no/photo.jpg");
    //Error Resource ID
    thumb.setErrorResource(R.drawable.ic_error_loadingorangesmall);
    //Add thumbnail to a card
    card.addCardThumbnail(thumb);
    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_url);
    cardView.setCard(card);
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) CardView(it.gmariotti.cardslib.library.view.CardView) CardThumbnail(it.gmariotti.cardslib.library.internal.CardThumbnail) CustomThumbCard(it.gmariotti.cardslib.demo.cards.CustomThumbCard) Card(it.gmariotti.cardslib.library.internal.Card)

Example 14 with Card

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

the class CardDragDropArrayAdapter method swapItems.

@Override
public void swapItems(final int locationOne, final int locationTwo) {
    Card temp = getItem(locationOne);
    set(locationOne, getItem(locationTwo));
    set(locationTwo, temp);
}
Also used : Card(it.gmariotti.cardslib.library.internal.Card)

Example 15 with Card

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

the class GridGplayFragment method initCards.

private void initCards() {
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 200; i++) {
        GplayGridCard card = new GplayGridCard(getActivity());
        card.headerTitle = "App example " + i;
        card.secondaryTitle = "Some text here " + i;
        card.rating = (float) (Math.random() * (5.0));
        //Only for test, change some icons
        if ((i % 6 == 0)) {
            card.resourceIdThumbnail = R.drawable.ic_ic_dh_bat;
        } else if ((i % 6 == 1)) {
            card.resourceIdThumbnail = R.drawable.ic_ic_dh_net;
        } else if ((i % 6 == 2)) {
            card.resourceIdThumbnail = R.drawable.ic_tris;
        } else if ((i % 6 == 3)) {
            card.resourceIdThumbnail = R.drawable.ic_info;
        } else if ((i % 6 == 4)) {
            card.resourceIdThumbnail = R.drawable.ic_smile;
        }
        card.init();
        cards.add(card);
    }
    CardGridArrayAdapter mCardArrayAdapter = new CardGridArrayAdapter(getActivity(), cards);
    CardGridView listView = (CardGridView) getActivity().findViewById(R.id.carddemo_grid_base1);
    if (listView != null) {
        listView.setAdapter(mCardArrayAdapter);
    }
}
Also used : ArrayList(java.util.ArrayList) CardGridArrayAdapter(it.gmariotti.cardslib.library.internal.CardGridArrayAdapter) CardGridView(it.gmariotti.cardslib.library.view.CardGridView) BaseCard(it.gmariotti.cardslib.library.internal.base.BaseCard) 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