Java tutorial
package com.youku.player.module; import android.text.TextUtils; import com.baseproject.utils.Util; import com.youku.player.goplay.Point; import com.youku.player.goplay.Profile; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; /** * ? * * 2013-4-23 14:10:58 * @author LongFan * */ public final class VideoCacheInfo implements Cloneable { /** */ public String title; /** id */ public String videoid; /** ?? */ public int format; /** ?? */ public String language; /** (??) */ public int playTime; /** ? */ public long lastPlayTime; /** id */ public String showid; /** */ public String showname; /** ? */ public int show_videoseq; /** */ public int showepisode_total; /** */ public int seconds; public double progress = 0; public long lastUpdateTime = 0l; /** ? */ public int segCount = 0; /** id */ public int segId = 1; /** ? */ public long segSize = 0l; /** ? */ public String segUrl; /** ?? */ public long[] segsSize; /** ?? */ public String[] segsUrl; /** ? */ public int[] segsSeconds; public String savePath; public String nextVid; public String picUrl; public String episodemode; public String mMediaType; public String registerNum; public String licenseNum; /** * ?? */ public boolean isVerticalVideo = false; /** * */ public boolean exclusiveLogo; /** ? */ public ArrayList<Point> adPointArray = new ArrayList<Point>(); public JSONArray points; /** * profile {@link com.youku.player.goplay.Profile#VIDEO_QUALITY_SD } * {@link com.youku.player.goplay.Profile#VIDEO_QUALITY_HD } * {@link com.youku.player.goplay.Profile#VIDEO_QUALITY_HD2} * {@link com.youku.player.goplay.Profile#VIDEO_QUALITY_HD3} * */ public int quality; public boolean mNeedWaterMark = false; public int mWaterMarkType = -1; public JSONObject toJSONObject() { JSONObject o = new JSONObject(); try { o.put("title", title); o.put("vid", videoid); o.put("showid", showid); o.put("format", format); o.put("show_videoseq", show_videoseq); o.put("showepisode_total", showepisode_total); o.put("seconds", seconds); o.put("url", segUrl); o.put("segcount", segCount); o.put("segsize", segSize); o.put("segsseconds", Util.join(segsSeconds)); o.put("segssize", Util.join(segsSize)); o.put("segstep", segId); o.put("savepath", savePath); o.put("segsUrl", (segsUrl == null || segsUrl.length == 0) ? "" : Util.join((Object[]) segsUrl)); o.put("progress", progress); if (!TextUtils.isEmpty(language)) { o.put("language", language); } if (!TextUtils.isEmpty(showname)) { o.put("showname", showname); } o.put("playTime", playTime); o.put("lastPlayTime", lastPlayTime); if (points != null && points.length() != 0) { o.put("points", points); } } catch (JSONException e) { o = null; } return o; } /** ??true?false? */ public static boolean compareBySeq = true; @Override public String toString() { JSONObject o = toJSONObject(); return o == null ? "" : o.toString(); } /** * ?? * * @return ? */ public synchronized ArrayList<Point> getAdPoints() { if (adPointArray == null) { adPointArray = new ArrayList<Point>(); } else { adPointArray.clear(); } if (points != null && points.length() != 0) { for (int i = 0; i < points.length(); i++) { JSONObject point = points.optJSONObject(i); if (point != null) { Point p = new Point(); p.start = point.optDouble("start") * 1000; p.type = point.optString("type"); p.title = point.optString("title"); p.desc = point.optString("desc"); if (p.type.equals(Profile.STANDARD_POINT) || p.type.equals(Profile.CONTENTAD_POINT)) {// adPointArray.add(p); } } } } return adPointArray; } }