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


Java DrawableRequestBuilder.error方法代码示例

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


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

示例1: buildThumbnailGlideRequest

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
private GenericRequestBuilder buildThumbnailGlideRequest(@NonNull Slide slide, @NonNull MasterSecret masterSecret) {
  @SuppressWarnings("ConstantConditions")
  DrawableRequestBuilder<DecryptableUri> builder = Glide.with(getContext())
                                                        .load(new DecryptableUri(masterSecret, slide.getThumbnailUri()))
                                                        .diskCacheStrategy(DiskCacheStrategy.NONE)
                                                        .crossFade()
                                                        .transform(new RoundedCorners(getContext(), true, radius, backgroundColorHint));

  if (slide.isInProgress()) return builder;
  else                      return builder.error(R.drawable.ic_missing_thumbnail_picture);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:12,代码来源:ThumbnailView.java

示例2: buildThumbnailGlideRequest

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
private GenericRequestBuilder buildThumbnailGlideRequest(@NonNull Slide slide, @NonNull MasterSecret masterSecret) {
  @SuppressWarnings("ConstantConditions")
  DrawableRequestBuilder<DecryptableUri> builder = Glide.with(getContext()).load(new DecryptableUri(masterSecret, slide.getThumbnailUri()))
                                                                           .crossFade()
                                                                           .transform(new RoundedCorners(getContext(), true, radius, backgroundColorHint));

  if (slide.isInProgress()) return builder;
  else                      return builder.error(R.drawable.ic_missing_thumbnail_picture);
}
 
开发者ID:SilenceIM,项目名称:Silence,代码行数:10,代码来源:ThumbnailView.java

示例3: loadImage

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
@Override
public void loadImage(Context ctx, GlideImageConfig config) {
    if (ctx == null) throw new IllegalStateException("Context is required");
    if (config == null) throw new IllegalStateException("GlideImageConfig is required");
    if (TextUtils.isEmpty(config.getUrl())) throw new IllegalStateException("url is required");
    if (config.getImageView() == null) throw new IllegalStateException("imageview is required");


    RequestManager manager;

    manager = Glide.with(ctx);//如果context是activity则自动使用Activity的生命周期

    DrawableRequestBuilder<String> requestBuilder = manager.load(config.getUrl())
            .crossFade()
            .centerCrop();

    switch (config.getCacheStrategy()) {//缓存策略
        case 0:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.ALL);
            break;
        case 1:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.NONE);
            break;
        case 2:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.SOURCE);
            break;
        case 3:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.RESULT);
            break;
    }

    if (config.getTransformation() != null) {//glide用它来改变图形的形状
        requestBuilder.transform(config.getTransformation());
    }


    if (config.getPlaceholder() != 0)//设置占位符
        requestBuilder.placeholder(config.getPlaceholder());

    if (config.getErrorPic() != 0)//设置错误的图片
        requestBuilder.error(config.getErrorPic());

    requestBuilder
            .into(config.getImageView());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:46,代码来源:GlideImageLoaderStrategy.java

示例4: loadImage

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
@Override
    public void loadImage(Context ctx, GlideImageConfig config) {
        if (ctx == null) throw new IllegalStateException("Context is required");
        if (config == null) throw new IllegalStateException("GlideImageConfig is required");
        //这里不抛异常空的就显示默认图片
//        if (TextUtils.isEmpty(config.getUrl())) throw new IllegalStateException("url is required");
        if (config.getImageView() == null) throw new IllegalStateException("imageview is required");


        RequestManager manager;

        manager = Glide.with(ctx);//如果context是activity则自动使用Activity的生命周期

        DrawableRequestBuilder<String> requestBuilder = manager.load(config.getUrl())
                .centerCrop();

        if (config.fitCenter()) {
            requestBuilder.fitCenter();
        }

        if (config.dontAnimation()) {
            requestBuilder.dontAnimate();
        } else {
            requestBuilder.crossFade();
        }

        switch (config.getCacheStrategy()) {//缓存策略
            case 0:
                requestBuilder.diskCacheStrategy(DiskCacheStrategy.ALL);
                break;
            case 1:
                requestBuilder.diskCacheStrategy(DiskCacheStrategy.NONE);
                break;
            case 2:
                requestBuilder.diskCacheStrategy(DiskCacheStrategy.SOURCE);
                break;
            case 3:
                requestBuilder.diskCacheStrategy(DiskCacheStrategy.RESULT);
                break;
        }

        if (config.getTransformation() != null) {//glide用它来改变图形的形状
            requestBuilder.transform(config.getTransformation());
        }

        //设置占位符
        if (config.getPlaceholder() != null) {
            requestBuilder.placeholder(config.getPlaceholder());
        } else if (config.getPlaceholderResId() != 0) {
            requestBuilder.placeholder(config.getPlaceholderResId());
        }

        if (config.getErrorPic() != 0)//设置错误的图片
            requestBuilder.error(config.getErrorPic());

        requestBuilder.skipMemoryCache(config.skipMemoryCache());

        requestBuilder.into(config.getImageView());
    }
 
开发者ID:BaoBaoJianqiang,项目名称:CustomListView,代码行数:60,代码来源:GlideImageLoaderStrategy.java

示例5: loadImage

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
@Override
public void loadImage(Context ctx, GlideImageConfig config) {
    RequestManager manager;
    if (ctx instanceof Activity)//如果是activity则可以使用Activity的生命周期
        manager = Glide.with((Activity) ctx);
    else
        manager = Glide.with(ctx);

    DrawableRequestBuilder<String> requestBuilder = manager.load(config.getUrl())
            .crossFade()
            .centerCrop();

    switch (config.getCacheStrategy()) {//缓存策略
        case 0:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.ALL);
            break;
        case 1:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.NONE);
            break;
        case 2:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.SOURCE);
            break;
        case 3:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.RESULT);
            break;
    }

    if (config.getTransformation() != null) {//glide用它来改变图形的形状
        requestBuilder.transform(config.getTransformation());
    }


    if (config.getPlaceholder() != 0)//设置占位符
        requestBuilder.placeholder(config.getPlaceholder());

    if (config.getErrorPic() != 0)//设置错误的图片
        requestBuilder.error(config.getErrorPic());

    requestBuilder
            .into(config.getImageView());
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:42,代码来源:GlideImageLoaderStrategy.java

示例6: load

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
@Override
public void load(Context context, GlideImageConfig config) {
    this.check(context, config);

    RequestManager manager = Glide.with(context);

    DrawableRequestBuilder<String> requestBuilder = manager.load(config.getUrl())
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .crossFade()// 默认显示淡入淡出动画
            ;

    // 缓存策略
    switch (config.getCacheStrategy()) {
        case 0:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.ALL);
            break;
        case 1:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.NONE);
            break;
        case 2:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.SOURCE);
            break;
        case 3:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.RESULT);
            break;
    }

    // 改变图形的形状
    if (config.getTransformation() != null) {
        requestBuilder.transform(config.getTransformation());
    }

    // 设置占位符
    if (config.getPlaceholder() != 0) {
        requestBuilder.placeholder(config.getPlaceholder());
    }

    // 设置错误的图片
    if (config.getError() != 0) {
        requestBuilder.error(config.getError());
    }

    requestBuilder.into(config.getImageView());
}
 
开发者ID:RockyQu,项目名称:MVVMFrames,代码行数:45,代码来源:GlideImageLoader.java

示例7: loadImage

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
@Override
public void loadImage(Context ctx, GlideImageConfig config) {
    if (ctx == null) throw new IllegalStateException("Context is required");
    if (config == null) throw new IllegalStateException("GlideImageConfig is required");
    if (TextUtils.isEmpty(config.getUrl())) throw new IllegalStateException("Url is required");
    if (config.getImageView() == null) throw new IllegalStateException("Imageview is required");


    RequestManager manager;

    manager = Glide.with(ctx);//如果context是activity则自动使用Activity的生命周期

    DrawableRequestBuilder<String> requestBuilder = manager.load(config.getUrl())
            .crossFade()
            .centerCrop();

    switch (config.getCacheStrategy()) {//缓存策略
        case 0:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.ALL);
            break;
        case 1:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.NONE);
            break;
        case 2:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.SOURCE);
            break;
        case 3:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.RESULT);
            break;
    }

    if (config.getTransformation() != null) {//glide用它来改变图形的形状
        requestBuilder.transform(config.getTransformation());
    }


    if (config.getPlaceholder() != 0)//设置占位符
        requestBuilder.placeholder(config.getPlaceholder());

    if (config.getErrorPic() != 0)//设置错误的图片
        requestBuilder.error(config.getErrorPic());

    requestBuilder
            .into(config.getImageView());
}
 
开发者ID:yangxp108,项目名称:MVPArms_Fragment-fragment,代码行数:46,代码来源:GlideImageLoaderStrategy.java

示例8: loadImage

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
/**
 * 根据GlideImageConfig中的配置进行加载图片
 *
 * @param ctx    context
 * @param config 图片加载
 */
@Override
public void loadImage(Context ctx, GlideImageConfig config) {
    if (ctx == null) throw new IllegalStateException("Context is required");
    if (config == null) throw new IllegalStateException("GlideImageConfig is required");
    if (TextUtils.isEmpty(config.getUrl())) throw new IllegalStateException("url is required");
    if (config.getImageView() == null) throw new IllegalStateException("imageview is required");


    RequestManager manager;

    manager = Glide.with(ctx);//如果context是activity则自动使用Activity的生命周期

    DrawableRequestBuilder<String> requestBuilder = manager.load(config.getUrl())
            .crossFade()
            .centerCrop();

    switch (config.getCacheStrategy()) {//缓存策略
        case 0:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.ALL);
            break;
        case 1:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.NONE);
            break;
        case 2:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.SOURCE);
            break;
        case 3:
            requestBuilder.diskCacheStrategy(DiskCacheStrategy.RESULT);
            break;
    }

    if (config.getTransformation() != null) {//glide用它来改变图形的形状
        requestBuilder.transform(config.getTransformation());
    }


    if (config.getPlaceholder() != 0)//设置占位符
        requestBuilder.placeholder(config.getPlaceholder());

    if (config.getErrorPic() != 0)//设置错误的图片
        requestBuilder.error(config.getErrorPic());

    requestBuilder
            .into(config.getImageView());
}
 
开发者ID:Wan7451,项目名称:mvparms,代码行数:52,代码来源:GlideImageLoaderStrategy.java

示例9: build

import com.bumptech.glide.DrawableRequestBuilder; //导入方法依赖的package包/类
private DrawableRequestBuilder build() {
  DrawableTypeRequest drawableTypeRequest;

  glide.resumeRequestsRecursive();

  if (!TextUtils.isEmpty(url)) {
    drawableTypeRequest = glide.load(url);
  } else if (resourceId != 0) {
    drawableTypeRequest = glide.load(resourceId);
  } else {
    return null;
  }
  GifTypeRequest gifTypeRequest = drawableTypeRequest.asGif();
  mGifRequest = gifTypeRequest.clone();

  DrawableRequestBuilder drawableRequestBuilder = drawableTypeRequest.clone();

  if (placeholder != null) {
    drawableRequestBuilder = drawableRequestBuilder.placeholder(placeholder);
  }

  if (error != null) {
    drawableRequestBuilder = drawableRequestBuilder.error(error);
  }

  if (width > 0 && height > 0) {
    drawableRequestBuilder = drawableRequestBuilder.override(width, height);
  }

  if (bitmapTransformation != null) {
    Transformation[] bitmapTransformationsAux = new Transformation[bitmapTransformation.size()];
    for (int i = 0; i < bitmapTransformation.size(); i++) {
      bitmapTransformationsAux[i] = bitmapTransformation.get(i);
    }
    drawableRequestBuilder = drawableRequestBuilder.bitmapTransform(bitmapTransformationsAux);
  }
  if (centerCrop) {
    drawableRequestBuilder = drawableRequestBuilder.centerCrop();
  }
  if (fitCenter) {
    drawableRequestBuilder = drawableRequestBuilder.fitCenter();
  }
  if (animate) {
    drawableRequestBuilder = drawableRequestBuilder.animate(android.R.anim.slide_in_left);
  }
  if (sizeMultiplier > 0) {
    drawableRequestBuilder = drawableRequestBuilder.sizeMultiplier(sizeMultiplier);
  }

  return drawableRequestBuilder;
}
 
开发者ID:Gigigo-Android-Devs,项目名称:gigigo-imageLoader-library-android,代码行数:52,代码来源:ImageLoaderBuilderImp.java


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