|
|
|
|
@ -218,11 +218,15 @@ public class UserFragment extends BaseLazyFragment implements View.OnClickListen |
|
|
|
|
if (Hawk.get(HawkConfig.HOME_REC, 0) == 1) { |
|
|
|
|
if (homeSourceRec != null) { |
|
|
|
|
adapter.setNewData(homeSourceRec); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} else if (Hawk.get(HawkConfig.HOME_REC, 0) == 2) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
setDouBanData(adapter); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setDouBanData(HomeHotVodAdapter adapter) { |
|
|
|
|
try { |
|
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
|
int year = cal.get(Calendar.YEAR); |
|
|
|
|
@ -244,24 +248,24 @@ public class UserFragment extends BaseLazyFragment implements View.OnClickListen |
|
|
|
|
OkGo.<String>get(doubanUrl) |
|
|
|
|
.headers("User-Agent", UA.randomOne()) |
|
|
|
|
.execute(new AbsCallback<String>() { |
|
|
|
|
@Override |
|
|
|
|
public void onSuccess(Response<String> response) { |
|
|
|
|
String netJson = response.body(); |
|
|
|
|
Hawk.put("home_hot_day", today); |
|
|
|
|
Hawk.put("home_hot", netJson); |
|
|
|
|
mActivity.runOnUiThread(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
adapter.setNewData(loadHots(netJson)); |
|
|
|
|
public void onSuccess(Response<String> response) { |
|
|
|
|
String netJson = response.body(); |
|
|
|
|
Hawk.put("home_hot_day", today); |
|
|
|
|
Hawk.put("home_hot", netJson); |
|
|
|
|
mActivity.runOnUiThread(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
adapter.setNewData(loadHots(netJson)); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String convertResponse(okhttp3.Response response) throws Throwable { |
|
|
|
|
return response.body().string(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
@Override |
|
|
|
|
public String convertResponse(okhttp3.Response response) throws Throwable { |
|
|
|
|
return response.body().string(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} catch (Throwable th) { |
|
|
|
|
th.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
@ -278,7 +282,7 @@ public class UserFragment extends BaseLazyFragment implements View.OnClickListen |
|
|
|
|
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=com.douban.frodo"; |
|
|
|
|
vod.pic = obj.get("cover").getAsString()+"@User-Agent="+ UA.randomOne()+"@Referer=https://www.douban.com/"; |
|
|
|
|
result.add(vod); |
|
|
|
|
} |
|
|
|
|
} catch (Throwable th) { |
|
|
|
|
|