Search in sources :

Example 6 with GenericRequestBuilder

use of com.bumptech.glide.GenericRequestBuilder in project BBS-Android by bdpqchen.

the class GlideImageGeter method getDrawable.

@Override
public Drawable getDrawable(String url) {
    final UrlDrawable urlDrawable = new UrlDrawable(mContext);
    final GenericRequestBuilder load;
    final Target target;
    load = Glide.with(mContext).load(url).asBitmap().fitCenter().listener(new RequestListener<String, Bitmap>() {

        @Override
        public boolean onException(Exception e, String model, Target<Bitmap> target, boolean isFirstResource) {
            LogUtil.dd("glide laod onException");
            return false;
        }

        @Override
        public boolean onResourceReady(Bitmap resource, String model, Target<Bitmap> target, boolean isFromMemoryCache, boolean isFirstResource) {
            LogUtil.dd("glide load onResourceReady");
            return false;
        }
    });
    target = new BitmapTarget(urlDrawable);
    // load.override(100, 100).into(target);
    load.override(600, 600);
    load.into(target);
    return urlDrawable;
}
Also used : SimpleTarget(com.bumptech.glide.request.target.SimpleTarget) Target(com.bumptech.glide.request.target.Target) Bitmap(android.graphics.Bitmap) RequestListener(com.bumptech.glide.request.RequestListener) GenericRequestBuilder(com.bumptech.glide.GenericRequestBuilder)

Aggregations

GenericRequestBuilder (com.bumptech.glide.GenericRequestBuilder)6 Context (android.content.Context)2 Bundle (android.os.Bundle)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 PagerSnapHelper (android.support.v7.widget.PagerSnapHelper)2 RecyclerView (android.support.v7.widget.RecyclerView)2 SnapHelper (android.support.v7.widget.SnapHelper)2 LayoutInflater (android.view.LayoutInflater)2 View (android.view.View)2 ViewGroup (android.view.ViewGroup)2 ViewTreeObserver (android.view.ViewTreeObserver)2 BindView (butterknife.BindView)2 ButterKnife (butterknife.ButterKnife)2 Unbinder (butterknife.Unbinder)2 ListPreloader (com.bumptech.glide.ListPreloader)2 RequestManager (com.bumptech.glide.RequestManager)2 DiskCacheStrategy (com.bumptech.glide.load.engine.DiskCacheStrategy)2 SimpleTarget (com.bumptech.glide.request.target.SimpleTarget)2 Target (com.bumptech.glide.request.target.Target)2 R (com.simplecity.amp_library.R)2