コード例 #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
  private void initView() {
    getTitleFragment();

    info = getIntent().getParcelableExtra("notice_info");
    if (info != null) {
      if (info.getIsRead() == 0) {
        info.setIsRead(1);
        uploadReadStatue(info);
      }
    }
    TextView timeTv = (TextView) findViewById(R.id.time);
    final TextView titleTv = (TextView) findViewById(R.id.title);
    final TextView contentTv = (TextView) findViewById(R.id.detail_content);
    TextView fromUserTv = (TextView) findViewById(R.id.from_user);
    iconIv = (ImageView) findViewById(R.id.icon);
    progressView = (ProgressView) findViewById(R.id.progressView);
    progressView.setVisibility(View.GONE);
    if (!TextUtils.isEmpty(info.getImage())) {
      // AsyncRequest.getBitmap(info.getImage(), new Listener<Bitmap>() {
      //
      // @Override
      // public void onResponse(Bitmap arg0) {
      // int oldWidth = arg0.getWidth();
      // int oldHeight = arg0.getHeight();
      // float f = ((float)width)/oldWidth;
      // int dheight = (int)(f*oldHeight);
      // Bitmap bm = Bitmap.createScaledBitmap(arg0, width, dheight,
      // false);
      // iconIv.setImageBitmap(bm);
      // }
      //
      // @Override
      // public void onErrorResponse(InvocationError arg0) {
      //
      // }
      // });

      MainApplication.getImageLoader().get(info.getImage(), imageWidth, 1, this, false);
    } else {
      iconIv.setVisibility(View.GONE);
    }
    String time = info.getCreateTime();
    try {
      Date date = BusinessConstants.parseTime(info.getCreateTime());
      SimpleDateFormat formart = new SimpleDateFormat("yy-MM-dd HH:mm");
      time = formart.format(date);
    } catch (ParseException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    timeTv.setText(time);
    titleTv.setText(info.getTitle());
    contentTv.setText(info.getContent());
    fromUserTv.setText(info.getFromUser());
    iconIv.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            if (!TextUtils.isEmpty(info.getImage())) {
              String[] url = info.getImage().split(",");
              ImageBrowser.launch(NotificationDetailActivity.this, url, 0);

              /*记录操作 0903*/
              OperaEventUtils.recordOperation(OperaEvent.OPERA_WATCH_NOTIFICATION_BIGIMAGE);
            }
          }
        });
    titleTv.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            CopyPopupWindow copyWindow = new CopyPopupWindow(NotificationDetailActivity.this);
            copyWindow.showAsDropDown(v, 0, dp2px(-5));
            copyWindow.setOnCopyListener(
                new CopyPopupWindow.OnCopyClickListener() {
                  @Override
                  public void onCopyClick() {
                    ClipboardUtils.copyToClipboard(titleTv.getText().toString());
                  }
                });
            return true;
          }
        });
    contentTv.setOnLongClickListener(
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            CopyPopupWindow copyWindow = new CopyPopupWindow(NotificationDetailActivity.this);
            copyWindow.showAsDropDown(v, 0, dp2px(-20));
            copyWindow.setOnCopyListener(
                new CopyPopupWindow.OnCopyClickListener() {
                  @Override
                  public void onCopyClick() {
                    ClipboardUtils.copyToClipboard(contentTv.getText().toString());
                  }
                });
            return true;
          }
        });
  }
コード例 #7
0
 @Override
 public void onStart(ImageContainer container) {
   LogUtils.d(TAG, "onStart");
   progressView.setVisibility(View.VISIBLE);
   progressView.setWaiting(false);
 }