Exemplo n.º 1
0
  public void uploadReadStatue(NoticeInfo info) {
    Builder builder = new Builder();
    String uploadUrl = "/notices/" + info.getId() + "/isread";
    builder.addQueryParameter("noticeId", String.valueOf(info.getId()));
    builder.setModule(uploadUrl);
    builder.setResponseType(new TypeToken<Response<String>>() {}.getType());
    builder.setResponseListener(
        new Listener<Response<String>>() {
          @Override
          public void onErrorResponse(InvocationError arg0) {}

          @Override
          public void onResponse(Response<String> arg0) {}
        });
    builder.build().put();
  }
Exemplo n.º 2
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;
          }
        });
  }