Example #1
0
 @Override
 public void setImageBitmap(Bitmap bm) {
   unRegistehandler();
   if (mCurrentDownloadRequest != null) {
     mCurrentDownloadRequest.cancelDownload();
   }
   setImageBitmap(bm, false);
 }
Example #2
0
 @Override
 public void setImageDrawable(Drawable drawable) {
   unRegistehandler();
   if (mCurrentDownloadRequest != null) {
     mCurrentDownloadRequest.cancelDownload();
   }
   if (mHasAnimation) {
     this.clearAnimation();
   }
   super.setImageDrawable(drawable);
 }
Example #3
0
 @Override
 public void setImageResource(int resId) {
   unRegistehandler();
   if (mCurrentDownloadRequest != null) {
     mCurrentDownloadRequest.cancelDownload();
   }
   if (mHasAnimation) {
     this.clearAnimation();
   }
   super.setImageResource(resId);
 }
Example #4
0
  public void setImageURI(Uri uri, boolean forceOriginLoad) {
    unRegistehandler();
    mCurrentBtLoadSuccess = false;

    if (uri != null) {
      if (DEBUG) {
        Log.d(
            "setImageURI",
            "[[setImageURI]] uri : "
                + uri.getScheme()
                + " uri path : "
                + uri.getPath()
                + " uri title : "
                + uri.getHost()
                + " encode path = "
                + uri.getEncodedPath()
                + " toString : "
                + uri.toString());
      }
      String path = uri.getPath();
      if (!TextUtils.isEmpty(path) && path.toLowerCase().startsWith("http")) {
        this.setImageUrl(uri.getPath(), forceOriginLoad);
        return;
      } else if (!TextUtils.isEmpty(path) && path.toLowerCase().startsWith(FILE_CONTENT)) {
        String localUri = path.substring(FILE_CONTENT.length());
        if (!TextUtils.isEmpty(localUri)) {
          this.setImageUrlLocal(localUri, forceOriginLoad);
          return;
        }
      }
      mUrl = null;
      setImageDrawable(mDefaultSrc);
    } else {
      mUrl = null;
      if (mCurrentDownloadRequest != null) {
        mCurrentDownloadRequest.cancelDownload();
      }
      if (mHasAnimation) {
        this.clearAnimation();
      }
      // super.setImageURI(uri);
      if (mWebImageViewStatusListener != null) {
        mHandler.post(
            new Runnable() {
              @Override
              public void run() {
                mWebImageViewStatusListener.onLoadImageFailed(WebImageView.this, mUrl);
              }
            });
      }
      setImageDrawable(mDefaultSrc);
    }
  }