Пример #1
0
  /**
   * @param content
   * @return 在线教学视频
   */
  @SuppressLint("NewApi")
  public static List<VideoBean> parse_LinVideos(String content) {
    List<VideoBean> dates = new ArrayList<VideoBean>();
    try {
      JSONObject jsonobject = new JSONObject(content);
      JSONArray ja = new JSONArray(jsonobject.getString("data"));
      for (int i = 0; i < ja.length(); i++) {

        VideoBean vipRoomBean = new VideoBean();
        JSONArray jsonArray = new JSONArray(ja.getJSONObject(i).getString("onlineTeachLikedlist"));
        if (jsonArray.length() > 0) {
          for (int j = 0; j < jsonArray.length(); j++) {

            JSONObject jsonObject3 = jsonArray.getJSONObject(j);
            vipRoomBean.newidentityId = jsonObject3.getLong("identityId");
          }
        }
        JSONObject jsonobject2 = ja.getJSONObject(i).getJSONObject("identityBase");
        vipRoomBean.identityTitle = jsonobject2.getString("identityTitle");
        vipRoomBean.myLogo = jsonobject2.getString("myLogo");
        vipRoomBean.aboutMe = jsonobject2.getString("aboutMe");
        vipRoomBean.verified = jsonobject2.getInt("verified");
        vipRoomBean.isDefault = jsonobject2.getBoolean("isDefault");
        vipRoomBean.userId = jsonobject2.getInt("userId");
        vipRoomBean.identityId = jsonobject2.getLong("identityId");
        vipRoomBean.followingNum = jsonobject2.getInt("followingNum");
        vipRoomBean.followedNum = jsonobject2.getInt("followedNum");
        vipRoomBean.speakCount = jsonobject2.getInt("speakCount");
        vipRoomBean.autoFollowing = jsonobject2.getInt("autoFollowing");
        vipRoomBean.autoFollowed = jsonobject2.getInt("autoFollowed");
        vipRoomBean.displayName = jsonobject2.getString("displayName");
        vipRoomBean.viewCount = jsonobject2.getInt("viewCount");

        JSONObject jsonobject3 = ja.getJSONObject(i).getJSONObject("onlineTeachSpeak");
        vipRoomBean.commentCount = jsonobject3.getInt("commentCount");
        vipRoomBean.realAudioUrl = jsonobject3.getString("realAudioUrl");
        vipRoomBean.realPicUrl = jsonobject3.getString("realPicUrl");
        vipRoomBean.speakId = jsonobject3.getInt("speakId");
        vipRoomBean.likeNum = jsonobject3.getInt("likeNum");
        vipRoomBean.createTime = jsonobject3.getLong("createTime");
        vipRoomBean.content = jsonobject3.getString("content");
        dates.add(vipRoomBean);
      }
      return dates;
    } catch (JSONException e) {
      e.printStackTrace();
    }
    return dates;
  }
Пример #2
0
  /**
   * @param content
   * @return 评论
   */
  public static List<VideoBean> parse_pinlun(String content) {

    List<VideoBean> dates = new ArrayList<VideoBean>();
    try {
      JSONObject jsonobject = new JSONObject(content);
      JSONArray ja = new JSONArray(jsonobject.getString("data"));

      for (int i = 0; i < ja.length(); i++) {
        VideoBean vipRoomBean = new VideoBean();

        JSONObject jsonobject2 = ja.getJSONObject(i).getJSONObject("identityBase");
        vipRoomBean.identityTitle = jsonobject2.getString("identityTitle");
        vipRoomBean.myLogo = jsonobject2.optString("myLogo");
        vipRoomBean.aboutMe = jsonobject2.optString("aboutMe");
        vipRoomBean.verified = jsonobject2.optInt("verified");
        vipRoomBean.isDefault = jsonobject2.optBoolean("isDefault");
        vipRoomBean.userId = jsonobject2.optInt("userId");

        vipRoomBean.identityId = jsonobject2.optLong("identityId");
        vipRoomBean.followingNum = jsonobject2.optInt("followingNum");
        vipRoomBean.followedNum = jsonobject2.optInt("followedNum");
        vipRoomBean.speakCount = jsonobject2.optInt("speakCount");
        vipRoomBean.autoFollowing = jsonobject2.optInt("autoFollowing");
        vipRoomBean.autoFollowed = jsonobject2.optInt("autoFollowed");
        vipRoomBean.displayName = jsonobject2.optString("displayName");
        vipRoomBean.viewCount = jsonobject2.optInt("viewCount");

        JSONObject jsonobject3 = ja.getJSONObject(i).getJSONObject("onlineTeachComment");
        vipRoomBean.speakId = jsonobject3.optInt("speakId");
        vipRoomBean.commentId = jsonobject3.optInt("commentId");
        vipRoomBean.createTime = jsonobject3.optLong("createTime");
        vipRoomBean.content = jsonobject3.optString("content");
        vipRoomBean.annotations = jsonobject3.optString("annotations");
        vipRoomBean.audioId = jsonobject3.optString("audioUrl");

        dates.add(vipRoomBean);
      }
      return dates;
    } catch (JSONException e) {
      e.printStackTrace();
    }
    return dates;
  }