|
|
|
|
@ -74,7 +74,9 @@ public class UserFragment extends BaseLazyFragment implements View.OnClickListen |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public UserFragment setArguments(List<Movie.Video> recVod) { |
|
|
|
|
this.homeSourceRec = recVod; |
|
|
|
|
if(recVod!=null){ |
|
|
|
|
this.homeSourceRec = recVod.subList(0, Math.min(20, recVod.size())); |
|
|
|
|
} |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -91,7 +93,7 @@ public class UserFragment extends BaseLazyFragment implements View.OnClickListen |
|
|
|
|
} |
|
|
|
|
super.onFragmentResume(); |
|
|
|
|
if (Hawk.get(HawkConfig.HOME_REC, 0) == 2) { |
|
|
|
|
List<VodInfo> allVodRecord = RoomDataManger.getAllVodRecord(30); |
|
|
|
|
List<VodInfo> allVodRecord = RoomDataManger.getAllVodRecord(20); |
|
|
|
|
List<Movie.Video> vodList = new ArrayList<>(); |
|
|
|
|
for (VodInfo vodInfo : allVodRecord) { |
|
|
|
|
Movie.Video vod = new Movie.Video(); |
|
|
|
|
@ -295,13 +297,18 @@ public class UserFragment extends BaseLazyFragment implements View.OnClickListen |
|
|
|
|
try { |
|
|
|
|
JsonObject infoJson = new Gson().fromJson(json, JsonObject.class); |
|
|
|
|
JsonArray array = infoJson.getAsJsonArray("data"); |
|
|
|
|
for (JsonElement ele : array) { |
|
|
|
|
JsonObject obj = (JsonObject) ele; |
|
|
|
|
int limit = Math.min(array.size(), 20); |
|
|
|
|
for (int i = 0; i < limit; i++) { // 改用索引循环
|
|
|
|
|
JsonElement ele = array.get(i); |
|
|
|
|
JsonObject obj = ele.getAsJsonObject(); |
|
|
|
|
Movie.Video vod = new Movie.Video(); |
|
|
|
|
vod.name = obj.get("title").getAsString(); |
|
|
|
|
vod.note = obj.get("rate").getAsString(); |
|
|
|
|
if(!vod.note.isEmpty())vod.note+=" 分"; |
|
|
|
|
vod.pic = obj.get("cover").getAsString()+"@User-Agent="+ UA.randomOne()+"@Referer=https://www.douban.com/"; |
|
|
|
|
if (!vod.note.isEmpty()) vod.note += " 分"; |
|
|
|
|
vod.pic = obj.get("cover").getAsString() |
|
|
|
|
+ "@User-Agent=" + UA.randomOne() |
|
|
|
|
+ "@Referer=https://www.douban.com/"; |
|
|
|
|
|
|
|
|
|
result.add(vod); |
|
|
|
|
} |
|
|
|
|
} catch (Throwable th) { |
|
|
|
|
|