use of com.bumptech.glide.load.engine.GlideException in project Camera-Roll-Android-App by kollerlukas.
the class GifViewHolder method loadImage.
@Override
public void loadImage(final ImageView imageView, final AlbumItem albumItem) {
// super.loadImage(imageView, albumItem);
RequestOptions options = new RequestOptions().error(R.drawable.error_placeholder).signature(albumItem.getGlideSignature());
Glide.with(imageView.getContext()).asGif().load(albumItem.getPath()).listener(new RequestListener<GifDrawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
if (!albumItem.hasFadedIn) {
fadeIn();
} else {
imageView.clearColorFilter();
}
resource.start();
return false;
}
}).apply(options).into(imageView);
}
use of com.bumptech.glide.load.engine.GlideException in project CloudReader by youlookwhat.
the class BaseHeaderActivity method setImgHeaderBg.
/**
* 加载titlebar背景
*/
private void setImgHeaderBg(String imgUrl) {
if (!TextUtils.isEmpty(imgUrl)) {
// 高斯模糊背景 原来 参数:12,5 23,4
Glide.with(this).load(imgUrl).error(R.drawable.stackblur_default).transform(new BlurTransformation(40, 8)).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
bindingTitleView.tbBaseTitle.setBackgroundColor(Color.TRANSPARENT);
bindingTitleView.ivBaseTitlebarBg.setImageAlpha(0);
bindingTitleView.ivBaseTitlebarBg.setVisibility(View.VISIBLE);
return false;
}
}).into(bindingTitleView.ivBaseTitlebarBg);
}
}
use of com.bumptech.glide.load.engine.GlideException in project Douya by DreaminginCodeZH.
the class GalleryAdapter method loadImageForPosition.
private void loadImageForPosition(int position, ViewHolder holder) {
ViewUtils.fadeIn(holder.progress);
GlideApp.with(holder.progress.getContext()).downloadOnlyDefaultPriority().load(mImageList.get(position)).progressListener(new ProgressListener() {
@Override
public void onProgress(long bytesRead, long contentLength, boolean done) {
int progress = Math.round((float) bytesRead / contentLength * holder.progress.getMax());
ProgressBarCompat.setProgress(holder.progress, progress, true);
}
}).listener(new RequestListener<File>() {
@Override
public boolean onResourceReady(File resource, Object model, Target<File> target, DataSource dataSource, boolean isFirstResource) {
return false;
}
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<File> target, boolean isFirstResource) {
showError(e, R.string.gallery_network_error, holder);
return false;
}
}).into(new SimpleTarget<File>() {
@Override
public void onResourceReady(File file, Transition<? super File> transition) {
mFileMap.put(position, file);
if (mListener != null) {
mListener.onFileDownloaded(position);
}
holder.progress.setIndeterminate(true);
loadImageFromFile(file, holder);
}
});
}
use of com.bumptech.glide.load.engine.GlideException in project glide by bumptech.
the class SingleRequest method begin.
@Override
public void begin() {
assertNotCallingCallbacks();
stateVerifier.throwIfRecycled();
startTime = LogTime.getLogTime();
if (model == null) {
if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
width = overrideWidth;
height = overrideHeight;
}
// Only log at more verbose log levels if the user has set a fallback drawable, because
// fallback Drawables indicate the user expects null models occasionally.
int logLevel = getFallbackDrawable() == null ? Log.WARN : Log.DEBUG;
onLoadFailed(new GlideException("Received null model"), logLevel);
return;
}
if (status == Status.RUNNING) {
throw new IllegalArgumentException("Cannot restart a running request");
}
// the new load.
if (status == Status.COMPLETE) {
onResourceReady(resource, DataSource.MEMORY_CACHE);
return;
}
// Restarts for requests that are neither complete nor running can be treated as new requests
// and can run again from the beginning.
status = Status.WAITING_FOR_SIZE;
if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
onSizeReady(overrideWidth, overrideHeight);
} else {
target.getSize(this);
}
if ((status == Status.RUNNING || status == Status.WAITING_FOR_SIZE) && canNotifyStatusChanged()) {
target.onLoadStarted(getPlaceholderDrawable());
}
if (IS_VERBOSE_LOGGABLE) {
logV("finished run method in " + LogTime.getElapsedMillis(startTime));
}
}
use of com.bumptech.glide.load.engine.GlideException in project glide by bumptech.
the class SingleRequestTest method testIsFailedAfterNoResultAndNullException.
@Test
public void testIsFailedAfterNoResultAndNullException() {
SingleRequest<List> request = builder.build();
request.onLoadFailed(new GlideException("test"));
assertTrue(request.isFailed());
}
Aggregations