Java 类com.bumptech.glide.GifRequestBuilder 实例源码

项目:tenor-android-core    文件:GifLoader.java   
/**
 * Uses Glide to load a gif or image into an ImageView
 *
 * @param weakRef the {@link WeakReference} of a given subclass of {@link Context}
 * @param params  the {@link GlideTaskParams}
 */
public static <CTX extends Context, T extends ImageView> void loadGif(@NonNull WeakReference<CTX> weakRef,
                                                                      @NonNull GlideTaskParams<T> params) {

    if (!AbstractWeakReferenceUtils.isAlive(weakRef)) {
        return;
    }

    GifRequestBuilder<String> requestBuilder = Glide.with(weakRef.get()).load(params.getPath()).asGif()
            .diskCacheStrategy(DiskCacheStrategy.ALL);

    load(applyDimens(requestBuilder, params), params);
}
项目:Zatuji    文件:ImageHelper.java   
/**
 * gif图片显示
 */
private static GifRequestBuilder<String> baseGif(ImageView iv, String key){
    return Glide.with(iv.getContext())
            .load(key)
            .asGif()
            .crossFade(150)
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .placeholder(getRandomColor());
}