예제 #1
0
  public MsgDetailReadWorker(WeiboDetailImageView view, MessageBean msg) {
    this.view = view;
    this.pb = this.view.getProgressBar();
    this.msg = msg;
    this.retry = view.getRetryButton();
    retry.setVisibility(View.INVISIBLE);

    oriPath =
        FileManager.getFilePathFromUrl(msg.getOriginal_pic(), FileLocationMethod.picture_large);

    if (ImageUtility.isThisBitmapCanRead(oriPath)
        && TaskCache.isThisUrlTaskFinished(msg.getOriginal_pic())) {

      onPostExecute(oriPath);
      cancel(true);
      return;
    }

    middlePath =
        FileManager.getFilePathFromUrl(msg.getBmiddle_pic(), FileLocationMethod.picture_bmiddle);

    if (ImageUtility.isThisBitmapCanRead(middlePath)
        && TaskCache.isThisUrlTaskFinished(msg.getBmiddle_pic())) {
      onPostExecute(middlePath);
      cancel(true);
      return;
    }

    pb.setVisibility(View.VISIBLE);
    pb.setIndeterminate(true);
  }
예제 #2
0
  @Override
  protected void onPostExecute(String path) {
    retry.setVisibility(View.INVISIBLE);
    pb.setIndeterminate(true);

    if (!TextUtils.isEmpty(path)) {

      if (!path.endsWith(".gif")) {
        readNormalPic(path);
      } else {
        view.setGif(path);
      }
      pb.setVisibility(View.INVISIBLE);
      view.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent intent = new Intent(GlobalContext.getInstance(), GalleryActivity.class);
              intent.putExtra("msg", msg);
              GlobalContext.getInstance().getActivity().startActivity(intent);
            }
          });
    } else {
      pb.setVisibility(View.INVISIBLE);
      view.setImageDrawable(new ColorDrawable(Color.TRANSPARENT));
      retry.setVisibility(View.VISIBLE);
      retry.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              MsgDetailReadWorker picTask = new MsgDetailReadWorker(view, msg);
              picTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
            }
          });
    }
  }
예제 #3
0
  private void readNormalPic(String path) {

    Bitmap bitmap = ImageUtility.readNormalPic(path, 2000, 2000);

    view.setTag(true);
    view.getImageView().setTag(true);
    view.setVisibility(View.VISIBLE);
    view.setImageBitmap(bitmap);
    view.setAlpha(0.0f);
    view.animate().alpha(1.0f).setDuration(200);
  }
예제 #4
0
 public void setView(WeiboDetailImageView view) {
   this.view = view;
   this.pb = this.view.getProgressBar();
   this.retry = view.getRetryButton();
   retry.setVisibility(View.INVISIBLE);
 }