Search in sources :

Example 1 with DrawableTransitionOptions

use of com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions in project TicktockMusic by Lauzy.

the class GlideImageLoaderStrategy method display.

@Override
public void display(Context context, ImageConfig imageConfig) {
    RequestOptions options = getOptions(context, imageConfig);
    Object url = getPath(imageConfig);
    if (!imageConfig.isAsBitmap()) {
        RequestBuilder<Drawable> requestBuilder = Glide.with(context).load(url).apply(options);
        if (!imageConfig.isRound() && imageConfig.getDuration() != 0) {
            requestBuilder = requestBuilder.transition(new DrawableTransitionOptions().crossFade(imageConfig.getDuration()));
        }
        requestBuilder.into(imageConfig.getImageView());
    } else {
        RequestBuilder<Bitmap> requestBuilder = Glide.with(context).asBitmap().load(url).apply(options);
        if (!imageConfig.isRound() && imageConfig.getDuration() != 0) {
            requestBuilder = requestBuilder.transition(new BitmapTransitionOptions().crossFade(imageConfig.getDuration()));
        }
        requestBuilder.into(imageConfig.getTarget());
    }
}
Also used : DrawableTransitionOptions(com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions) Bitmap(android.graphics.Bitmap) RequestOptions(com.bumptech.glide.request.RequestOptions) Drawable(android.graphics.drawable.Drawable) BitmapTransitionOptions(com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions)

Example 2 with DrawableTransitionOptions

use of com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions in project 91Pop by DanteAndroid.

the class FavoriteAdapter method convert.

@Override
protected void convert(BaseViewHolder helper, UnLimit91PornItem item) {
    helper.setText(R.id.tv_91porn_item_title, item.getTitle() + "  (" + item.getDuration() + ")");
    helper.setText(R.id.tv_91porn_item_info, item.getInfo());
    ImageView simpleDraweeView = helper.getView(R.id.iv_91porn_item_img);
    Uri uri = Uri.parse(item.getImgUrl());
    GlideApp.with(helper.itemView).load(uri).placeholder(R.drawable.placeholder).transition(new DrawableTransitionOptions().crossFade(300)).into(simpleDraweeView);
    helper.addOnClickListener(R.id.right_menu_delete);
}
Also used : DrawableTransitionOptions(com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions) ImageView(android.widget.ImageView) Uri(android.net.Uri)

Example 3 with DrawableTransitionOptions

use of com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions in project 91Pop by DanteAndroid.

the class HistoryAdapter method convert.

@Override
protected void convert(BaseViewHolder helper, UnLimit91PornItem item) {
    helper.setText(R.id.tv_91porn_item_title, item.getTitle() + "  (" + item.getDuration() + ")");
    helper.setText(R.id.tv_91porn_item_info, item.getInfo());
    ImageView simpleDraweeView = helper.getView(R.id.iv_91porn_item_img);
    Uri uri = Uri.parse(item.getImgUrl());
    GlideApp.with(helper.itemView).load(uri).placeholder(R.drawable.placeholder).transition(new DrawableTransitionOptions().crossFade(300)).into(simpleDraweeView);
    helper.addOnClickListener(R.id.right_menu_delete);
}
Also used : DrawableTransitionOptions(com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions) ImageView(android.widget.ImageView) Uri(android.net.Uri)

Example 4 with DrawableTransitionOptions

use of com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions in project 91Pop by DanteAndroid.

the class MeiZiTuAdapter method convert.

@Override
protected void convert(BaseViewHolder helper, MeiZiTu item) {
    ImageView imageView = helper.getView(R.id.iv_item_mei_zi_tu);
    GlideApp.with(helper.itemView.getContext()).load(buildGlideUrl(item.getThumbUrl())).transition(new DrawableTransitionOptions().crossFade(300)).into(imageView);
    int height;
    if (!heightMap.containsKey(item.getThumbUrl())) {
        height = item.getHeight() * width / item.getWidth();
        heightMap.put(item.getThumbUrl(), height);
    } else {
        height = heightMap.get(item.getThumbUrl());
    }
    StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) helper.itemView.getLayoutParams();
    layoutParams.height = height;
    helper.itemView.setLayoutParams(layoutParams);
}
Also used : DrawableTransitionOptions(com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) ImageView(android.widget.ImageView)

Example 5 with DrawableTransitionOptions

use of com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions in project 91Pop by DanteAndroid.

the class PigAvAdapter method convert.

@Override
protected void convert(BaseViewHolder helper, PigAv item) {
    helper.setText(R.id.tv_item_pig_av_title, item.getTitle());
    int height;
    if (!heightMap.containsKey(item.getImgUrl())) {
        height = item.getImgHeight() * width / item.getImgWidth() + 15;
        heightMap.put(item.getImgUrl(), height);
    } else {
        height = heightMap.get(item.getImgUrl());
    }
    AppCompatImageView imageView = helper.getView(R.id.iv_item_pig_av_img);
    LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) imageView.getLayoutParams();
    layoutParams.height = height;
    imageView.setLayoutParams(layoutParams);
    GlideApp.with(helper.itemView).load(item.getImgUrl()).placeholder(R.drawable.placeholder).transition(new DrawableTransitionOptions().crossFade(300)).into(imageView);
}
Also used : DrawableTransitionOptions(com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions) AppCompatImageView(android.support.v7.widget.AppCompatImageView) LinearLayout(android.widget.LinearLayout)

Aggregations

DrawableTransitionOptions (com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions)12 Uri (android.net.Uri)6 ImageView (android.widget.ImageView)5 Drawable (android.graphics.drawable.Drawable)2 View (android.view.View)2 Bitmap (android.graphics.Bitmap)1 NonNull (android.support.annotation.NonNull)1 Nullable (android.support.annotation.Nullable)1 AppCompatImageView (android.support.v7.widget.AppCompatImageView)1 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)1 LinearLayout (android.widget.LinearLayout)1 ProgressBar (android.widget.ProgressBar)1 DataSource (com.bumptech.glide.load.DataSource)1 GlideException (com.bumptech.glide.load.engine.GlideException)1 BitmapTransitionOptions (com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions)1 RequestListener (com.bumptech.glide.request.RequestListener)1 RequestOptions (com.bumptech.glide.request.RequestOptions)1 Target (com.bumptech.glide.request.target.Target)1 TouchImageView (com.dante.custom.TouchImageView)1 ExoVideoControlsMobile (com.flymegoc.exolibrary.widget.ExoVideoControlsMobile)1