예제 #1
0
 /** 转入用户信息界面 */
 private void goToUserinfo() {
   if (OAuthInfoManager.getInstance().isLogin(WeiboDetail.this)) {
     if (mStatus != null && mStatus.getUser() != null) {
       Sina.getInstance().goToUserInfo(this, Long.parseLong(mStatus.getUser().getId()));
     }
   }
 }
예제 #2
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() + "");
     }
   }
 }
예제 #3
0
 /** 收藏微博 */
 private void favWeibo() {
   if (OAuthInfoManager.getInstance().isLogin(WeiboDetail.this)) {
     try {
       Sina.getInstance().getWeibo().createFavorite(Long.parseLong(mStatus.getId()));
       WeiboToast.show(this, "加入收藏");
     } catch (WeiboException e) {
       e.printStackTrace();
       WeiboToast.show(this, "收藏失败");
     }
   }
 }
예제 #4
0
 @Override
 public void onStart() {
   try {
     if (mStatus != null && OAuthInfoManager.getInstance().tokenIsReady()) {
       mStatus = Sina.getInstance().getWeibo().getOneUserTimeline(mStatus.getId());
       isRefresh = true;
     }
   } catch (WeiboException e1) {
     e1.printStackTrace();
   }
 }
예제 #5
0
 /** xujun 20121117: weibo delete */
 private void delWeibo() {
   try {
     Sina.getInstance().getWeibo().destroyStatus(mStatus.getId());
     Intent i = new Intent();
     i.putExtra(DELFLAG, true);
     setResult(RESULT_OK, i);
     finish();
     WeiboToast.show(
         getApplicationContext(), WeiboDetail.this.getString(R.string.weibo_del_success));
   } catch (WeiboException e) {
     Log(e.getMessage());
     WeiboToast.show(getApplicationContext(), WeiboDetail.this.getString(R.string.weibo_del_fail));
   }
 }
예제 #6
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();
  }
예제 #7
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;
   }
 }
예제 #8
0
 /** xujun 20120908 显示图片 */
 private void showPic(Status status) {
   if (status == null) return;
   String url = "";
   String picType = "";
   if (status.getOriginalPic() != null) {
     url = status.getOriginalPic();
     picType = "ori";
     Log("showPic ori");
   } else if (status.getBmiddlePic() != null) {
     url = status.getBmiddlePic();
     picType = "mid";
     Log("showPic mid");
   } else if (status.getThumbnailPic() != null) {
     url = status.getThumbnailPic();
     picType = "thumb";
     Log("showPic thumb");
   } else {
     Log("no pic url");
     return;
   }
   Sina.getInstance()
       .showImageViewZoom(WeiboDetail.this, Long.parseLong(status.getId()), url, picType);
 }
예제 #9
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();
    }
  }