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


Java DrawableRequestBuilder.listener方法代码示例

本文整理汇总了Java中com.bumptech.glide.DrawableRequestBuilder.listener方法的典型用法代码示例。如果您正苦于以下问题:Java DrawableRequestBuilder.listener方法的具体用法?Java DrawableRequestBuilder.listener怎么用?Java DrawableRequestBuilder.listener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.bumptech.glide.DrawableRequestBuilder的用法示例。


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

示例1: loadAvatar

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
public static void loadAvatar(Context context, ImageView view,
                              @Nullable User user, @NotNull String url, int index,
                              @Nullable OnLoadImageListener<User> l) {
    DrawableRequestBuilder<Integer> thumbnailRequest = Glide.with(context)
            .load(R.drawable.default_avatar)
            .override(128, 128)
            .transform(new CircleTransformation(context))
            .diskCacheStrategy(DiskCacheStrategy.SOURCE);
    DrawableRequestBuilder<String> request = Glide.with(context)
            .load(url)
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .override(128, 128)
            .transform(new CircleTransformation(context))
            .thumbnail(thumbnailRequest);
    if (l != null) {
        request.listener(new UserSaturationListener(context, view, user, index, l));
    }
    request.into(view);
}
 
开发者ID:WangDaYeeeeee,项目名称:Mysplash,代码行数:20,代码来源:ImageHelper.java

示例2: loadRegularPhoto

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
private static DrawableRequestBuilder<String> loadRegularPhoto(Context context, ImageView view,
                                                              Photo photo, int index,
                                                              boolean saturation, boolean execute,
                                                              @Nullable OnLoadImageListener<Photo> l) {
    if (photo != null && photo.urls != null
            && photo.width != 0 && photo.height != 0) {

        DrawableRequestBuilder<String> thumbnailRequest = Glide
                .with(context)
                .load(photo.urls.thumb)
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .listener(new SetEnableListener(view));

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
                && !photo.hasFadedIn && saturation) {
            AnimUtils.ObservableColorMatrix matrix = new AnimUtils.ObservableColorMatrix();
            matrix.setSaturation(0);
            view.setColorFilter(new ColorMatrixColorFilter(matrix));
        }
        view.setEnabled(false);

        DrawableRequestBuilder<String> regularRequest = Glide
                .with(context)
                .load(photo.getRegularSizeUrl(context))
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .override(photo.getRegularWidth(), photo.getRegularHeight())
                .thumbnail(thumbnailRequest)
                .animate(new FadeAnimator());
        if (l != null && saturation) {
            regularRequest.listener(new PhotoSaturationListener(context, view, photo, index, l));
        } else if (l != null) {
            regularRequest.listener(new BaseRequestListener<Photo, String, GlideDrawable>(photo, 0, l));
        }
        if (execute) {
            regularRequest.into(view);
        }
        return regularRequest;
    }
    return null;
}
 
开发者ID:WangDaYeeeeee,项目名称:Mysplash,代码行数:41,代码来源:ImageHelper.java

示例3: loadImageFromUrl

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
public static void loadImageFromUrl(Context context, ImageView view, String url, boolean lowPriority,
                                    @Nullable OnLoadImageListener<String> l) {
    DrawableRequestBuilder<String> request = Glide
            .with(context)
            .load(url)
            .diskCacheStrategy(DiskCacheStrategy.SOURCE);
    if (lowPriority) {
        request.priority(Priority.LOW);
    }
    if (l != null) {
        request.listener(new BaseRequestListener<String, String, GlideDrawable>(url, 0, l));
    }
    request.into(view);
}
 
开发者ID:WangDaYeeeeee,项目名称:Mysplash,代码行数:15,代码来源:ImageHelper.java


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