/** * Creates a new instance of Error from the given <var>failReason</var>. * * @param failReason The reason from which to create the error. * @return New error instance. */ private static ImageLoader.Error errorFromFailReason(FailReason failReason) { int reason = ImageLoader.Error.REASON_UNKNOWN; switch (failReason.getType()) { case IO_ERROR: reason = ImageLoader.Error.REASON_IO; break; case DECODING_ERROR: reason = ImageLoader.Error.REASON_DECODING; break; case NETWORK_DENIED: reason = ImageLoader.Error.REASON_NETWORK; break; case OUT_OF_MEMORY: reason = ImageLoader.Error.REASON_MEMORY; break; case UNKNOWN: default: } return new ImageLoader.Error(reason, "Failed to load image.", failReason.getCause()); }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { if(callback != null){ //boolean isSuccess, String uri, String savedPath, String failInfo String errorInfo = ""; if(failReason != null){ if(failReason.getCause() != null){ errorInfo = failReason.getCause().getLocalizedMessage(); failReason.getCause().printStackTrace(); } } callback.onFinish(false, imageUri, null, failReason.getCause().getLocalizedMessage()); }else{ if(failReason != null){ if(failReason.getCause() != null){ failReason.getCause().printStackTrace(); } } } }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { String message = null; switch (failReason.getType()) { case IO_ERROR: message = "Input/Output error"; break; case DECODING_ERROR: message = "Image can't be decoded"; break; case NETWORK_DENIED: message = "Downloads are denied"; break; case OUT_OF_MEMORY: message = "Out Of Memory error"; break; case UNKNOWN: message = "Unknown error"; break; } Log.w(TAG, "imageUri = " + imageUri + " message = " + message); ProgressBar spinner = (ProgressBar) view.getTag(); spinner.setVisibility(View.GONE); view.setVisibility(View.VISIBLE); }
/** * 图片加载失败事件处理分发 * @param failType * @param failCause */ private void fireFailEvent(final FailType failType, final Throwable failCause) { if (syncLoading || isTaskInterrupted() || isTaskNotActual()) return; Runnable r = new Runnable() { @Override public void run() { if (options.shouldShowImageOnFail()) { //存在图片加载失败的占位图片配置,进行设置 imageAware.setImageDrawable(options.getImageOnFail(configuration.resources)); } //进行回调图片加载失败方法 listener.onLoadingFailed(uri, imageAware.getWrappedView(), new FailReason(failType, failCause)); } }; //任务进行运行 runTask(r, false, handler, engine); }
public void getAlbumImage(final Album album, final CompletionListener listener) { if (album == null) return; imageLoader.loadImage(LiqearApplication.getAppContext(), album.getImageUrl(), new ImageLoadingListener() { @Override public void onLoadingStarted() { } @Override public void onLoadingFailed(FailReason failReason) { } @Override public void onLoadingComplete(Bitmap bitmap) { AudioTimeline.setCurrentAlbumBitmap(bitmap); listener.onCompleted(); } @Override public void onLoadingCancelled() { } }); }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { String message = null; switch (failReason.getType()) { case IO_ERROR: message = "Input/Output error"; break; case DECODING_ERROR: message = "Image can't be decoded"; break; case NETWORK_DENIED: message = "Downloads are denied"; break; case OUT_OF_MEMORY: message = "Out Of Memory error"; break; case UNKNOWN: message = "Unknown error"; break; } Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); spinner.setVisibility(View.GONE); }
private void fireFailEvent(final FailType failType, final Throwable failCause) { if (syncLoading || isTaskInterrupted() || isTaskNotActual()) return; Runnable r = new Runnable() { @Override public void run() { if (options.shouldShowImageOnFail()) { imageAware.setImageDrawable(options.getImageOnFail(configuration.resources)); } listener.onLoadingFailed(uri, imageAware.getWrappedView(), new FailReason(failType, failCause)); } }; runTask(r, false, handler, engine); }
private void fireFailEvent(final FailType failType, final Throwable failCause) { if (!this.syncLoading && !isTaskInterrupted() && !isTaskNotActual()) { runTask(new Runnable() { public void run() { if (LoadAndDisplayImageTask.this.options.shouldShowImageOnFail()) { LoadAndDisplayImageTask.this.imageAware.setImageDrawable(LoadAndDisplayImageTask.this.options.getImageOnFail(LoadAndDisplayImageTask.this.configuration.resources)); } LoadAndDisplayImageTask.this.listener.onLoadingFailed(LoadAndDisplayImageTask.this.uri, LoadAndDisplayImageTask.this.imageAware.getWrappedView(), new FailReason(failType, failCause)); } }, false, this.handler, this.engine); } }
public void run() { if (this.this$0.options.shouldShowImageOnFail()) { this.this$0.imageAware.setImageDrawable(this.this$0.options.getImageOnFail (LoadAndDisplayImageTask.access$000(this.this$0).resources)); } this.this$0.listener.onLoadingFailed(this.this$0.uri, this.this$0.imageAware .getWrappedView(), new FailReason(this.val$failType, this.val$failCause)); }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { mImageView.setScaleType(ImageView.ScaleType.CENTER); mProgress.setVisibility(View.GONE); PhotoViewAttacher photo = new PhotoViewAttacher(mImageView); photo.setMaxScale(8); photo.setOnPhotoTapListener(this); photo.setOnViewTapListener(this); }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { mImageView.setScaleType(ImageView.ScaleType.CENTER); mProgress.setVisibility(View.GONE); PhotoViewAttacher photo = new PhotoViewAttacher(mImageView); photo.setMaxScale(8); }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { super.onLoadingFailed(imageUri, view, failReason); MemeLayout.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); inferior.setVisibility(View.GONE); superior.setVisibility(View.GONE); }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { mProgressBar.setVisibility(View.GONE); mImageView.setVisibility(View.VISIBLE); mImageView.setImageDrawable(mLargeImageOptions .getImageOnFail(mContext.getResources())); }
n(l l1, com.nostra13.universalimageloader.core.assist.FailReason.FailType failtype, Throwable throwable) { c = l1; a = failtype; b = throwable; super(); }
public void run() { if (c.c.shouldShowImageOnFail()) { c.b.setImageDrawable(c.c.getImageOnFail(l.a(c).a)); } c.d.onLoadingFailed(c.a, c.b.getWrappedView(), new FailReason(a, b)); }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { if (view == null) return; Object tag = view.getTag(R.id.tag_image); if (enableDebugLog) FLog.d("tag: %s", tag); view.setTag(R.id.tag_image, null); if (shouldForward()) callback.onLoadFinish(false, imageUri, view); }
private void fireFailEvent(final FailType failType, final Throwable failCause) { if (options.isSyncLoading() || isTaskInterrupted() || isTaskNotActual()) return; handler.post(new Runnable() { @Override public void run() { if (options.shouldShowImageOnFail()) { imageAware.setImageDrawable(options.getImageOnFail(configuration.resources)); } listener.onLoadingFailed(uri, imageAware.getWrappedView(), new FailReason(failType, failCause)); } }); }
private void fireImageLoadingFailedEvent(final FailType failType, final Throwable failCause) { if (!Thread.interrupted()) { handler.post(new Runnable() { @Override public void run() { if (options.shouldShowImageOnFail()) { imageView.setImageResource(options.getImageOnFail()); } listener.onLoadingFailed(uri, imageView, new FailReason(failType, failCause)); } }); } }
@Override public void onLoadingFailed(final String imageUri, final View view, final FailReason failReason) { final DemoActivity demoActivity = mActivityReference.get(); if (demoActivity != null) { Toast.makeText(demoActivity, "Error during image loading", Toast.LENGTH_SHORT) .show(); demoActivity.mProgressBar.setVisibility(View.GONE); } }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { if (failbackAddress != null) { rLoadUrl(failbackAddress); } else { loadDefault(); } }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { String message = null; switch (failReason.getType()) { case IO_ERROR: message = "Input/Output error"; break; case DECODING_ERROR: message = "Image can't be decoded"; break; case NETWORK_DENIED: message = "Downloads are denied"; break; case OUT_OF_MEMORY: message = "Out Of Memory error"; break; case UNKNOWN: message = "Unknown error"; break; } Animation a = ((ImageView) view).getAnimation(); if (a != null) view.clearAnimation(); //a.cancel(); view.setVisibility(View.GONE); }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { // Empty implementation }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { // Do nothing }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { }
@Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { // Can we use default image here? dont want to end stream if the image cannot be obtained // Or use onErrorResumeNext? //observer.onError(failReason.getCause()); }