V3.2Api接口更改(分页改为page未完成)

This commit is contained in:
kehaoyuan
2018-03-28 10:01:10 +08:00
parent d713c67c9b
commit 4df8f18cc4
52 changed files with 774 additions and 653 deletions

View File

@ -6,9 +6,10 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.gh.common.util.GsonUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.entity.ControlEntity;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.entity.SettingsEntity;
import com.halo.assistant.HaloApp;
import com.lightgame.utils.Utils;
@ -49,17 +50,17 @@ public class Config {
public static final String URL_ARTICLE = "http://www.ghzs666.com/article/"; // TODO ghzs/ghzs666 统一
public static final String PATCHES = "patches";
public static List<ControlEntity> mControlData;
private static SettingsEntity mSettingsEntity;
public static boolean isShow() {
// SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// return sp.getBoolean("isShow", true);
if (mControlData == null || mControlData.size() == 0)
return false;
for (ControlEntity entity : mControlData) {
if (!isExistDownloadFilter()) return false;
for (SettingsEntity.Download entity : mSettingsEntity.getDownload()) {
if ("all".equals(entity.getGame())) {
if (entity.getPluginfy() && "normal".equals(entity.getPolicy()) && filterTime(entity.getTime())) {
if (entity.isPluginfy() && "normal".equals(entity.getPolicy()) && filterTime(entity.getTime())) {
return true;
}
}
@ -78,10 +79,10 @@ public class Config {
}
public static boolean isShowDownload(String gameId) {
if ((TextUtils.isEmpty(gameId) || mControlData == null || mControlData.size() == 0))
if (TextUtils.isEmpty(gameId) || !isExistDownloadFilter())
return false;
for (ControlEntity entity : mControlData) {
for (SettingsEntity.Download entity : mSettingsEntity.getDownload()) {
if (gameId.equals(entity.getGame())) {
if ("normal".equals(entity.getPolicy()) && filterTime(entity.getTime())) {
return true;
@ -100,18 +101,18 @@ public class Config {
public static boolean isShowPlugin(String gameId) {
if (TextUtils.isEmpty(gameId) || mControlData == null || mControlData.size() == 0)
if (TextUtils.isEmpty(gameId) || !isExistDownloadFilter())
return false;
for (ControlEntity entity : mControlData) {
for (SettingsEntity.Download entity : mSettingsEntity.getDownload()) {
if (gameId.equals(entity.getGame())) {
if (entity.getPluginfy() && filterTime(entity.getTime())) {
if (entity.isPluginfy() && filterTime(entity.getTime())) {
return true;
} else {
return false;
}
} else if ("all".equals(entity.getGame())) {
if (entity.getPluginfy() && filterTime(entity.getTime())) {
if (entity.isPluginfy() && filterTime(entity.getTime())) {
return true;
}
}
@ -121,12 +122,12 @@ public class Config {
}
public static boolean isShowPlugin() {
if (mControlData == null || mControlData.size() == 0)
if (!isExistDownloadFilter())
return false;
for (ControlEntity entity : mControlData) {
for (SettingsEntity.Download entity : mSettingsEntity.getDownload()) {
if ("all".equals(entity.getGame())) {
if (entity.getPluginfy() && filterTime(entity.getTime())) {
if (entity.isPluginfy() && filterTime(entity.getTime())) {
return true;
}
}
@ -135,7 +136,7 @@ public class Config {
return false;
}
private static boolean filterTime(ControlEntity.TimeEntity timeEntity) {
private static boolean filterTime(SettingsEntity.Download.TimeEntity timeEntity) {
long end = timeEntity.getEnd();
long start = timeEntity.getStart();
long curTime = Utils.getTime(HaloApp.getInstance().getApplication());
@ -147,8 +148,24 @@ public class Config {
return false;
}
public static void setControlData(List<ControlEntity> controlData) {
mControlData = controlData;
public static void setSettings(SettingsEntity settingsEntity) {
if (settingsEntity != null && settingsEntity.getSuggestion() != null) {
String s = GsonUtils.Companion.getInstance().toJson(settingsEntity);
}
mSettingsEntity = settingsEntity;
}
public static SettingsEntity getSettings() {
return mSettingsEntity;
}
private static boolean isExistDownloadFilter() {
if (mSettingsEntity == null || mSettingsEntity.getDownload() == null || mSettingsEntity.getDownload().size() == 0) {
return false;
} else {
return true;
}
}
public static void filterPluginArticle(List<NewsEntity> list) {