Search in sources :

Example 1 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.

the class NativeBirthDayCardFragment method init2.

private void init2() {
    GoogleNowBirthCard card2 = new GoogleNowBirthCard(getActivity());
    card2.setId("myId2");
    card2.USE_VIGNETTE = 1;
    //Set card in the cardView
    CardViewNative cardView2 = (CardViewNative) getActivity().findViewById(R.id.carddemo_cardBirth2);
    cardView2.setCard(card2);
}
Also used : GoogleNowBirthCard(it.gmariotti.cardslib.demo.cards.GoogleNowBirthCard) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 2 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.

the class NativeMiscCardFragment method initCircleCard.

private void initCircleCard() {
    Card card = new Card(getActivity());
    card.setTitle("Title");
    //card.setBackgroundResourceId(R.color.demo_card_background_color1);
    CardThumbnailCircle thumb = new CardThumbnailCircle(getActivity());
    card.addCardThumbnail(thumb);
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_circleleft);
    cardView.setCard(card);
}
Also used : SuggestedCard(it.gmariotti.cardslib.demo.cards.SuggestedCard) Card(it.gmariotti.cardslib.library.internal.Card) MayKnowCard(it.gmariotti.cardslib.demo.cards.MayKnowCard) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 3 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.

the class NativeShadowFragment method init_card_elevation_shadow.

/**
     * This method builds a card with a different elevation
     */
private void init_card_elevation_shadow() {
    //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);
    //Card elevation
    card.setCardElevation(getResources().getDimension(R.dimen.carddemo_shadow_elevation));
    //Set card in the cardView
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_shadow_elevation);
    cardView.setCard(card);
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Example 4 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.

the class NativeShadowFragment method init_card_animation_shadow.

/**
     * This method builds a card with an animation
     */
private void init_card_animation_shadow() {
    //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
    final CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_shadow_animation);
    cardView.setCard(card);
    cardView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            switch(motionEvent.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    if (Build.VERSION.SDK_INT >= Constants.API_L) {
                        cardView.animate().setDuration(100).scaleX(1.1f).scaleY(1.1f).translationZ(10);
                    } else {
                        cardView.animate().setDuration(100).scaleX(1.1f).scaleY(1.1f);
                    }
                    return true;
                case MotionEvent.ACTION_CANCEL:
                case MotionEvent.ACTION_UP:
                    if (Build.VERSION.SDK_INT >= Constants.API_L) {
                        cardView.animate().setDuration(100).scaleX(1).scaleY(1).translationZ(0);
                    } else {
                        cardView.animate().setDuration(100).scaleX(1).scaleY(1);
                    }
                    return true;
            }
            return false;
        }
    });
}
Also used : CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) ScrollView(android.widget.ScrollView) View(android.view.View) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative) MotionEvent(android.view.MotionEvent)

Example 5 with CardViewNative

use of it.gmariotti.cardslib.library.view.CardViewNative in project cardslib by gabrielemariotti.

the class NativeThumbnailFragment method init_card_thumb_resourceURL_style.

/**
     * This method builds a card with a thumbnail with a resource URL with a custom style
     */
private void init_card_thumb_resourceURL_style() {
    //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
    CustomThumbCard thumb = new CustomThumbCard(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
    CardViewNative cardView = (CardViewNative) getActivity().findViewById(R.id.carddemo_thumb_style);
    cardView.setCard(card);
}
Also used : CustomThumbCard(it.gmariotti.cardslib.demo.cards.CustomThumbCard) CardHeader(it.gmariotti.cardslib.library.internal.CardHeader) CustomThumbCard(it.gmariotti.cardslib.demo.cards.CustomThumbCard) Card(it.gmariotti.cardslib.library.internal.Card) CardViewNative(it.gmariotti.cardslib.library.view.CardViewNative)

Aggregations

CardViewNative (it.gmariotti.cardslib.library.view.CardViewNative)42 Card (it.gmariotti.cardslib.library.internal.Card)31 CardHeader (it.gmariotti.cardslib.library.internal.CardHeader)20 View (android.view.View)12 BaseCard (it.gmariotti.cardslib.library.internal.base.BaseCard)12 CustomCard (it.gmariotti.cardslib.demo.cards.CustomCard)11 CustomExpandCard (it.gmariotti.cardslib.demo.cards.CustomExpandCard)11 CustomHeaderInnerCard (it.gmariotti.cardslib.demo.cards.CustomHeaderInnerCard)11 ScrollView (android.widget.ScrollView)7 TextView (android.widget.TextView)6 CardExpand (it.gmariotti.cardslib.library.internal.CardExpand)6 MenuItem (android.view.MenuItem)4 CustomThumbCard (it.gmariotti.cardslib.demo.cards.CustomThumbCard)4 ViewToClickToExpand (it.gmariotti.cardslib.library.internal.ViewToClickToExpand)3 PopupMenu (android.widget.PopupMenu)2 GoogleNowBirthCard (it.gmariotti.cardslib.demo.cards.GoogleNowBirthCard)2 MayKnowCard (it.gmariotti.cardslib.demo.cards.MayKnowCard)2 SuggestedCard (it.gmariotti.cardslib.demo.cards.SuggestedCard)2 ProgressCard (it.gmariotti.cardslib.library.cards.ProgressCard)2 BaseSupplementalAction (it.gmariotti.cardslib.library.cards.actions.BaseSupplementalAction)2