From 09a0eabc486bd2f5d09fc49e4d30c66daeae245a Mon Sep 17 00:00:00 2001 From: huangzhuanghua <401742778@qq.com> Date: Wed, 28 Sep 2016 18:47:14 +0800 Subject: [PATCH] =?UTF-8?q?url=E6=B7=BB=E5=8A=A0Timestamp=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/gh/base/HomeFragment.java | 6 +- .../com/gh/common/util/PlatformUtils.java | 4 +- .../com/gh/common/util/TimestampUtils.java | 140 ++++++++++++------ .../java/com/gh/download/DataChanger.java | 4 +- .../java/com/gh/download/DownloadManager.java | 11 +- .../com/gh/gamecenter/GameDetailActivity.java | 7 +- .../java/com/gh/gamecenter/MainActivity.java | 9 +- .../com/gh/gamecenter/NewsDetailActivity.java | 9 +- .../gh/gamecenter/SplashScreenActivity.java | 6 +- .../gh/gamecenter/adapter/ConcernAdapter.java | 6 +- .../adapter/ConcernRecommendAdapter.java | 5 +- .../adapter/PlatformPagerAdapter.java | 1 - .../gh/gamecenter/adapter/SubjectAdapter.java | 6 +- .../download/GameDownLoadFragment.java | 43 ++++-- .../download/GameDownloadAdapter.java | 2 +- .../download/GameUpdateAdapter.java | 10 +- .../gamecenter/game/Game1FragmentAdapter.java | 8 +- .../gamecenter/game/Game2FragmentAdapter.java | 5 +- .../gamecenter/game/Game3FragmentAdapter.java | 6 +- .../gamedetail/GameDetailAdapter.java | 4 +- .../gamecenter/news/News1FragmentAdapter.java | 5 +- .../gamecenter/news/News2FragmentAdapter.java | 5 +- .../gamecenter/news/News3FragmentAdapter.java | 8 +- .../gamecenter/news/News4FragmentAdapter.java | 8 +- .../newsdetail/NewsDetailAdapter.java | 6 +- .../personal/ConcernFragmentAdapter.java | 6 +- .../personal/InstallFragmentAdapter.java | 15 +- .../SearchGameDetailFragmentAdapter.java | 6 +- .../search/SearchGameListFragmentAdapter.java | 6 +- .../volley/extended/ExtendedRequest.java | 3 +- 30 files changed, 181 insertions(+), 179 deletions(-) diff --git a/app/src/main/java/com/gh/base/HomeFragment.java b/app/src/main/java/com/gh/base/HomeFragment.java index 102fc61326..fdfc78eef4 100644 --- a/app/src/main/java/com/gh/base/HomeFragment.java +++ b/app/src/main/java/com/gh/base/HomeFragment.java @@ -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); + } } } diff --git a/app/src/main/java/com/gh/common/util/PlatformUtils.java b/app/src/main/java/com/gh/common/util/PlatformUtils.java index c366660871..1485210a37 100644 --- a/app/src/main/java/com/gh/common/util/PlatformUtils.java +++ b/app/src/main/java/com/gh/common/util/PlatformUtils.java @@ -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() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/common/util/TimestampUtils.java b/app/src/main/java/com/gh/common/util/TimestampUtils.java index 7af137365b..7227b9af63 100644 --- a/app/src/main/java/com/gh/common/util/TimestampUtils.java +++ b/app/src/main/java/com/gh/common/util/TimestampUtils.java @@ -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 map; + private static ArrayMap intervalMap; // 间隔 + private static ArrayMap 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 */ diff --git a/app/src/main/java/com/gh/download/DataChanger.java b/app/src/main/java/com/gh/download/DataChanger.java index d8e949856b..938a96bba7 100644 --- a/app/src/main/java/com/gh/download/DataChanger.java +++ b/app/src/main/java/com/gh/download/DataChanger.java @@ -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); } } diff --git a/app/src/main/java/com/gh/download/DownloadManager.java b/app/src/main/java/com/gh/download/DownloadManager.java index 6f9abd6be5..34e5c806ff 100644 --- a/app/src/main/java/com/gh/download/DownloadManager.java +++ b/app/src/main/java/com/gh/download/DownloadManager.java @@ -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"); } diff --git a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java index aecd69e1f1..f8e268c6e2 100644 --- a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java +++ b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java @@ -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() { @Override public void onResponse(JSONObject response) { diff --git a/app/src/main/java/com/gh/gamecenter/MainActivity.java b/app/src/main/java/com/gh/gamecenter/MainActivity.java index 9663aa55ee..552bc4d531 100644 --- a/app/src/main/java/com/gh/gamecenter/MainActivity.java +++ b/app/src/main/java/com/gh/gamecenter/MainActivity.java @@ -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() { @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() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java index 0e1b87f1c3..e8ea563b8c 100644 --- a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java +++ b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java @@ -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() { @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() { @Override public void onResponse(JSONObject response) { diff --git a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java index 46d12107b4..050b25c0be 100644 --- a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java +++ b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java @@ -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() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/adapter/ConcernAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/ConcernAdapter.java index eea7fcb5a0..89ffc785fd 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/ConcernAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/ConcernAdapter.java @@ -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 { 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() { @Override public void onResponse(JSONObject response) { diff --git a/app/src/main/java/com/gh/gamecenter/adapter/ConcernRecommendAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/ConcernRecommendAdapter.java index 2b64cce01d..8ca5b3edec 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/ConcernRecommendAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/ConcernRecommendAdapter.java @@ -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() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/adapter/PlatformPagerAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/PlatformPagerAdapter.java index 717661bddf..4924f19867 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/PlatformPagerAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/PlatformPagerAdapter.java @@ -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; diff --git a/app/src/main/java/com/gh/gamecenter/adapter/SubjectAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/SubjectAdapter.java index 70c512f9c2..43cb867374 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/SubjectAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/SubjectAdapter.java @@ -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() { @Override public void onResponse(JSONArray response) { @@ -192,8 +189,7 @@ public class Game1FragmentAdapter extends RecyclerView.Adapter() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/game/Game2FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/game/Game2FragmentAdapter.java index c4dedb57d3..caa8db7286 100644 --- a/app/src/main/java/com/gh/gamecenter/game/Game2FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/game/Game2FragmentAdapter.java @@ -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() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/game/Game3FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/game/Game3FragmentAdapter.java index 4084abadb1..82b1e1e704 100644 --- a/app/src/main/java/com/gh/gamecenter/game/Game3FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/game/Game3FragmentAdapter.java @@ -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() { @Override diff --git a/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailAdapter.java b/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailAdapter.java index 429f7cd9ff..f0e91a945d 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailAdapter.java @@ -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() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/news/News1FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/news/News1FragmentAdapter.java index 11c4ff6d92..d4b561ab0c 100644 --- a/app/src/main/java/com/gh/gamecenter/news/News1FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/news/News1FragmentAdapter.java @@ -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() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/news/News2FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/news/News2FragmentAdapter.java index c6da0351dc..adca6825a9 100644 --- a/app/src/main/java/com/gh/gamecenter/news/News2FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/news/News2FragmentAdapter.java @@ -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() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/news/News3FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/news/News3FragmentAdapter.java index 0b87b15124..544214c356 100644 --- a/app/src/main/java/com/gh/gamecenter/news/News3FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/news/News3FragmentAdapter.java @@ -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() { @Override diff --git a/app/src/main/java/com/gh/gamecenter/news/News4FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/news/News4FragmentAdapter.java index 0b58d5815f..ea8b17bc08 100644 --- a/app/src/main/java/com/gh/gamecenter/news/News4FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/news/News4FragmentAdapter.java @@ -142,8 +142,8 @@ public class News4FragmentAdapter extends RecyclerView.Adapter() { @Override public void onResponse(JSONArray response) { @@ -210,8 +210,8 @@ public class News4FragmentAdapter extends RecyclerView.Adapter() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java b/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java index 9eaa7fc33b..128d357ad2 100644 --- a/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java @@ -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() { @Override public void onResponse(JSONArray response) { diff --git a/app/src/main/java/com/gh/gamecenter/personal/ConcernFragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/personal/ConcernFragmentAdapter.java index 5a2c5bcb44..d02a2fed34 100644 --- a/app/src/main/java/com/gh/gamecenter/personal/ConcernFragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/personal/ConcernFragmentAdapter.java @@ -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() { @Override public void onResponse(JSONObject response) { diff --git a/app/src/main/java/com/gh/gamecenter/personal/InstallFragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/personal/InstallFragmentAdapter.java index 695b1967af..0fe5fa2a01 100644 --- a/app/src/main/java/com/gh/gamecenter/personal/InstallFragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/personal/InstallFragmentAdapter.java @@ -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() { @Override public void onResponse(JSONObject response) { @@ -287,9 +283,12 @@ public class InstallFragmentAdapter extends RecyclerView.Adapter