Add star
This commit is contained in:
parent
453257c53c
commit
d79f838fb0
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.github.catvod.bean.star;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.github.catvod.bean.Vod;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Card {
|
||||||
|
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
@SerializedName("img")
|
||||||
|
private String img;
|
||||||
|
@SerializedName("id")
|
||||||
|
private String id;
|
||||||
|
@SerializedName("countStr")
|
||||||
|
private String countStr;
|
||||||
|
@SerializedName("url")
|
||||||
|
private String url;
|
||||||
|
@SerializedName("cards")
|
||||||
|
private List<Card> cards;
|
||||||
|
|
||||||
|
public static List<Card> arrayFrom(String str) {
|
||||||
|
Type listType = new TypeToken<List<Card>>() {}.getType();
|
||||||
|
return new Gson().fromJson(str, listType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return TextUtils.isEmpty(name) ? "" : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImg() {
|
||||||
|
return TextUtils.isEmpty(img) ? "" : img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return TextUtils.isEmpty(id) ? "" : id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountStr() {
|
||||||
|
return TextUtils.isEmpty(countStr) ? "" : countStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return TextUtils.isEmpty(url) ? "" : url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Card> getCards() {
|
||||||
|
return cards == null ? Collections.emptyList() : cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vod vod() {
|
||||||
|
return new Vod(getId(), getName(), getImg(), getCountStr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.github.catvod.bean.star;
|
||||||
|
|
||||||
|
import com.github.catvod.bean.Filter;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Condition {
|
||||||
|
|
||||||
|
@SerializedName("label")
|
||||||
|
private List<List<String>> label;
|
||||||
|
@SerializedName("country")
|
||||||
|
private List<String> country;
|
||||||
|
@SerializedName("time")
|
||||||
|
private List<Integer> time;
|
||||||
|
|
||||||
|
public static Condition objectFrom(String str) {
|
||||||
|
return new Gson().fromJson(str, Condition.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<List<String>> getLabel() {
|
||||||
|
return label == null ? Collections.emptyList() : label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getCountry() {
|
||||||
|
return country == null ? Collections.emptyList() : country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getTime() {
|
||||||
|
return time == null ? Collections.emptyList() : time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Filter> getFilter() {
|
||||||
|
List<Filter> filters = new ArrayList<>();
|
||||||
|
filters.add(new Filter("type", "類型", getTypeValues()));
|
||||||
|
filters.add(new Filter("area", "地區", getAreaValues()));
|
||||||
|
filters.add(new Filter("year", "年份", getYearValues()));
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Filter.Value> getTypeValues() {
|
||||||
|
List<Filter.Value> values = new ArrayList<>();
|
||||||
|
values.add(new Filter.Value("全部", ""));
|
||||||
|
for (List<String> list : getLabel()) values.add(new Filter.Value(list.get(0)));
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Filter.Value> getAreaValues() {
|
||||||
|
List<Filter.Value> values = new ArrayList<>();
|
||||||
|
values.add(new Filter.Value("全部", ""));
|
||||||
|
for (String text : getCountry()) values.add(new Filter.Value(text));
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Filter.Value> getYearValues() {
|
||||||
|
List<Filter.Value> values = new ArrayList<>();
|
||||||
|
values.add(new Filter.Value("全部", ""));
|
||||||
|
Collections.sort(getTime(), Collections.reverseOrder());
|
||||||
|
for (Integer year : getTime()) if (year >= 2000) values.add(new Filter.Value(String.valueOf(year)));
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
package com.github.catvod.bean.star;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Detail {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
private Integer id;
|
||||||
|
@SerializedName("videos")
|
||||||
|
private List<Video> videos;
|
||||||
|
@SerializedName("actor")
|
||||||
|
private String actor;
|
||||||
|
@SerializedName("country")
|
||||||
|
private String country;
|
||||||
|
@SerializedName("desc")
|
||||||
|
private String desc;
|
||||||
|
@SerializedName("label")
|
||||||
|
private String label;
|
||||||
|
@SerializedName("director")
|
||||||
|
private String director;
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
@SerializedName("picurl")
|
||||||
|
private String picurl;
|
||||||
|
@SerializedName("time")
|
||||||
|
private String time;
|
||||||
|
@SerializedName("countStr")
|
||||||
|
private String countStr;
|
||||||
|
|
||||||
|
public static Detail objectFrom(String str) {
|
||||||
|
return new Gson().fromJson(str, Detail.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Video> getVideos() {
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActor() {
|
||||||
|
return actor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDirector() {
|
||||||
|
return director;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPicurl() {
|
||||||
|
return picurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountStr() {
|
||||||
|
return countStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Video {
|
||||||
|
|
||||||
|
@SerializedName("eporder")
|
||||||
|
private Integer eporder;
|
||||||
|
@SerializedName("purl")
|
||||||
|
private String purl;
|
||||||
|
|
||||||
|
public Integer getEporder() {
|
||||||
|
return eporder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPurl() {
|
||||||
|
return purl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.github.catvod.bean.star;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class Query {
|
||||||
|
|
||||||
|
@SerializedName("country")
|
||||||
|
private String country;
|
||||||
|
@SerializedName("label")
|
||||||
|
private String label;
|
||||||
|
@SerializedName("chName")
|
||||||
|
private String chName;
|
||||||
|
@SerializedName("startTime")
|
||||||
|
private Integer startTime;
|
||||||
|
@SerializedName("endTime")
|
||||||
|
private Integer endTime;
|
||||||
|
@SerializedName("pageSize")
|
||||||
|
private Integer pageSize;
|
||||||
|
@SerializedName("page")
|
||||||
|
private Integer page;
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChName(String chName) {
|
||||||
|
this.chName = chName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(Integer startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(Integer endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPageSize(Integer pageSize) {
|
||||||
|
this.pageSize = pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPage(Integer page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getStart(String year) {
|
||||||
|
return 1900 + (year.contains("年代") ? Integer.parseInt(year.split("年代")[0]) : 70);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYear(String year) {
|
||||||
|
if (year.contains("更早") || year.contains("年代")) {
|
||||||
|
int start = getStart(year);
|
||||||
|
setStartTime(start);
|
||||||
|
setEndTime(start + 9);
|
||||||
|
} else if (year.contains("年")) {
|
||||||
|
setStartTime(Integer.parseInt(year.replace("年", "")));
|
||||||
|
setEndTime(Integer.parseInt(year.replace("年", "")));
|
||||||
|
} else if (year.contains("-")) {
|
||||||
|
setStartTime(Integer.parseInt(year.split("-")[1]));
|
||||||
|
setEndTime(Integer.parseInt(year.split("-")[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new Gson().toJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue