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


Java RequestListener类代码示例

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


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

示例1: obtainRequest

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:RequestBuilder.java

示例2: displayImageFromUrl

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:narenkukreja,项目名称:quire,代码行数:21,代码来源:ImageUtils.java

示例3: displayGifImageFromUrl

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:narenkukreja,项目名称:quire,代码行数:22,代码来源:ImageUtils.java

示例4: loadImage

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
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);
}
 
开发者ID:feer921,项目名称:BaseProject,代码行数:17,代码来源:ImageUtil.java

示例5: loadMainViewShotWithPlaceholderAndListener

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
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);

}
 
开发者ID:netguru,项目名称:inbbbox-android,代码行数:20,代码来源:ShotLoadingUtil.java

示例6: listener

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:RequestBuilder.java

示例7: into

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:RequestBuilder.java

示例8: buildRequest

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:RequestBuilder.java

示例9: displayImage

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
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);
    }
 
开发者ID:Zyj163,项目名称:yyox,代码行数:12,代码来源:ImageLoaderManager.java

示例10: onResourceReady

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
@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;
}
 
开发者ID:TWiStErRob,项目名称:glide-support,代码行数:10,代码来源:MultiRequestListener.java

示例11: loadImage

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:ashishbhandari,项目名称:RetailStore,代码行数:22,代码来源:ImageLoader.java

示例12: beginImageLoad

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
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);
    }
}
 
开发者ID:ashishbhandari,项目名称:RetailStore,代码行数:12,代码来源:ImageLoader.java

示例13: loadListBlurredShotWithListener

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
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);
}
 
开发者ID:netguru,项目名称:inbbbox-android,代码行数:12,代码来源:ShotLoadingUtil.java

示例14: beginImageLoad

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
public BitmapRequestBuilder beginImageLoad(String url,
        RequestListener<String, Bitmap> requestListener, boolean crop) {
    return requestManager.load(url)
            .asBitmap()
            .listener(requestListener)
            .transform(crop ? mCenterCrop : mFitCenter);
}
 
开发者ID:taoliuh,项目名称:v2ex,代码行数:8,代码来源:ImageLoader.java

示例15: loadCenterCrop

import com.bumptech.glide.request.RequestListener; //导入依赖的package包/类
public static void loadCenterCrop(Context context, String url, ImageView view, RequestListener listener) {
    Glide.with(context).load(url).centerCrop().dontAnimate().listener(listener).into(view);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ImageLoader.java


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