com.bumptech.glide.load.engine.GlideException Java Examples

The following examples show how to use com.bumptech.glide.load.engine.GlideException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GlideImageLoader.java    From BaseProject with Apache License 2.0 5 votes vote down vote up
private void mainThreadCallback(final long bytesRead, final long totalBytes, final boolean isDone, final GlideException exception) {
    mMainThreadHandler.post(new Runnable() {
        @Override
        public void run() {
            final int percent = (int) ((bytesRead * 1.0f / totalBytes) * 100.0f);
            if (onProgressListener != null) {
                onProgressListener.onProgress((String) mImageUrlObj, bytesRead, totalBytes, isDone, exception);
            }

            if (onGlideImageViewListener != null) {
                onGlideImageViewListener.onProgress(percent, isDone, exception);
            }
        }
    });
}
 
Example #2
Source File: DilbertFragment.java    From Simple-Dilbert with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
    if (image != null) {
        image.setImageResource(R.drawable.cancel);
    }
    if (progress != null) {
        progress.setVisibility(View.GONE);
    }
    if (getActivity() != null)
        Toast.makeText(getActivity(),
                R.string.loading_exception_error, Toast.LENGTH_SHORT)
                .show();
    return false;
}
 
Example #3
Source File: DemoGlideHelper.java    From GestureViews with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable GlideException ex, Object model,
        Target<T> target, boolean isFirstResource) {
    if (listener != null) {
        listener.onError();
    }
    return false;
}
 
Example #4
Source File: ConditionalAlbumListFragment.java    From PainlessMusicPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onLoadFailed(
        @Nullable final GlideException e,
        @NonNull final Object model,
        @NonNull final Target<Drawable> target,
        final boolean isFirstResource) {
    showPlaceholderAlbumArt();
    return true;
}
 
Example #5
Source File: QueueActivity.java    From PainlessMusicPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onLoadFailed(
        @Nullable final GlideException e,
        @NonNull final Object model,
        @NonNull final Target<Drawable> target,
        final boolean isFirstResource) {
    mCoverUri = null;
    showPlaceholderArt();
    onImageSet();
    return true;
}
 
Example #6
Source File: NowPlayingActivity.java    From PainlessMusicPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onLoadFailed(
        @Nullable final GlideException e,
        @NonNull final Object model,
        @NonNull final Target<Drawable> target,
        final boolean isFirstResource) {
    albumArt.setAlpha(0f);
    albumArt.setImageResource(R.drawable.album_art_placeholder);
    albumArt.animate().alpha(1f).start();
    onArtProcessed();
    return true;
}
 
Example #7
Source File: TinyGifDrawableLoader.java    From BaseProject with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
    CommonLog.e(TAG, "-->onLoadFailed() occur: " + e);
    String exceptionInfo = "load fail";
    if (e != null) {
        exceptionInfo = e.getMessage();
    }
    loadCallback(false, false,null, 0, exceptionInfo);
    return false;
}
 
Example #8
Source File: GlideImageLoader.java    From BaseProject with Apache License 2.0 5 votes vote down vote up
private void addProgressListener() {
    if (getImageUrl() == null) return;
    final String url = getImageUrl();
    if (!url.startsWith(HTTP)) return;

    internalProgressListener = new OnProgressListener() {
        @Override
        public void onProgress(String imageUrl, long bytesRead, long totalBytes, boolean isDone, GlideException exception) {
            if (totalBytes == 0) return;
            if (!url.equals(imageUrl)) return;
            if (mLastBytesRead == bytesRead && mLastStatus == isDone) return;

            mLastBytesRead = bytesRead;
            mTotalBytes = totalBytes;
            mLastStatus = isDone;
            mainThreadCallback(bytesRead, totalBytes, isDone, exception);

            if (isDone) {
                ProgressManager.removeProgressListener(this);
            }
        }
    };
    ProgressManager.addProgressListener(internalProgressListener);
}
 
Example #9
Source File: ProgressManager.java    From BaseProject with Apache License 2.0 5 votes vote down vote up
@Override
public void onProgress(String imageUrl, long bytesRead, long totalBytes, boolean isDone, GlideException exception) {
    if (listeners == null || listeners.size() == 0) return;

    for (int i = 0; i < listeners.size(); i++) {
        WeakReference<OnProgressListener> listener = listeners.get(i);
        OnProgressListener progressListener = listener.get();
        if (progressListener == null) {
            listeners.remove(i);
        } else {
            progressListener.onProgress(imageUrl, bytesRead, totalBytes, isDone, exception);
        }
    }
}
 
Example #10
Source File: LoggingListener.java    From glide-support with The Unlicense 5 votes vote down vote up
@Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<R> target,
		boolean isFirstResource) {
	android.util.Log.println(level, "GLIDE", String.format(Locale.ROOT,
			"%s.onLoadFailed(%s, %s, %s, %s)\n%s",
			name, e, model, strip(target), isFirst(isFirstResource), android.util.Log.getStackTraceString(e)));
	return delegate.onLoadFailed(e, model, target, isFirstResource);
}
 
Example #11
Source File: ImageLoader.java    From Android-App-Architecture-MVVM-Databinding with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable final GlideException e, final Object model, final Target<Drawable> target,
        final boolean isFirstResource) {
    if (BuildConfig.DEBUG) {
        Log.e(TAG, String.format(Locale.ROOT,
                "GLIDE onException(%s, %s, %s, %s)", e, model, target, isFirstResource), e);
    }

    return false;
}
 
Example #12
Source File: SvgSoftwareLayerSetter.java    From GlideToVectorYou with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<PictureDrawable> target,
                            boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    view.setLayerType(ImageView.LAYER_TYPE_NONE, null);

    if (customListener != null) {
        customListener.onLoadFailed();
    }
    return false;
}
 
Example #13
Source File: GiphyAdapter.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
  Log.w(TAG, e);

  synchronized (this) {
    if (new ChunkedImageUrl(image.getGifUrl(), image.getGifSize()).equals(model)) {
      this.modelReady = true;
      notifyAll();
    }
  }

  return false;
}
 
Example #14
Source File: ImageUtil.java    From BaseProject with Apache License 2.0 4 votes vote down vote up
public static void loadGifModel(Context context, Object mayBeGifModel, @RawRes @DrawableRes int defHolderPicRes, ImageView ivTarget, final int needPlayTime) {
    if (mayBeGifModel == null) {
        return;
    }
    RequestBuilder<GifDrawable> gifDrawableBuilder = null;
    try {
          gifDrawableBuilder = Glide.with(context).asGif()
                ;
    } catch (Exception e) {
        //java.lang.IllegalArgumentException You cannot start a load for a destroyed activity
        gifDrawableBuilder = null;
        e.printStackTrace();
    }
    if (gifDrawableBuilder == null) {
        return;
    }
    if (defHolderPicRes != 0) {
        gifDrawableBuilder.placeholder(defHolderPicRes)
                .error(defHolderPicRes);
    }
    RequestListener<GifDrawable> loadGifDrawableListener = null;
    if (needPlayTime >= 1) {
        loadGifDrawableListener = 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) {
                resource.setLoopCount(needPlayTime);
                return false;
            }
        };
        gifDrawableBuilder.listener(loadGifDrawableListener);
    }
    if (mayBeGifModel instanceof Integer) {//还有:load(Bitmap xx);load(byte[]xxx);loadDrawable(Drawable xx);有差异
        Integer gifResId = (Integer) mayBeGifModel;
        if (gifResId != 0) {
            gifDrawableBuilder.load(gifResId);
        }
        else {
            return;
        }
    }
    else{
        gifDrawableBuilder.load(mayBeGifModel);
    }
    gifDrawableBuilder.into(ivTarget);
}
 
Example #15
Source File: NoOpRequestListener.java    From glide-support with The Unlicense 4 votes vote down vote up
@Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<R> target,
		boolean isFirstResource) {
	return false;
}
 
Example #16
Source File: FileExpandableAdapter.java    From ShareBox with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
    return false;
}
 
Example #17
Source File: ImageLoader.java    From CrazyDaily with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<File> target, boolean isFirstResource) {
    target.onResourceReady(new File(URI.create(model.toString())), null);
    return false;
}
 
Example #18
Source File: GlidePalette.java    From GlidePalette with Apache License 2.0 4 votes vote down vote up
@Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<TranscodeType> target, boolean isFirstResource) {
    return this.callback != null && this.callback.onLoadFailed(e, model, target, isFirstResource);
}
 
Example #19
Source File: ImagePagerAdapter.java    From Hentoid with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
    return false;
}
 
Example #20
Source File: GalleryAdapter.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object o, Target<Drawable> target, boolean b) {
    return false;
}
 
Example #21
Source File: DokitGlideRequestListener.java    From DoraemonKit with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<R> target, boolean isFirstResource) {
    return false;
}
 
Example #22
Source File: OnGlideImageViewListener.java    From BaseProject with Apache License 2.0 votes vote down vote up
void onProgress(int percent, boolean isDone, GlideException exception); 
Example #23
Source File: OnProgressListener.java    From BaseProject with Apache License 2.0 votes vote down vote up
void onProgress(String imageUrl, long bytesRead, long totalBytes, boolean isDone, GlideException exception); 
Example #24
Source File: ImageLoaderProgressListener.java    From HHComicViewer with Apache License 2.0 votes vote down vote up
void onProgress(int percent, boolean isDone, GlideException exception);