Ejemplo n.º 1
0
 @Override
 public void onFinish() {
   if (isRefresh && mStatus != null) {
     redirect_bt.setText(mStatus.getRepostsCount() + "");
     comment_bt.setText(mStatus.getCommentsCount() + "");
     if (mStatus.getRetweetedStatus() != null) {
       subRedirectNum.setText(mStatus.getRetweetedStatus().getRepostsCount() + "");
       subCommentNum.setText(mStatus.getRetweetedStatus().getCommentsCount() + "");
     }
   }
 }
Ejemplo n.º 2
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.titlebar_back:
       back();
       break;
     case R.id.titlebar_home:
       backToHome();
       break;
     case R.id.detail_userinfo:
       //				goToUserinfo();
       break;
     case R.id.detail_pic:
       showPic(mStatus);
       break;
     case R.id.detail_subPic:
       showPic(mStatus.getRetweetedStatus());
       break;
     case R.id.detail_subRedirect:
       goToRepostList(mStatus.getRetweetedStatus());
       break;
     case R.id.detail_subComent:
       goToCommentList(Long.parseLong(mStatus.getRetweetedStatus().getId()));
       break;
     case R.id.detail_redirect_bt:
       goToRepostList(mStatus);
       break;
     case R.id.detail_comment_bt:
       goToCommentList(Long.parseLong(mStatus.getId()));
       break;
     case R.id.detail_refresh:
       refresh();
       break;
     case R.id.detail_comment:
       commentWeibo(Long.parseLong(mStatus.getId()));
       break;
     case R.id.detail_redirect:
       redirectWeibo(Long.parseLong(mStatus.getId()), mStatus);
       break;
     case R.id.detail_favorite:
       favWeibo();
       break;
     case R.id.detail_del:
       if (OAuthInfoManager.getInstance().isLogin(WeiboDetail.this)) {
         handler.sendEmptyMessage(1);
       }
       break;
     default:
       break;
   }
 }
Ejemplo n.º 3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.weibo_detail);

    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
      mStatus = (Status) bundle.getSerializable(STATUS);
      if (mStatus != null && mStatus.getRetweetedStatus() != null) {
        isExitSubStatus = true;
      }
    }

    getViews();
    setViews();
    setListeners();
  }
Ejemplo n.º 4
0
  @Override
  public void setViews() {
    titleBack.setVisibility(View.VISIBLE);
    titleName.setVisibility(View.VISIBLE);
    titleHome.setVisibility(View.GONE);
    titleName.setText(R.string.weiboBody);

    if (mStatus != null) {
      User user = mStatus.getUser();
      if (user != null) {
        AsyncImageLoader.getInstance()
            .loadPortrait(
                Long.parseLong(mStatus.getUser().getId()),
                mStatus.getUser().getProfileImageUrl(),
                icon);
        name.setText(user.getScreenName());
        userId = user.getId();
        String selfUserId = OAuthInfoManager.getInstance().getWeiboUserId();
        // 20121112 xujun: for weibo delete
        if (userId.equalsIgnoreCase(selfUserId)) {
          weibodel.setVisibility(View.VISIBLE);
        } else {
          weibodel.setVisibility(View.GONE);
        }
        if (user.isVerified()) {
          v.setVisibility(View.VISIBLE);
        } else {
          v.setVisibility(View.GONE);
        }
      }
      content.setMovementMethod(LinkMovementMethod.getInstance());
      content.setText(TextUtil.formatContent(mStatus.getText(), this));
      time.setText(TimeUtil.getTimeStr(mStatus.getCreatedAt()));
      if (mStatus.getSource() != null) {
        source.setText(getString(R.string.from) + mStatus.getSource().getName());
      }

      // 加载图片
      AsyncImageLoader.getInstance()
          .loadPre(Long.parseLong(mStatus.getId()), mStatus.getBmiddlePic(), pic);
      if (isExitSubStatus) { // 若存在转发、评论的微博
        sub.setVisibility(View.VISIBLE);
        Status subStatus = mStatus.getRetweetedStatus();
        AsyncImageLoader.getInstance()
            .loadPre(Long.parseLong(subStatus.getId()), subStatus.getBmiddlePic(), subPic);
        String sContent = "";
        if (subStatus.getUser() != null) {
          sContent = "@" + subStatus.getUser().getScreenName() + ":" + subStatus.getText();
        } else {
          sContent = subStatus.getText();
        }
        subContent.setMovementMethod(LinkMovementMethod.getInstance());
        subContent.setText(TextUtil.formatContent(sContent, this));
      } else {
        sub.setVisibility(View.GONE);
      }

      // 更新微博及转发微博的转发数、评论数
      new AsyncDataLoader(countCallback).execute();
    }
  }