当前位置: 首页>>代码示例>>Java>>正文


Java CardThumbnail类代码示例

本文整理汇总了Java中it.gmariotti.cardslib.library.internal.CardThumbnail的典型用法代码示例。如果您正苦于以下问题:Java CardThumbnail类的具体用法?Java CardThumbnail怎么用?Java CardThumbnail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CardThumbnail类属于it.gmariotti.cardslib.library.internal包,在下文中一共展示了CardThumbnail类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadBitmap

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
public void loadBitmap(CardThumbnail.CustomSource customSource, ImageView imageView) {
    final String imageKey = customSource.getTag();
    final Bitmap bitmap = getBitmapFromMemCache(imageKey);

    if (bitmap != null){
        if (!mCardThumbnail.applyBitmap(imageView,bitmap))
            imageView.setImageBitmap(bitmap);
        sendBroadcast();
    }else{
        if (cancelPotentialWork(customSource, imageView)) {
            final BitmapWorkerCustomSourceTask task = new BitmapWorkerCustomSourceTask(imageView);
            final AsyncDrawableCustomSource asyncDrawable =
                    new AsyncDrawableCustomSource(getResources(), null, task);
            imageView.setImageDrawable(asyncDrawable);
            task.execute(customSource);
        }
    }
}
 
开发者ID:Daniele-Comi,项目名称:System-Monitor,代码行数:19,代码来源:CardThumbnailView.java

示例2: cancelPotentialWork

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
public static boolean cancelPotentialWork(CardThumbnail.CustomSource customSource, ImageView imageView) {
    final BitmapWorkerCustomSourceTask bitmapWorkerTask = getBitmapWorkerCustomSourceTask(imageView);

    if (bitmapWorkerTask != null && bitmapWorkerTask.customSource != null) {
        final CardThumbnail.CustomSource bitmapWorkerTaskCustomSource = bitmapWorkerTask.customSource;
        if (bitmapWorkerTaskCustomSource.getTag() != null) {
            if (!bitmapWorkerTaskCustomSource.getTag().equals(customSource.getTag())) {
                // Cancel previous task
                bitmapWorkerTask.cancel(true);
            } else {
                // The same work is already in progress
                return false;
            }
        }
    }
    // No task associated with the ImageView, or an existing task was cancelled
    return true;
}
 
开发者ID:Daniele-Comi,项目名称:System-Monitor,代码行数:19,代码来源:CardThumbnailView.java

示例3: init

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
private void init() {

            //Add thumbnail
            CardThumbnail cardThumbnail = new CardThumbnail(mContext);

            if (resourceIdThumbnail == 0)
                cardThumbnail.setDrawableResource(R.drawable.ic_std_launcher);
            else {
                cardThumbnail.setDrawableResource(resourceIdThumbnail);
            }

            addCardThumbnail(cardThumbnail);

            setOnClickListener(new OnCardClickListener() {
                @Override
                public void onClick(Card card, View view) {
                    Toast.makeText(mContext, "Click Listener",Toast.LENGTH_SHORT).show();
                }
            });


        }
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:23,代码来源:ListGplayCardCABFragment.java

示例4: init

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
private void init(){

            //Create a CardHeader
            CardHeader header = new CardHeader(getActivity());

            //Set the header title
            header.setTitle(mTitleHeader);
            addCardHeader(header);

            CardThumbnail thumb = new CardThumbnail(getActivity());
            thumb.setDrawableResource(R.drawable.ic_launcher);
            addCardThumbnail(thumb);

            //Add ClickListener
            setOnClickListener(new OnCardClickListener() {
                @Override
                public void onClick(Card card, View view) {
                    Toast.makeText(getContext(), "Click Listener card=" + mTitleHeader, Toast.LENGTH_LONG).show();
                }
            });

            //Set the card inner text
            setTitle(mTitleMain);
        }
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:25,代码来源:ChangeValueCardFragment.java

示例5: init

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
private void init() {

        //Add a header
        SuggestedCardHeader header = new SuggestedCardHeader(getContext());
        addCardHeader(header);

        //Set click listener
        setOnClickListener(new OnCardClickListener() {
            @Override
            public void onClick(Card card, View view) {
                Toast.makeText(getContext(), "Click listener", Toast.LENGTH_LONG).show();
            }
        });

        //Set swipe on
        setSwipeable(true);

        //Add thumbnail
        CardThumbnail thumb = new SuggestedCardThumb(getContext());
        thumb.setUrlResource("https://lh5.googleusercontent.com/-N8bz9q4Kz0I/AAAAAAAAAAI/AAAAAAAAAAs/Icl2bQMyK7c/s265-c-k-no/photo.jpg");
        thumb.setErrorResource(R.drawable.ic_error_loadingorangesmall);
        addCardThumbnail(thumb);
    }
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:24,代码来源:SuggestedCard.java

示例6: init

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
private void init() {
    //Add Header
    CardHeader header = new MayKnowCardHeader(getContext(), R.layout.carddemo_mayknow_inner_header);
    header.setTitle(getContext().getString(R.string.may_know_card_title));
    addCardHeader(header);
    setShadow(false);

    //Add Thumbnail
    CardThumbnail thumbnail = new CardThumbnail(getContext());
    thumbnail.setUrlResource("https://plus.google.com/s2/photos/profile/114432517923423045208?sz=72");
    thumbnail.setErrorResource(R.drawable.ic_error_loadingsmall);
    addCardThumbnail(thumbnail);

    OnCardClickListener clickListener = new OnCardClickListener() {
        @Override
        public void onClick(Card card, View view) {
            //Do something
        }
    };

    addPartialOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW,clickListener);
}
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:23,代码来源:MayKnowCard.java

示例7: crouton1

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
/**
 * This method builds a simple card
 */
private void crouton1() {

    LayoutInflater mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = mInflater.inflate(R.layout.carddemo_extras_crouton_card, null);

    CardView cardView= (CardView)view.findViewById(R.id.carddemo_card_crouton_id);

    Card card = new Card(getActivity());
    card.setTitle("Crouton Card");
    card.setBackgroundResourceId(R.color.demoextra_card_background_color2);

    CardThumbnail thumb = new CardThumbnail(getActivity());
    thumb.setDrawableResource(R.drawable.ic_action_bulb);
    card.addCardThumbnail(thumb);

    cardView.setCard(card);

    final Crouton crouton;
    crouton = Crouton.make(getActivity(), view);
    crouton.show();

}
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:26,代码来源:CroutonFragment.java

示例8: cancelPotentialWork

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
public static boolean cancelPotentialWork(CardThumbnail.CustomSource customSource, ImageView imageView) {
    final BitmapWorkerCustomSourceTask bitmapWorkerTask = getBitmapWorkerCustomSourceTask(imageView);

    if (bitmapWorkerTask != null) {
        final CardThumbnail.CustomSource bitmapWorkerTaskCustomSource = bitmapWorkerTask.customSource;
        if (!bitmapWorkerTaskCustomSource.getTag().equals(customSource.getTag())) {
            // Cancel previous task
            bitmapWorkerTask.cancel(true);
        } else {
            // The same work is already in progress
            return false;
        }
    }
    // No task associated with the ImageView, or an existing task was cancelled
    return true;
}
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:17,代码来源:CardThumbnailView.java

示例9: createAddCard

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
private void createAddCard() {
    //Create new header and set the title
    CardHeader addLocationHeader = new CardHeader(this);
    addLocationHeader.setTitle("Add New Location");

    //Create new card instance
    Card addLocation = new Card(this);

    //Set thumbnail and drawable resource
    CardThumbnail addLocationThumb = new CardThumbnail(this);
    addLocationThumb.setDrawableResource(R.drawable.plus);

    //Set color
    addLocation.setBackgroundResourceId(R.color.darkred);

    //Add header
    addLocation.addCardHeader(addLocationHeader);

    //Add thumbnail
    addLocation.addCardThumbnail(addLocationThumb);

    //Set clickable
    addLocation.setClickable(true);

    //Add to arraylist
    cards.add(addLocation);

    //Set onClick listener
    addLocation.setOnClickListener(new Card.OnCardClickListener() {
        @Override
        public void onClick(Card card, View view) {
            //Set intent to AddLocation screen
            Intent intent = new Intent(MainActivity.this, AddLocationActivity.class);
            startActivity(intent);
        }
    });
}
 
开发者ID:tflynn93,项目名称:LocalVicinity,代码行数:38,代码来源:MainActivity.java

示例10: doInBackground

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
@Override
protected Bitmap doInBackground(CardThumbnail.CustomSource... params) {
    customSource = params[0];
    ImageView thumbnail = imageViewReference.get();
    Bitmap bitmap = customSource.getBitmap();
    if (bitmap!=null){
        addBitmapToMemoryCache(customSource.getTag(), bitmap);
        return bitmap;
    }else{
        return (Bitmap)null;
    }

}
 
开发者ID:Daniele-Comi,项目名称:System-Monitor,代码行数:14,代码来源:CardThumbnailView.java

示例11: init_card_thumb_resourceId

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
/**
 * This method builds a card with a thumbnail with a resource ID
 */
private void init_card_thumb_resourceId() {

    //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));

    //Add header to a card
    card.addCardHeader(header);

    //Create thumbnail
    CardThumbnail thumb = new CardThumbnail(getActivity());

    //Set ID resource
    thumb.setDrawableResource(R.drawable.carddemo_ic_gmaps_large);

    //Add thumbnail to a card
    card.addCardThumbnail(thumb);

    //Set card in the cardView
    CardView cardView = (CardView) getActivity().findViewById(R.id.carddemo_thumb_id);
    cardView.setCard(card);
}
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:31,代码来源:ThumbnailFragment.java

示例12: init_card_thumb_resourceURL

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:33,代码来源:ThumbnailFragment.java

示例13: init

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
private void init() {

            //Add Header
            GoogleNowBirthHeaderNew header = new GoogleNowBirthHeaderNew(getContext(), R.layout.carddemo_googlenowbirth2_inner_header);
            header.mName = "Gabriele Mariotti";
            header.mSubName = "Birthday today";
             header.setCustomOverflowAnimation(new SimpleBirthAnimation(getActivity(),this));
            addCardHeader(header);


            //Set clickListener
            addPartialOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW,new OnCardClickListener() {
                @Override
                public void onClick(Card card, View view) {
                    Toast.makeText(getContext(), "Click Listener card", Toast.LENGTH_LONG).show();
                }
            });


            //Add Thumbnail
            CardThumbnail thumbnail = new CardThumbnail(getContext());
            float density = getContext().getResources().getDisplayMetrics().density;
            int size= (int)(125*density);
            thumbnail.setUrlResource("https://plus.google.com/s2/photos/profile/114432517923423045208?sz="+size);
            thumbnail.setErrorResource(R.drawable.ic_ic_error_loading);
            addCardThumbnail(thumbnail);
        }
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:28,代码来源:OverflowAnimFragment.java

示例14: init

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
private void init() {

        //Add thumbnail
        CardThumbnail cardThumbnail = new CardThumbnail(mContext);
        cardThumbnail.setDrawableResource(R.drawable.carddemo_ic_gmaps);
        addCardThumbnail(cardThumbnail);

        //Add ClickListener
        setOnClickListener(new OnCardClickListener() {
            @Override
            public void onClick(Card card, View view) {
                Toast.makeText(getContext(), "Click Listener card=", Toast.LENGTH_LONG).show();
            }
        });
    }
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:16,代码来源:GooglePlaySmallCard.java

示例15: loadReportedTaxis

import it.gmariotti.cardslib.library.internal.CardThumbnail; //导入依赖的package包/类
private List<ReportedTaxiCard> loadReportedTaxis() {

        List<ReportedTaxiCard> reportedTaxis = new ArrayList<ReportedTaxiCard>();

        for (int i = 0; i < 10; i++) {

            ReportedTaxiCard reportedTaxiCard = new ReportedTaxiCard(getActivity());
            // Create a CardHeader
            CardHeader header = new CardHeader(getActivity());
            header.setTitle("Angry bird: " + i);
            header.setOtherButtonVisible(true);
            header.setOtherButtonDrawable(R.drawable.card_menu_button_other_dismiss);
            header.setOtherButtonClickListener(new CardHeader.OnClickCardHeaderOtherButtonListener() {
                @Override
                public void onButtonItemClick(Card card, View view) {
                    dismissAnimation.animateDismiss(card);
                }
            });

            reportedTaxiCard.addCardHeader(header);
            reportedTaxiCard.setTitle("Sample title");

            CardThumbnail thumb = new CardThumbnail(getActivity());
            thumb.setDrawableResource(R.drawable.default_taxi);
            thumb.setErrorResource(R.drawable.ic_ic_error_loading);
            reportedTaxiCard.addCardThumbnail(thumb);

            reportedTaxis.add(reportedTaxiCard);
        }

        return reportedTaxis;
    }
 
开发者ID:mSobhy90,项目名称:TaxiFareCalculator,代码行数:33,代码来源:ReportedTaxisFragment.java


注:本文中的it.gmariotti.cardslib.library.internal.CardThumbnail类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。