Ejemplo n.º 1
0
  /**
   * 获取转发自---微博的text---递归调用
   *
   * @param weiboData
   * @param weiboinfo
   */
  public void getRetweeted(WeiboData weiboData, InfoOfWeibo weiboinfo) {
    if (null != weiboData.getRetweeted_status()) {
      String str = weiboinfo.gettextInfo();
      str =
          str
              + "//@"
              + weiboData.getRetweeted_status().getUser().getName()
              + ":"
              + weiboData.getRetweeted_status().getText();
      weiboinfo.settextInfo(str);
      if (null != weiboData.getThumbnail_pic()) {
        weiboinfo.setImgUrl(weiboData.getThumbnail_pic());
      }

      getRetweeted(weiboData.getRetweeted_status(), weiboinfo);
    }
  }
Ejemplo n.º 2
0
  /**
   * 获每条取微博基本信息,这里因为使用了weiboData,其中的数据解析不方便,所以要将数据放在infoofdata里
   *
   * @param timeline
   * @param weiboinfo
   * @param position
   * @return
   */
  public WeiboData getWeiboData(JSONObject timeline, InfoOfWeibo weiboinfo, int position) {
    try {
      WeiboData weiboData = WeiboData.getWeiboData(timeline.toString(), position);
      weiboinfo.setName(weiboData.getUser().getName());
      weiboinfo.settextInfo(weiboData.getText());
      weiboinfo.setTimestamp(weiboData.getCreated_at());
      weiboinfo.setCapUrlString(weiboData.getUser().getProfile_image_url());
      weiboinfo.setReposts(weiboData.getReposts_count());
      weiboinfo.setComments(weiboData.getComments_count());
      weiboinfo.setAttitudes(weiboData.getAttitudes_count());
      weiboinfo.setSource(weiboData.getSource());
      weiboinfo.setFavorited(weiboData.getFavorited());
      weiboinfo.setId(weiboData.getId());
      weiboinfo.setUserId(weiboData.getUser().getId());

      if (null != weiboData.getThumbnail_pic()) {
        weiboinfo.setImgUrl(weiboData.getBmiddle_pic());
      }
      getRetweeted(weiboData, weiboinfo);
      Log.w(TAG, "WeiboInfo:" + weiboinfo.getName() + ":" + weiboinfo.gettextInfo());
      return weiboData;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }