예제 #1
0
  @Override
  public void onSuccess(final ImageContainer container) {
    LogUtils.d(TAG, "onSuccess");
    progressView.post(
        new Runnable() {

          @Override
          public void run() {
            progressView.setVisibility(View.GONE);
            Bitmap bitmap = container.getBitmap();
            int oldWidth = bitmap.getWidth();
            int oldHeight = bitmap.getHeight();
            float f = ((float) imageWidth) / oldWidth;
            int dheight = (int) (f * oldHeight);
            Bitmap bm = null;
            try {
              bm = Bitmap.createScaledBitmap(bitmap, imageWidth, dheight, false);
            } catch (OutOfMemoryError e) {
              e.printStackTrace();
              System.gc();
              MainApplication.getImageLoader().getImageCache().trim();
              try {
                Thread.sleep(10);
              } catch (InterruptedException e1) {
                e1.printStackTrace();
              }

              bm = Bitmap.createScaledBitmap(bitmap, imageWidth, dheight, false);
            }

            iconIv.setImageBitmap(bm);
          }
        });
  }
예제 #2
0
  @Override
  public void onError(ImageContainer container) {
    LogUtils.d(TAG, "onError");
    progressView.post(
        new Runnable() {

          @Override
          public void run() {
            progressView.setVisibility(View.GONE);
          }
        });
  }
예제 #3
0
  @Override
  public void onProgress(final ImageContainer container) {
    LogUtils.d(TAG, "onProgress");
    progressView.post(
        new Runnable() {

          @Override
          public void run() {
            progressView.setMax((int) container.getMax());
            progressView.setProgress((int) container.getProgress());
          }
        });
  }
예제 #4
0
  @Override
  public void onWait(ImageContainer container) {
    LogUtils.d(TAG, "onWait");
    progressView.post(
        new Runnable() {

          @Override
          public void run() {
            progressView.setWaiting(true);
            progressView.setVisibility(View.VISIBLE);
          }
        });
  }
예제 #5
0
  @Override
  public void onStarted(final ImageContainer container) {
    LogUtils.d(TAG, "onStarted");
    progressView.post(
        new Runnable() {

          @Override
          public void run() {
            progressView.setVisibility(View.VISIBLE);
            progressView.setMax((int) container.getMax());
            progressView.setProgress((int) container.getProgress());
          }
        });
  }
예제 #6
0
 @Override
 public void onStart(ImageContainer container) {
   LogUtils.d(TAG, "onStart");
   progressView.setVisibility(View.VISIBLE);
   progressView.setWaiting(false);
 }