コード例 #1
0
 /** Subscriber for receive the product thumbnail. */
 @Override
 public void onHttpResponseReceived(Bitmap response, Params<Bitmap> params) {
   if (null != mBitmapFetcher && !mBitmapFetcher.isCancelled()) {
     final String baseUrl = params.getUrl();
     if (baseUrl.equals(mImageObject.getImageThumbnailUrl())) {
       Utils.updateImageWithDrawable(response, mImageView);
     }
     mBitmapFetcher = null;
   }
 }
コード例 #2
0
  /** Update the image item view */
  public void update(BaseImageObject result) {
    mImageObject = result;

    // Try to get product image from LRCCache
    String imageUrl = result.getImageThumbnailUrl();
    if (imageUrl != null) {
      Bitmap productImageBitmap = (Bitmap) LRUCache.getValue(imageUrl);
      if (productImageBitmap != null) {
        Utils.updateImageWithDrawable(productImageBitmap, mImageView);
      } else if (mImageObject != null) {
        // If get nothing from LRCCache, fetch the image by BitmapFetcher
        getImageFromBackground(mImageObject.getImageThumbnailUrl());
      }
    } else {
      mImageView.setImageResource(R.drawable.noimage);
    }

    if (mImageObject != null) {
      mImageText.setText(mImageObject.getImageName());
    }
  }