Java 类com.bumptech.glide.request.RequestListener 实例源码

项目:GitHub    文件:RequestBuilder.java   
private Request obtainRequest(
    Target<TranscodeType> target,
    RequestListener<TranscodeType> targetListener,
    RequestOptions requestOptions,
    RequestCoordinator requestCoordinator,
    TransitionOptions<?, ? super TranscodeType> transitionOptions,
    Priority priority,
    int overrideWidth,
    int overrideHeight) {
  return SingleRequest.obtain(
      context,
      glideContext,
      model,
      transcodeClass,
      requestOptions,
      overrideWidth,
      overrideHeight,
      priority,
      target,
      targetListener,
      requestListener,
      requestCoordinator,
      glideContext.getEngine(),
      transitionOptions.getTransitionFactory());
}
项目:quire    文件:ImageUtils.java   
/**
 * Displays an image from a URL in an ImageView.
 */
public static void displayImageFromUrl(final Context context, final String url,
                                       final ImageView imageView, RequestListener listener) {
    if (listener != null) {
        Glide.with(context)
                .load(url)
                .dontAnimate()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .listener(listener)
                .into(imageView);
    } else {
        Glide.with(context)
                .load(url)
                .dontAnimate()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .into(imageView);
    }
}
项目:quire    文件:ImageUtils.java   
/**
 * Displays an image from a URL in an ImageView.
 */
public static void displayGifImageFromUrl(Context context, String url, ImageView imageView, RequestListener listener) {
    if (listener != null) {
        Glide.with(context)
                .load(url)
                .asGif()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .dontAnimate()
                .listener(listener)
                .into(imageView);
    } else {
        Glide.with(context)
                .load(url)
                .asGif()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .dontAnimate()
                .into(imageView);
    }
}
项目:BaseProject    文件:ImageUtil.java   
public static void loadImage(Context context, String picUrl, int newWidth, int newHeight, int holderDrawableResId,
                             int errorDrawableResId, ImageView targetIv
        , RequestListener callback){
    Resources res = context.getResources();
    Drawable holderPic = null;
    if (holderDrawableResId > 0) {
        holderPic = res.getDrawable(holderDrawableResId);
    }
    Drawable errorDrawable = null;
    if (errorDrawableResId > 0) {
        errorDrawable = res.getDrawable(errorDrawableResId);
    }
    loadImage(context, picUrl, newWidth, newHeight,holderPic,
            errorDrawable,
            targetIv, callback);
}
项目:inbbbox-android    文件:ShotLoadingUtil.java   
public static void loadMainViewShotWithPlaceholderAndListener(Context context, ImageView placeholderView,
                                                              ImageView targetView, ShotImage shot,
                                                              RequestListener<String, GlideDrawable> requestListener) {
    Glide.clear(targetView);
    String imageUrl = getImageUrl(shot);

    Glide.clear(placeholderView);
    placeholderView.setVisibility(View.GONE);

    GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(targetView);
    Glide.with(context)
            .load(imageUrl)
            .listener(requestListener)
            .placeholder(R.drawable.shot_placeholder)
            .thumbnail(ShotLoadingUtil.getThumbnailRequest(context, shot.thumbnailUrl()))
            .animate(android.R.anim.fade_in)
            .into(imageViewTarget);

}
项目:GitHub    文件:RequestBuilder.java   
/**
 * Sets a {@link RequestListener} to monitor the resource load. It's best to create a single
 * instance of an exception handler per type of request (usually activity/fragment) rather than
 * pass one in per request to avoid some redundant object allocation.
 *
 * @param requestListener The request listener to use.
 * @return This request builder.
 */
@CheckResult
@SuppressWarnings("unchecked")
public RequestBuilder<TranscodeType> listener(
    @Nullable RequestListener<TranscodeType> requestListener) {
  this.requestListener = requestListener;

  return this;
}
项目:GitHub    文件:RequestBuilder.java   
private <Y extends Target<TranscodeType>> Y into(
    @NonNull Y target,
    @Nullable RequestListener<TranscodeType> targetListener,
    RequestOptions options) {
  Util.assertMainThread();
  Preconditions.checkNotNull(target);
  if (!isModelSet) {
    throw new IllegalArgumentException("You must call #load() before calling #into()");
  }

  options = options.autoClone();
  Request request = buildRequest(target, targetListener, options);

  Request previous = target.getRequest();
  if (request.isEquivalentTo(previous)) {
    request.recycle();
    // If the request is completed, beginning again will ensure the result is re-delivered,
    // triggering RequestListeners and Targets. If the request is failed, beginning again will
    // restart the request, giving it another chance to complete. If the request is already
    // running, we can let it continue running without interruption.
    if (!Preconditions.checkNotNull(previous).isRunning()) {
      // Use the previous request rather than the new one to allow for optimizations like skipping
      // setting placeholders, tracking and untracking Targets, and obtaining View dimensions that
      // are done in the individual Request.
      previous.begin();
    }
    return target;
  }

  requestManager.clear(target);
  target.setRequest(request);
  requestManager.track(target, request);

  return target;
}
项目:GitHub    文件:RequestBuilder.java   
private Request buildRequest(
    Target<TranscodeType> target,
    @Nullable RequestListener<TranscodeType> targetListener,
    RequestOptions requestOptions) {
  return buildRequestRecursive(
      target,
      targetListener,
      /*parentCoordinator=*/ null,
      transitionOptions,
      requestOptions.getPriority(),
      requestOptions.getOverrideWidth(),
      requestOptions.getOverrideHeight(),
      requestOptions);
}
项目:yyox    文件:ImageLoaderManager.java   
public void displayImage(String url, ImageView imageView, RequestListener<String, Bitmap> requestListener) {

        Glide.with(context)
                .load(url)
                .asBitmap()
                .thumbnail(0.1f)
                .placeholder(R.drawable.kf5_image_loading)
                .error(R.drawable.kf5_image_loading_failed)
                .listener(requestListener)
                .into(imageView);
    }
项目:Hotspot-master-devp    文件:GlideImageLoader.java   
public  void loadImage(Context context, String imgPath, ImageView imageView, int placeHolderId, RequestListener listener) {
    if (context == null) {
        return;
    }
    Context appContext = context.getApplicationContext();
    loadImage(appContext, imgPath, imageView, placeHolderId, placeHolderId,listener);
}
项目:Hotspot-master-devp    文件:GlideImageLoader.java   
public  void loadImage(Context context, String imgPath, ImageView imageView, int placeholderResId, int failedResId, RequestListener listener) {
    if(!(listener instanceof RequestListener))
        throw new RuntimeException("this listener is not RequestListener type!");

    Glide.with(context)
            .load(imgPath).listener(listener)
            .placeholder(placeholderResId)
            .error(failedResId)
            .crossFade()
            .into(imageView);
}
项目:iosched-reader    文件:ImageLoader.java   
/**
 * Load an image from a url into an ImageView using the default placeholder
 * drawable if available.
 * @param url The web URL of an image.
 * @param imageView The target ImageView to load the image into.
 * @param requestListener A listener to monitor the request result.
 * @param placeholderOverride A drawable to use as a placeholder for this specific image.
 *                            If this parameter is present, {@link #mPlaceHolderResId}
 *                            if ignored for this request.
 */
public void loadImage(String url, ImageView imageView, RequestListener<String, Bitmap> requestListener,
            Drawable placeholderOverride, boolean crop) {
    BitmapRequestBuilder request = beginImageLoad(url, requestListener, crop)
            .animate(R.anim.image_fade_in);
    if (placeholderOverride != null) {
        request.placeholder(placeholderOverride);
    } else if (mPlaceHolderResId != -1) {
        request.placeholder(mPlaceHolderResId);
    }
    request.into(imageView);
}
项目:iosched-reader    文件:ImageLoader.java   
public BitmapRequestBuilder beginImageLoad(String url,
        RequestListener<String, Bitmap> requestListener, boolean crop) {
    if (crop){
        return mGlideModelRequest.load(url)
                .listener(requestListener)
                .transform(mCenterCrop);
    } else {
        return mGlideModelRequest.load(url)
                .listener(requestListener);
    }
}
项目:smconf-android    文件:ImageLoader.java   
/**
 * Load an image from a url into an ImageView using the default placeholder
 * drawable if available.
 * @param url The web URL of an image.
 * @param imageView The target ImageView to load the image into.
 * @param requestListener A listener to monitor the request result.
 * @param placeholderOverride A drawable to use as a placeholder for this specific image.
 *                            If this parameter is present, {@link #mPlaceHolderResId}
 *                            if ignored for this request.
 */
public void loadImage(String url, ImageView imageView, RequestListener<String, Bitmap> requestListener,
            Drawable placeholderOverride, boolean crop) {
    BitmapRequestBuilder request = beginImageLoad(url, requestListener, crop)
            .animate(R.anim.image_fade_in);
    if (placeholderOverride != null) {
        request.placeholder(placeholderOverride);
    } else if (mPlaceHolderResId != -1) {
        request.placeholder(mPlaceHolderResId);
    }
    request.into(imageView);
}
项目:smconf-android    文件:ImageLoader.java   
public BitmapRequestBuilder beginImageLoad(String url,
        RequestListener<String, Bitmap> requestListener, boolean crop) {
    if (crop){
        return mGlideModelRequest.load(url)
                .listener(requestListener)
                .transform(mCenterCrop);
    } else {
        return mGlideModelRequest.load(url)
                .listener(requestListener);
    }
}
项目:wnacg    文件:ViewHolder.java   
public ViewHolder setImage(@IdRes int viewId, String url, Drawable placeholder, RequestListener listener){
    Glide.with(mContext)
            .load(url)
            .placeholder(placeholder)
            .listener(listener)
            .crossFade()
            .into((ImageView) getView(viewId));
    return this;
}
项目:wnacg    文件:ViewHolder.java   
/** 设置有加载监听器、有占位资源的图片 */
public ViewHolder setImageUrl(@IdRes int viewId, String url, @DrawableRes int placeholder,
                              RequestListener listener){
    Glide.with(mContext)
            .load(url)
            .placeholder(placeholder)
            .listener(listener)
            .crossFade()
            .into((ImageView) getView(viewId));
    return this;
}
项目:glide-support    文件:MultiRequestListener.java   
@Override public boolean onException(Exception e, A model, Target<B> target, boolean isFirstResource) {
    for (RequestListener<? super A, B> listener : listeners) {
        if (listener.onException(e, model, target, isFirstResource)) {
            return true;
        }
    }
    return false;
}
项目:glide-support    文件:MultiRequestListener.java   
@Override public boolean onResourceReady(B resource, A model, Target<B> target, boolean isFromMemoryCache,
        boolean isFirstResource) {
    for (RequestListener<? super A, B> listener : listeners) {
        if (listener.onResourceReady(resource, model, target, isFromMemoryCache, isFirstResource)) {
            return true;
        }
    }
    return false;
}
项目:RetailStore    文件:ImageLoader.java   
/**
 * Load an image from a url into an ImageView using the default placeholder
 * drawable if available.
 * @param url The web URL of an image.
 * @param imageView The target ImageView to load the image into.
 * @param requestListener A listener to monitor the request result.
 * @param placeholderOverride A drawable to use as a placeholder for this specific image.
 *                            If this parameter is present, {@link #mPlaceHolderResId}
 *                            if ignored for this request.
 */
public void loadImage(String url, ImageView imageView, RequestListener<String, Bitmap> requestListener,
            Drawable placeholderOverride, boolean crop) {
    BitmapRequestBuilder request = beginImageLoad(url, requestListener, crop)
            .animate(R.anim.image_fade_in);
    if (placeholderOverride != null) {
        request.placeholder(placeholderOverride);
    } else if (mPlaceHolderResId != -1) {
        request.placeholder(mPlaceHolderResId);
    }
    request.into(imageView);
}
项目:RetailStore    文件:ImageLoader.java   
public BitmapRequestBuilder beginImageLoad(String url,
        RequestListener<String, Bitmap> requestListener, boolean crop) {
    if (crop){
        return mGlideModelRequest.load(url)
                .listener(requestListener)
                .transform(mCenterCrop);
    } else {
        return mGlideModelRequest.load(url)
                .listener(requestListener);
    }
}
项目:2015-Google-I-O-app    文件:ImageLoader.java   
/**
 * Load an image from a url into an ImageView using the default placeholder
 * drawable if available.
 * @param url The web URL of an image.
 * @param imageView The target ImageView to load the image into.
 * @param requestListener A listener to monitor the request result.
 * @param placeholderOverride A drawable to use as a placeholder for this specific image.
 *                            If this parameter is present, {@link #mPlaceHolderResId}
 *                            if ignored for this request.
 */
public void loadImage(String url, ImageView imageView, RequestListener<String, Bitmap> requestListener,
            Drawable placeholderOverride, boolean crop) {
    BitmapRequestBuilder request = beginImageLoad(url, requestListener, crop)
            .animate(R.anim.image_fade_in);
    if (placeholderOverride != null) {
        request.placeholder(placeholderOverride);
    } else if (mPlaceHolderResId != -1) {
        request.placeholder(mPlaceHolderResId);
    }
    request.into(imageView);
}
项目:2015-Google-I-O-app    文件:ImageLoader.java   
public BitmapRequestBuilder beginImageLoad(String url,
        RequestListener<String, Bitmap> requestListener, boolean crop) {
    if (crop){
        return mGlideModelRequest.load(url)
                .listener(requestListener)
                .transform(mCenterCrop);
    } else {
        return mGlideModelRequest.load(url)
                .listener(requestListener);
    }
}
项目:BaseProject    文件:ImageUtil.java   
public static void loadImage(Context context, String picUrl, int newWidth, int newHeight, Drawable holderDrawable,
                             Drawable errorDrawable, ImageView targetIv
        ,  RequestListener callback) {
    RequestBuilder requestBuilder = loadImageRequest(context, picUrl);
    RequestOptions options = new RequestOptions();
    if (newWidth > 0 && newHeight > 0) {
        options.override(newWidth,newHeight).centerCrop();
    }
    else{
        //            loadRequest.fit();
    }
    if (holderDrawable != null) {
        options.placeholder(holderDrawable);
    }
    else{
//        loadRequest.noPlaceholder();
    }
    if (errorDrawable != null) {
        options.error(errorDrawable);
    }
    options.dontAnimate();
    if (callback != null) {
        requestBuilder.listener(callback);
    }
    requestBuilder.apply(options)
            .into(targetIv);
}
项目:inbbbox-android    文件:ShotLoadingUtil.java   
public static void loadListBlurredShotWithListener(Context context, ImageView target, ShotImage shot,
                                                   RequestListener<String, GlideDrawable> requestListener) {
    target.setImageResource(R.drawable.shot_placeholder);
    Glide.clear(target);
    Glide.with(context)
            .load(shot.normalImageUrl())
            .thumbnail(ShotLoadingUtil.getThumbnailRequest(context, shot.thumbnailUrl()))
            .listener(requestListener)
            .bitmapTransform(new BlurTransformation(context))
            .into(target);
}
项目:FMTech    文件:ImageLoader.java   
/**
 * Load an image from a url into an ImageView using the default placeholder
 * drawable if available.
 * @param url The web URL of an image.
 * @param imageView The target ImageView to load the image into.
 * @param requestListener A listener to monitor the request result.
 * @param placeholderOverride A drawable to use as a placeholder for this specific image.
 *                            If this parameter is present, {@link #mPlaceHolderResId}
 *                            if ignored for this request.
 */
public void loadImage(String url, ImageView imageView, RequestListener<String, Bitmap> requestListener,
            Drawable placeholderOverride, boolean crop) {
    BitmapRequestBuilder request = beginImageLoad(url, requestListener, crop)
            .animate(R.anim.image_fade_in);
    if (placeholderOverride != null) {
        request.placeholder(placeholderOverride);
    } else if (mPlaceHolderResId != -1) {
        request.placeholder(mPlaceHolderResId);
    }
    request.into(imageView);
}
项目:FMTech    文件:ImageLoader.java   
public BitmapRequestBuilder beginImageLoad(String url,
        RequestListener<String, Bitmap> requestListener, boolean crop) {
    if (crop){
        return mGlideModelRequest.load(url)
                .listener(requestListener)
                .transform(mCenterCrop);
    } else {
        return mGlideModelRequest.load(url)
                .listener(requestListener);
    }
}
项目:JJCamera    文件:ImageLoader.java   
/**
 * Load an image from a url into an ImageView using the default placeholder
 * drawable if available.
 * @param url The web URL of an image.
 * @param imageView The target ImageView to load the image into.
 * @param requestListener A listener to monitor the request result.
 * @param placeholderOverride A drawable to use as a placeholder for this specific image.
 *                            If this parameter is present, {@link #mPlaceHolderResId}
 *                            if ignored for this request.
 */
public void loadImage(String url, ImageView imageView, RequestListener<String, Bitmap> requestListener,
            Drawable placeholderOverride, boolean crop) {
    BitmapRequestBuilder request = beginImageLoad(url, requestListener, crop)
            .animate(R.anim.image_fade_in);
    if (placeholderOverride != null) {
        request.placeholder(placeholderOverride);
    } else if (mPlaceHolderResId != -1) {
        request.placeholder(mPlaceHolderResId);
    }
    request.into(imageView);
}
项目:JJCamera    文件:ImageLoader.java   
public BitmapRequestBuilder beginImageLoad(String url,
        RequestListener<String, Bitmap> requestListener, boolean crop) {
    if (crop){
        return mGlideModelRequest.load(url)
                .listener(requestListener)
                .transform(mCenterCrop);
    } else {
        return mGlideModelRequest.load(url)
                .listener(requestListener);
    }
}
项目:iosched    文件:ImageLoader.java   
/**
 * Load an image from a url into an ImageView using the default placeholder
 * drawable if available.
 * @param url The web URL of an image.
 * @param imageView The target ImageView to load the image into.
 * @param requestListener A listener to monitor the request result.
 * @param placeholderOverride A drawable to use as a placeholder for this specific image.
 *                            If this parameter is present, {@link #mPlaceHolderResId}
 *                            if ignored for this request.
 */
public void loadImage(String url, ImageView imageView, RequestListener<String, Bitmap> requestListener,
            Drawable placeholderOverride, boolean crop) {
    BitmapRequestBuilder request = beginImageLoad(url, requestListener, crop)
            .animate(R.anim.image_fade_in);
    if (placeholderOverride != null) {
        request.placeholder(placeholderOverride);
    } else if (mPlaceHolderResId != -1) {
        request.placeholder(mPlaceHolderResId);
    }
    request.into(imageView);
}
项目:iosched    文件:ImageLoader.java   
public BitmapRequestBuilder beginImageLoad(String url,
        RequestListener<String, Bitmap> requestListener, boolean crop) {
    if (crop){
        return mGlideModelRequest.load(url)
                .listener(requestListener)
                .transform(mCenterCrop);
    } else {
        return mGlideModelRequest.load(url)
                .listener(requestListener);
    }
}
项目:v2ex    文件:ImageLoader.java   
/**
 * Load an image from a url into an ImageView using the default placeholder
 * drawable if available.
 * @param url The web URL of an image.
 * @param imageView The target ImageView to load the image into.
 * @param requestListener A listener to monitor the request result.
 * @param placeholderOverride A drawable to use as a placeholder for this specific image.
 *                            If this parameter is present, {@link #mPlaceHolderResId}
 *                            if ignored for this request.
 */
public void loadImage(String url, ImageView imageView, RequestListener<String, Bitmap> requestListener,
            Drawable placeholderOverride, boolean crop) {
    BitmapRequestBuilder request = beginImageLoad(url, requestListener, crop)
            .animate(R.anim.image_fade_in);
    if (placeholderOverride != null) {
        request.placeholder(placeholderOverride);
    } else if (mPlaceHolderResId != -1) {
        request.placeholder(mPlaceHolderResId);
    }
    request.into(imageView);
}
项目:v2ex    文件:ImageLoader.java   
public BitmapRequestBuilder beginImageLoad(String url,
        RequestListener<String, Bitmap> requestListener, boolean crop) {
    return requestManager.load(url)
            .asBitmap()
            .listener(requestListener)
            .transform(crop ? mCenterCrop : mFitCenter);
}
项目:GitHub    文件:ImageLoader.java   
public static void loadCenterCrop(Context context, String url, ImageView view, RequestListener listener) {
    Glide.with(context).load(url).centerCrop().dontAnimate().listener(listener).into(view);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@CheckResult
public GlideRequest<TranscodeType> listener(@Nullable RequestListener<TranscodeType> arg0) {
  return (GlideRequest<TranscodeType>) super.listener(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@CheckResult
public GlideRequest<TranscodeType> listener(@Nullable RequestListener<TranscodeType> arg0) {
  return (GlideRequest<TranscodeType>) super.listener(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@CheckResult
public GlideRequest<TranscodeType> listener(@Nullable RequestListener<TranscodeType> arg0) {
  return (GlideRequest<TranscodeType>) super.listener(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@CheckResult
public GlideRequest<TranscodeType> listener(@Nullable RequestListener<TranscodeType> arg0) {
  return (GlideRequest<TranscodeType>) super.listener(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@CheckResult
public GlideRequest<TranscodeType> listener(@Nullable RequestListener<TranscodeType> arg0) {
  return (GlideRequest<TranscodeType>) super.listener(arg0);
}
项目:GitHub    文件:GlideRequest.java   
@Override
@CheckResult
public GlideRequest<TranscodeType> listener(@Nullable RequestListener<TranscodeType> arg0) {
  return (GlideRequest<TranscodeType>) super.listener(arg0);
}