Search in sources :

Example 1 with ImageCardView

use of android.support.v17.leanback.widget.ImageCardView in project cw-omnibus by commonsguy.

the class PresoPresenter method onCreateViewHolder.

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    ImageCardView cardView = new ImageCardView(parent.getContext());
    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    return (new Holder(cardView));
}
Also used : ImageCardView(android.support.v17.leanback.widget.ImageCardView)

Example 2 with ImageCardView

use of android.support.v17.leanback.widget.ImageCardView in project vlc-android by videolan.

the class AsyncImageLoader method updateTargetImage.

public static void updateTargetImage(final Bitmap bitmap, final View target, final ViewDataBinding vdb) {
    if (bitmap == null || bitmap.getWidth() <= 1 || bitmap.getHeight() <= 1)
        return;
    if (vdb != null) {
        vdb.setVariable(BR.scaleType, ImageView.ScaleType.FIT_CENTER);
        vdb.setVariable(BR.cover, new BitmapDrawable(target.getResources(), bitmap));
        vdb.setVariable(BR.protocol, null);
    } else {
        VLCApplication.runOnMainThread(new Runnable() {

            @Override
            public void run() {
                if (target instanceof ImageView) {
                    final ImageView iv = (ImageView) target;
                    iv.setScaleType(ImageView.ScaleType.FIT_CENTER);
                    iv.setImageBitmap(bitmap);
                    iv.setVisibility(View.VISIBLE);
                } else if (target instanceof TextView) {
                    ViewCompat.setBackground(target, new BitmapDrawable(VLCApplication.getAppResources(), bitmap));
                    ((TextView) target).setText(null);
                } else if (target instanceof ImageCardView) {
                    ((ImageCardView) target).getMainImageView().setScaleType(ImageView.ScaleType.CENTER_CROP);
                    ((ImageCardView) target).setMainImage(new BitmapDrawable(target.getResources(), bitmap));
                }
            }
        });
    }
}
Also used : ImageCardView(android.support.v17.leanback.widget.ImageCardView) TextView(android.widget.TextView) BitmapDrawable(android.graphics.drawable.BitmapDrawable) ImageView(android.widget.ImageView)

Example 3 with ImageCardView

use of android.support.v17.leanback.widget.ImageCardView in project vlc-android by GeoffreyMetais.

the class CardPresenter method onCreateViewHolder.

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    ImageCardView cardView = new ImageCardView(mContext);
    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    cardView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.lb_details_overview_bg_color));
    cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT);
    return new ViewHolder(cardView);
}
Also used : ImageCardView(android.support.v17.leanback.widget.ImageCardView)

Example 4 with ImageCardView

use of android.support.v17.leanback.widget.ImageCardView in project butter-android by butterproject.

the class EpisodeCardPresenter method onCreateViewHolder.

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    context = parent.getContext();
    ImageCardView cardView = new ImageCardView(context);
    cardView.setCardType(BaseCardView.CARD_TYPE_INFO_UNDER);
    cardView.setInfoVisibility(BaseCardView.CARD_REGION_VISIBLE_ALWAYS);
    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    cardView.setBackgroundColor(ActivityCompat.getColor(context, R.color.default_background));
    return new ViewHolder(cardView);
}
Also used : ImageCardView(android.support.v17.leanback.widget.ImageCardView)

Example 5 with ImageCardView

use of android.support.v17.leanback.widget.ImageCardView in project butter-android by butterproject.

the class LoadingCardPresenter method onBindLoadingViewHolder.

public void onBindLoadingViewHolder(Presenter.ViewHolder viewHolder) {
    final ImageCardView cardView = (ImageCardView) viewHolder.view;
    cardView.setMainImageScaleType(ImageView.ScaleType.CENTER_INSIDE);
    cardView.setMainImage(ContextCompat.getDrawable(context, R.drawable.placeholder_inset));
    cardView.setTitleText(context.getString(R.string.loading));
    cardView.setMainImageDimensions(cardWidth, cardHeight);
}
Also used : ImageCardView(android.support.v17.leanback.widget.ImageCardView)

Aggregations

ImageCardView (android.support.v17.leanback.widget.ImageCardView)12 ImageView (android.widget.ImageView)3 BitmapDrawable (android.graphics.drawable.BitmapDrawable)2 TextView (android.widget.TextView)2 Episode (butter.droid.provider.base.model.Episode)1