url添加Timestamp逻辑修改
This commit is contained in:
@ -180,7 +180,11 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
|
||||
// 打开下载按钮事件
|
||||
public void onEventMainThread(EBReuse reuse) {
|
||||
if ("Refresh".equals(reuse.getType())) {
|
||||
view.findViewById(R.id.actionbar_rl_download).setVisibility(View.VISIBLE);
|
||||
if (Config.isShow(getActivity())) {
|
||||
view.findViewById(R.id.actionbar_rl_download).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.findViewById(R.id.actionbar_rl_download).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.volley.extended.JsonArrayExtendedRequest;
|
||||
@ -269,8 +268,7 @@ public class PlatformUtils {
|
||||
}
|
||||
isUpdate = true;
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(Config.HOST + "v1d45/support/setting/platform",
|
||||
Constants.PLATFORM_CD),
|
||||
Config.HOST + "v1d45/support/setting/platform",
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
import android.support.v4.util.ArrayMap;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -11,57 +13,21 @@ public class TimestampUtils {
|
||||
// 基准时间
|
||||
private static final long BASE = 1426608000000L;
|
||||
|
||||
private static ArrayMap<String, Integer> map;
|
||||
private static ArrayMap<String, Integer> intervalMap; // 间隔
|
||||
private static ArrayMap<String, Integer> cdMap; // cd
|
||||
|
||||
/*
|
||||
* 根据CD获取时间戳
|
||||
*/
|
||||
public static long getTimestamp(String url, int cd) {
|
||||
if (map == null){
|
||||
map = new ArrayMap<>();
|
||||
map.put("^" + Config.HOST + "v2/version" + "$", 5);
|
||||
map.put("^" + Config.HOST + "v2/disclaimer" + "$", 10);
|
||||
map.put("^" + Config.HOST + "v2/stat/download" + "$", 15);
|
||||
map.put("^" + Config.HOST + "v2/version\\?version_name=.+\\&channel=.+" + "$", 20);
|
||||
map.put("^" + Config.HOST + "v1d45/news\\?type_group=.+\\&offset=.+\\&limit=20" + "$", 25);
|
||||
map.put("^" + Config.HOST + "v1d45/news/.+/digest" + "$", 30);
|
||||
map.put("^" + Config.HOST + "v1d45/news/.+/detail" + "$", 35);
|
||||
map.put("^" + Config.HOST + "v1d45/news/.+/suggestion" + "$", 40);
|
||||
map.put("^" + Config.HOST + "v1d45/game/remenkapai" + "$", 45);
|
||||
map.put("^" + Config.HOST + "v1d45/game/.+/news\\?limit=3" + "$", 50);
|
||||
map.put("^" + Config.HOST + "v1d45/game/.+/news\\?limit=20\\&offset=.+" + "$", 55);
|
||||
map.put("^" + Config.HOST + "v1d45/game/.+/news\\?limit=20\\&offset=.+\\&type=.+" + "$", 60);
|
||||
map.put("^" + Config.HOST + "v1d45/search/game/default" + "$", 65);
|
||||
map.put("^" + Config.HOST + "v1d45/search/game\\?keyword=.+" + "$", 70);
|
||||
map.put("^" + Config.HOST + "v1d45/search/news\\?game_id=.+\\&keyword=.+\\&page=.+\\&limit=20" + "$", 75);
|
||||
map.put("^" + Config.HOST + "v1d45/support/setting/ui" + "$", 80);
|
||||
map.put("^" + Config.HOST + "v1d45/support/setting/platform" + "$", 85);
|
||||
map.put("^" + Config.HOST + "v1d45/support/package/.+/game/digest" + "$", 90);
|
||||
map.put("^" + Config.HOST + "v1d45/support/package/unused\\?skip=.+" + "$", 95);
|
||||
map.put("^" + Config.HOST + "v1d45/support/package/update\\?package=.+" + "$", 100);
|
||||
map.put("^" + Config.HOST + "v1d45/support/package/latest\\?package=.+" + "$", 105);
|
||||
map.put("^" + Config.HOST + "v1d45/support/setting/download/.+/switch2\\?version=.+" + "$", 110);
|
||||
map.put("^" + Config.HOST + "v1d46/support/suggestion" + "$", 115);
|
||||
map.put("^" + Config.HOST + "v1d50/index/slides" + "$", 120);
|
||||
map.put("^" + Config.HOST + "v1d50/game/chajian" + "$", 125);
|
||||
map.put("^" + Config.HOST + "v1d50/game/tuijian" + "$", 130);
|
||||
map.put("^" + Config.HOST + "v1d50/game/column/.+\\?page=.+" + "$", 135);
|
||||
map.put("^" + Config.HOST + "v1d50/game/danjiyouxi\\?limit=20\\&offset=.+" + "$", 140);
|
||||
map.put("^" + Config.HOST + "v1d50/news/zixun\\?limit=10\\&offset=.+" + "$", 145);
|
||||
map.put("^" + Config.HOST + "v1d50/news/yuanchuang\\?limit=10\\&offset=.+" + "$", 150);
|
||||
map.put("^" + Config.HOST + "v2d0/game/.+/digest" + "$", 155);
|
||||
map.put("^" + Config.HOST + "v2d0/game/.+/detail" + "$", 160);
|
||||
map.put("^" + Config.HOST + "v2d0/game/.+/news_digest" + "$", 165);
|
||||
map.put("^" + Config.HOST + "v2d0/zixun/guanzhu\\?key=.+\\&limit=10\\&offset=.+" + "$", 170);
|
||||
map.put("^" + Config.HOST + "v2d0/zixun/guanzhu\\?game_id=.+\\&limit=10\\&offset=.+" + "$", 175);
|
||||
map.put("^" + Config.HOST + "v2d0/device/.+/concern" + "$", 180);
|
||||
map.put("^" + Config.HOST + "v2d0/device/.+/concern/.+" + "$", 185);
|
||||
if (intervalMap == null) {
|
||||
initIntervalMap();
|
||||
}
|
||||
long base = BASE;
|
||||
for (String key : map.keySet()){
|
||||
for (String key : intervalMap.keySet()){
|
||||
if (Pattern.matches(key, url)) {
|
||||
Utils.log("url add base = " + url);
|
||||
base += map.get(key);
|
||||
base += intervalMap.get(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -70,10 +36,96 @@ public class TimestampUtils {
|
||||
return (long) (Math.ceil((now - base) / cd) * cd + base);
|
||||
}
|
||||
|
||||
private static void initCDMap() {
|
||||
cdMap = new ArrayMap<>();
|
||||
cdMap.put("^" + Config.HOST + "v1d50/index/slides" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d50/game/chajian" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d50/game/tuijian" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/game/.+/detail" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/game/.+/digest" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/game/remenkapai" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/game/.+/news_digest" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d50/game/column/.+\\?page=.+" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/support/package/.+/game/digest" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d50/game/danjiyouxi\\?limit=20\\&offset=.+" + "$", Constants.GAME_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/news/.+/digest" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/news/.+/detail" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/news/.+/suggestion" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/game/.+/news\\?limit=3" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d50/news/zixun\\?limit=10\\&offset=.+" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/game/.+/news\\?limit=20\\&offset=.+" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d50/news/yuanchuang\\?limit=10\\&offset=.+" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/news\\?type_group=.+\\&offset=.+\\&limit=20" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/zixun/guanzhu\\?key=.+\\&limit=10\\&offset=.+" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/game/.+/news\\?limit=20\\&offset=.+\\&type=.+" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/zixun/guanzhu\\?game_id=.+\\&limit=10\\&offset=.+" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/search/news\\?game_id=.+\\&keyword=.+\\&page=.+\\&limit=20" + "$", Constants.NEWS_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/search/game\\?keyword=.+" + "$", Constants.SEARCH_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/support/setting/platform" + "$", Constants.PLATFORM_CD);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/support/package/update\\?package=.+" + "$", Constants.UPDATE_CD);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/device/.+/concern" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/device/.+/concern/.+" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v2/stat/download" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v2/disclaimer" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/search/game/default" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/support/upgrade\\?version=.+\\&channel=.+" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/support/time/current" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/support/setting/ui" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v2d0/support/download_status\\?version=.+\\&channel=.+" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v1d46/support/suggestion" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v2/game/.+/serverInfo" + "$", 0);
|
||||
cdMap.put("^" + Config.HOST + "v1d45/support/package/unused\\?skip=.+" + "$", 0);
|
||||
}
|
||||
|
||||
private static void initIntervalMap() {
|
||||
intervalMap = new ArrayMap<>();
|
||||
intervalMap.put("^" + Config.HOST + "v1d50/index/slides" + "$", 5);
|
||||
intervalMap.put("^" + Config.HOST + "v1d50/game/chajian" + "$", 10);
|
||||
intervalMap.put("^" + Config.HOST + "v1d50/game/tuijian" + "$", 15);
|
||||
intervalMap.put("^" + Config.HOST + "v2d0/game/.+/detail" + "$", 20);
|
||||
intervalMap.put("^" + Config.HOST + "v2d0/game/.+/digest" + "$", 25);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/game/remenkapai" + "$", 30);
|
||||
intervalMap.put("^" + Config.HOST + "v2d0/game/.+/news_digest" + "$", 35);
|
||||
intervalMap.put("^" + Config.HOST + "v1d50/game/column/.+\\?page=.+" + "$", 40);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/support/package/.+/game/digest" + "$", 45);
|
||||
intervalMap.put("^" + Config.HOST + "v1d50/game/danjiyouxi\\?limit=20\\&offset=.+" + "$", 50);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/news/.+/digest" + "$", 55);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/news/.+/detail" + "$", 60);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/news/.+/suggestion" + "$", 65);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/game/.+/news\\?limit=3" + "$", 70);
|
||||
intervalMap.put("^" + Config.HOST + "v1d50/news/zixun\\?limit=10\\&offset=.+" + "$", 75);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/game/.+/news\\?limit=20\\&offset=.+" + "$", 80);
|
||||
intervalMap.put("^" + Config.HOST + "v1d50/news/yuanchuang\\?limit=10\\&offset=.+" + "$", 85);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/news\\?type_group=.+\\&offset=.+\\&limit=20" + "$", 90);
|
||||
intervalMap.put("^" + Config.HOST + "v2d0/zixun/guanzhu\\?key=.+\\&limit=10\\&offset=.+" + "$", 95);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/game/.+/news\\?limit=20\\&offset=.+\\&type=.+" + "$", 100);
|
||||
intervalMap.put("^" + Config.HOST + "v2d0/zixun/guanzhu\\?game_id=.+\\&limit=10\\&offset=.+" + "$", 105);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/search/news\\?game_id=.+\\&keyword=.+\\&page=.+\\&limit=20" + "$", 110);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/search/game\\?keyword=.+" + "$", 115);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/support/setting/platform" + "$", 120);
|
||||
intervalMap.put("^" + Config.HOST + "v1d45/support/package/update\\?package=.+" + "$", 125);
|
||||
}
|
||||
|
||||
/*
|
||||
* 为url添加timestamp
|
||||
*/
|
||||
public static String addTimestamp(String url, int cd) {
|
||||
public static String addTimestamp(String url) {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return url;
|
||||
}
|
||||
if (cdMap == null) {
|
||||
initCDMap();
|
||||
}
|
||||
int cd = 0;
|
||||
for (String key : cdMap.keySet()){
|
||||
if (Pattern.matches(key, url)) {
|
||||
cd = cdMap.get(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cd == 0) {
|
||||
return url;
|
||||
}
|
||||
if (url.contains("?")) {
|
||||
String u = url + "×tamp=" + getTimestamp(url, cd);
|
||||
Utils.log("url = " + u);
|
||||
@ -84,7 +136,7 @@ public class TimestampUtils {
|
||||
return u;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 去除url中的timestamp
|
||||
*/
|
||||
|
||||
@ -41,9 +41,9 @@ public class DataChanger extends Observable {
|
||||
if (entry != null) {
|
||||
if (getDownloadEntries().get(entry.getUrl()) != null) {
|
||||
getDownloadEntries().put(entry.getUrl(), entry);
|
||||
setChanged();
|
||||
notifyObservers(entry);
|
||||
}
|
||||
setChanged();
|
||||
notifyObservers(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +190,10 @@ public class DownloadManager {
|
||||
if (downloadEntity != null) {
|
||||
String url = downloadEntity.getUrl();
|
||||
checkDownloadEntryRecordValidate(url);
|
||||
if (!isFileCompleted(url) && !isTaskDownloading(url)) {
|
||||
if (isFileCompleted(url)) {
|
||||
downloadEntity.setStatus(DownloadStatus.done);
|
||||
DataChanger.getInstance().notifyDataChanged(downloadEntity);
|
||||
} else if (!isTaskDownloading(url)) {
|
||||
context.startService(getIntent(downloadEntity, DownloadStatus.add));
|
||||
}
|
||||
}
|
||||
@ -263,7 +266,10 @@ public class DownloadManager {
|
||||
add(entry);
|
||||
} else {
|
||||
if (entry != null) {
|
||||
if (!isFileCompleted(url) && !isTaskDownloading(url)) {
|
||||
if (isFileCompleted(url)) {
|
||||
entry.setStatus(DownloadStatus.done);
|
||||
DataChanger.getInstance().notifyDataChanged(entry);
|
||||
} else if (!isTaskDownloading(url)) {
|
||||
context.startService(getIntent(entry, DownloadStatus.resume));
|
||||
}
|
||||
}
|
||||
@ -290,6 +296,7 @@ public class DownloadManager {
|
||||
Utils.log(DownloadManager.class.getSimpleName(), "cancle==>file and record were deleted!");
|
||||
}
|
||||
if (entry != null) {
|
||||
entry.setStatus(DownloadStatus.cancel);
|
||||
context.startService(getIntent(entry, DownloadStatus.cancel));
|
||||
Utils.log(DownloadManager.class.getSimpleName(), "cancel");
|
||||
}
|
||||
|
||||
@ -10,9 +10,7 @@ import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.base.DetailActivity;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.eventbus.EBConcernChanged;
|
||||
import com.gh.gamecenter.gamedetail.GameDetailAdapter;
|
||||
@ -138,9 +136,8 @@ public class GameDetailActivity extends DetailActivity implements View.OnClickLi
|
||||
|
||||
// 获取游戏摘要
|
||||
private void getGameDigest() {
|
||||
String url = TimestampUtils.addTimestamp(Config.HOST + "v2d0/game/" + gameId + "/digest",
|
||||
Constants.GAME_CD);
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(url,
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
|
||||
Config.HOST + "v2d0/game/" + gameId + "/digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
|
||||
@ -37,7 +37,6 @@ import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.base.BaseFragmentActivity;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DeviceUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
@ -49,7 +48,6 @@ import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.RandomUtils;
|
||||
import com.gh.common.util.RunningUtils;
|
||||
import com.gh.common.util.SpeedUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.TokenUtils;
|
||||
import com.gh.common.util.TrafficUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
@ -768,8 +766,7 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
count = 0;
|
||||
for (ConcernInfo info : infos) {
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
|
||||
TimestampUtils.addTimestamp(Config.HOST + "v2d0/game/" + info.getId() + "/digest",
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v2d0/game/" + info.getId() + "/digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
@ -1005,8 +1002,8 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
};
|
||||
|
||||
private void getSearchHints() {
|
||||
final String url = Config.HOST + "v1d45/search/game/default";
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(url,
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
Config.HOST + "v1d45/search/game/default",
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -21,10 +21,8 @@ import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.base.DetailActivity;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.NewsEntity;
|
||||
import com.gh.gamecenter.eventbus.EBConcernChanged;
|
||||
@ -222,8 +220,7 @@ public class NewsDetailActivity extends DetailActivity implements OnClickListene
|
||||
|
||||
private void getNewsDigest(final String news_id) {
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d45/news/" + news_id + "/digest", Constants.NEWS_CD),
|
||||
Config.HOST + "v1d45/news/" + news_id + "/digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
@ -324,9 +321,7 @@ public class NewsDetailActivity extends DetailActivity implements OnClickListene
|
||||
return;
|
||||
}
|
||||
JsonObjectExtendedRequest gameRequest = new JsonObjectExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v2d0/game/" + gameId + "/news_digest",
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v2d0/game/" + gameId + "/news_digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
|
||||
@ -23,10 +23,8 @@ import com.android.volley.Response;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.FileUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.gamecenter.db.info.FilterInfo;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
@ -353,9 +351,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
|
||||
private void getPlatform() {
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d45/support/setting/platform",
|
||||
Constants.PLATFORM_CD),
|
||||
Config.HOST + "v1d45/support/setting/platform",
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -12,11 +12,9 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.gamecenter.ConcernActivity;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -75,9 +73,7 @@ public class ConcernAdapter extends RecyclerView.Adapter<ConcernViewHolder> {
|
||||
cCount = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
JsonObjectExtendedRequest concernObjectRequest = new JsonObjectExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v2d0/game/" + concernList.get(i).getId() + "/digest",
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v2d0/game/" + concernList.get(i).getId() + "/digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
|
||||
@ -11,10 +11,8 @@ import android.widget.Toast;
|
||||
import com.android.volley.Response;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.gamecenter.ConcernActivity;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -59,8 +57,7 @@ public class ConcernRecommendAdapter extends RecyclerView.Adapter<ConcernViewHol
|
||||
|
||||
private void initRecommendGame() {
|
||||
JsonArrayExtendedRequest recommendRequest = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(Config.HOST + "v1d45/game/remenkapai",
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v1d45/game/remenkapai",
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -13,7 +13,6 @@ import android.widget.LinearLayout;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.download.DownloadEntity;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
|
||||
@ -15,13 +15,11 @@ import com.android.volley.TimeoutError;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
@ -100,9 +98,7 @@ public class SubjectAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||
public void initList(final int page) {
|
||||
isLoaded = false;
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d50/game/column/" + id + "?page=" + page,
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v1d50/game/column/" + id + "?page=" + page,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -74,29 +74,40 @@ public class GameDownLoadFragment extends Fragment implements View.OnClickListen
|
||||
if (location != null) {
|
||||
if (!"pause".equals(statusMap.get(downloadEntity.getUrl()))) {
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
// 删除下载中列表对应数据
|
||||
if (adapter.getDownloadingList().size() == 1) {
|
||||
adapter.getDownloadingList().remove(location.intValue());
|
||||
adapter.notifyItemRangeRemoved(base, 2);
|
||||
} else {
|
||||
adapter.getDownloadingList().remove(location.intValue());
|
||||
adapter.notifyItemRemoved(base + location + 1);
|
||||
adapter.notifyItemChanged(base + 1);
|
||||
// 检查对应下载列表中是否存在该数据
|
||||
boolean isContains = false;
|
||||
for (DownloadEntity entity : adapter.getDownloadingList()) {
|
||||
if (entity.getUrl().equals(downloadEntity.getUrl())) {
|
||||
isContains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isContains) {
|
||||
// 删除下载中列表对应数据
|
||||
if (adapter.getDownloadingList().size() == 1) {
|
||||
adapter.getDownloadingList().remove(location.intValue());
|
||||
adapter.notifyItemRangeRemoved(base, 2);
|
||||
} else {
|
||||
adapter.getDownloadingList().remove(location.intValue());
|
||||
adapter.notifyItemRemoved(base + location + 1);
|
||||
adapter.notifyItemChanged(base + 1);
|
||||
}
|
||||
|
||||
// 添加进已完成列表
|
||||
if (adapter.getDoneList().isEmpty()) {
|
||||
adapter.getDoneList().add(downloadEntity);
|
||||
adapter.notifyItemRangeInserted(0, 2);
|
||||
} else {
|
||||
adapter.getDoneList().add(downloadEntity);
|
||||
adapter.notifyItemInserted(adapter.getDoneList().size());
|
||||
}
|
||||
|
||||
// 添加进已完成列表
|
||||
if (adapter.getDoneList().isEmpty()) {
|
||||
adapter.getDoneList().add(downloadEntity);
|
||||
adapter.notifyItemRangeInserted(0, 2);
|
||||
} else {
|
||||
adapter.getDoneList().add(downloadEntity);
|
||||
adapter.notifyItemInserted(adapter.getDoneList().size());
|
||||
adapter.notifyItemChanged(location + 1);
|
||||
}
|
||||
|
||||
urlMap.put(PackageUtils.getPackageNameByPath(getActivity(),
|
||||
downloadEntity.getPath()), downloadEntity.getUrl());
|
||||
|
||||
// adapter.notifyDataSetChanged();
|
||||
} else {
|
||||
adapter.getDownloadingList().set(location, downloadEntity);
|
||||
adapter.notifyItemChanged(base + location + 1);
|
||||
|
||||
@ -106,7 +106,7 @@ public class GameDownloadAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
// }
|
||||
|
||||
// 最后一个
|
||||
if (position == doneList.size()) {
|
||||
if (position == doneList.size() && downloadingList.size() != 0) {
|
||||
((CardLinearLayout) holder.itemView).setBottom(true);
|
||||
((CardLinearLayout) holder.itemView).setmBottom(0);
|
||||
} else {
|
||||
|
||||
@ -17,7 +17,6 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
@ -27,7 +26,6 @@ import com.gh.common.util.MD5Utils;
|
||||
import com.gh.common.util.NetworkUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.common.view.CardRelativeLayout;
|
||||
import com.gh.download.DownloadEntity;
|
||||
@ -118,9 +116,7 @@ public class GameUpdateAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
gameupdate_ll_loading.setVisibility(View.VISIBLE);
|
||||
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d45/support/package/update?package=" + packageName,
|
||||
Constants.UPDATE_CD),
|
||||
Config.HOST + "v1d45/support/package/update?package=" + packageName,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
@ -182,9 +178,7 @@ public class GameUpdateAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
}
|
||||
params = builder.substring(0, builder.length() - 1);
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d45/support/package/update?package=" + params,
|
||||
Constants.UPDATE_CD),
|
||||
Config.HOST + "v1d45/support/package/update?package=" + params,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -23,7 +23,6 @@ import com.android.volley.TimeoutError;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
@ -31,7 +30,6 @@ import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.view.AutoScrollViewPager;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.download.DownloadManager;
|
||||
@ -158,8 +156,7 @@ public class Game1FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
|
||||
private void initSlide(final boolean isFirst) {
|
||||
JsonArrayExtendedRequest slideRequest = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(Config.HOST + "v1d50/index/slides",
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v1d50/index/slides",
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
@ -192,8 +189,7 @@ public class Game1FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
|
||||
private void initSubjectList() {
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(Config.HOST + "v1d50/game/chajian",
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v1d50/game/chajian",
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -15,14 +15,12 @@ import com.android.volley.TimeoutError;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
@ -110,8 +108,7 @@ public class Game2FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
|
||||
private void initSubjectList() {
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(Config.HOST + "v1d50/game/tuijian",
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v1d50/game/tuijian",
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -15,13 +15,11 @@ import com.android.volley.TimeoutError;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
@ -114,9 +112,7 @@ public class Game3FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
}
|
||||
isLoading = true;
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d50/game/danjiyouxi?limit=20&offset=" + offset,
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v1d50/game/danjiyouxi?limit=20&offset=" + offset,
|
||||
new Response.Listener<JSONArray>() {
|
||||
|
||||
@Override
|
||||
|
||||
@ -128,8 +128,8 @@ public class GameDetailAdapter extends RecyclerView.Adapter {
|
||||
|
||||
// 获取游戏新闻
|
||||
private void getGameNews() {
|
||||
String url = Config.HOST + "v1d45/game/" + gameId + "/news?limit=3";
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(url,
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
Config.HOST + "v1d45/game/" + gameId + "/news?limit=3",
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -19,13 +19,11 @@ import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.DiskBasedCache;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.GzipUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -109,9 +107,8 @@ public class News1FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
return;
|
||||
}
|
||||
isLoading = true;
|
||||
final String url = Config.HOST + "v1d50/news/zixun?limit=10&offset=" + offset;
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(url, Constants.NEWS_CD),
|
||||
Config.HOST + "v1d50/news/zixun?limit=10&offset=" + offset,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -20,13 +20,11 @@ import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.DiskBasedCache;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.GzipUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -110,9 +108,8 @@ public class News2FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
return;
|
||||
}
|
||||
isLoading = true;
|
||||
final String url = Config.HOST + "v1d50/news/yuanchuang?limit=10&offset=" + offset;
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(url, Constants.NEWS_CD),
|
||||
Config.HOST + "v1d50/news/yuanchuang?limit=10&offset=" + offset,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -17,12 +17,10 @@ import com.android.volley.TimeoutError;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.common.view.CardRelativeLayout;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -110,10 +108,8 @@ public class News3FragmentAdapter extends
|
||||
}
|
||||
isLoading = true;
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d45/news?type_group=" + Uri.encode("攻略")
|
||||
+ "&offset=" + offset + "&limit=20",
|
||||
Constants.NEWS_CD),
|
||||
Config.HOST + "v1d45/news?type_group=" + Uri.encode("攻略")
|
||||
+ "&offset=" + offset + "&limit=20",
|
||||
new Response.Listener<JSONArray>() {
|
||||
|
||||
@Override
|
||||
|
||||
@ -142,8 +142,8 @@ public class News4FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
return;
|
||||
}
|
||||
isLoading = true;
|
||||
String url = Config.HOST + "v2d0/zixun/guanzhu?key=" + key + "&limit=10&offset=" + offset;
|
||||
JsonArrayExtendedRequest request= new JsonArrayExtendedRequest(url,
|
||||
JsonArrayExtendedRequest request= new JsonArrayExtendedRequest(
|
||||
Config.HOST + "v2d0/zixun/guanzhu?key=" + key + "&limit=10&offset=" + offset,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
@ -210,8 +210,8 @@ public class News4FragmentAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
return;
|
||||
}
|
||||
isLoading = true;
|
||||
String url = Config.HOST + "v2d0/zixun/guanzhu?game_id=" + ids + "&limit=10&offset=" + offset;
|
||||
JsonArrayExtendedRequest request= new JsonArrayExtendedRequest(url,
|
||||
JsonArrayExtendedRequest request= new JsonArrayExtendedRequest(
|
||||
Config.HOST + "v2d0/zixun/guanzhu?game_id=" + ids + "&limit=10&offset=" + offset,
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -23,14 +23,12 @@ import com.android.volley.TimeoutError;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.ConcernUtils;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.RandomUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.TokenUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
@ -124,9 +122,7 @@ public class NewsDetailAdapter extends RecyclerView.Adapter {
|
||||
|
||||
private void getNewsMore() {
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d45/news/" + newsDetailEntity.getId() + "/suggestion",
|
||||
Constants.NEWS_CD),
|
||||
Config.HOST + "v1d45/news/" + newsDetailEntity.getId() + "/suggestion",
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -12,13 +12,11 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
@ -94,9 +92,7 @@ public class ConcernFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
count = 0;
|
||||
for (int i = 0; i < concernList.size(); i++) {
|
||||
JsonObjectExtendedRequest concernObjectRequest = new JsonObjectExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v2d0/game/" + concernList.get(i).getId() + "/digest",
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v2d0/game/" + concernList.get(i).getId() + "/digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
|
||||
@ -12,7 +12,6 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
@ -20,7 +19,6 @@ import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.TrafficUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.download.DownloadManager;
|
||||
@ -200,9 +198,7 @@ public class InstallFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
count = 0;
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
JsonObjectExtendedRequest objectRequest = new JsonObjectExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v2d0/game/" + ids.get(i) + "/digest",
|
||||
Constants.GAME_CD),
|
||||
Config.HOST + "v2d0/game/" + ids.get(i) + "/digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
@ -287,9 +283,12 @@ public class InstallFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
private void initLocationMap() {
|
||||
for (int i = 0; i < gameList.size(); i++) {
|
||||
GameEntity gameEntity = gameList.get(i);
|
||||
locationMap.put(gameEntity.getName() + " - " + gameEntity.getApk().get(0).getPlatform(), i);
|
||||
for (ApkEntity apkEntity : gameEntity.getApk()) {
|
||||
nameMap.put(apkEntity.getPackageName(), gameEntity.getName() + " - " + gameEntity.getApk().get(0).getPlatform());
|
||||
// TODO ERROR IndexOutOfBoundsException InstallFragmentAdapter initLocationMap 290
|
||||
if (gameEntity.getApk() != null && gameEntity.getApk().size() != 0) {
|
||||
locationMap.put(gameEntity.getName() + " - " + gameEntity.getApk().get(0).getPlatform(), i);
|
||||
for (ApkEntity apkEntity : gameEntity.getApk()) {
|
||||
nameMap.put(apkEntity.getPackageName(), gameEntity.getName() + " - " + gameEntity.getApk().get(0).getPlatform());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,12 +16,10 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.common.view.DownloadDialog;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
@ -86,9 +84,7 @@ public class SearchGameDetailFragmentAdapter extends RecyclerView.Adapter<GameNo
|
||||
|
||||
private void search(String key) {
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d45/search/game?keyword=" + Uri.encode(key),
|
||||
Constants.SEARCH_CD),
|
||||
Config.HOST + "v1d45/search/game?keyword=" + Uri.encode(key),
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -15,12 +15,10 @@ import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.common.view.DownloadDialog;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
@ -84,9 +82,7 @@ public class SearchGameListFragmentAdapter extends RecyclerView.Adapter<Recycler
|
||||
|
||||
private void searchGame(String key) {
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
TimestampUtils.addTimestamp(
|
||||
Config.HOST + "v1d45/search/game?keyword=" + Uri.encode(key),
|
||||
Constants.SEARCH_CD),
|
||||
Config.HOST + "v1d45/search/game?keyword=" + Uri.encode(key),
|
||||
new Response.Listener<JSONArray>() {
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
|
||||
@ -9,6 +9,7 @@ import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.toolbox.HttpHeaderParser;
|
||||
import com.gh.common.util.GzipUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
|
||||
import org.apache.http.HttpStatus;
|
||||
@ -45,7 +46,7 @@ public abstract class ExtendedRequest<T> extends Request<T> {
|
||||
String url,
|
||||
Response.Listener<T> successListener,
|
||||
Response.ErrorListener errorListener) {
|
||||
super(method, url, errorListener);
|
||||
super(method, TimestampUtils.addTimestamp(url), errorListener);
|
||||
setTimeout(TIMEOUT);
|
||||
mSuccessListener = successListener;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user