diff --git a/app/libs/alicloud-android-sdk-httpdns-1.0.6.jar b/app/libs/alicloud-android-sdk-httpdns-1.0.6.jar deleted file mode 100644 index da9bda3804..0000000000 Binary files a/app/libs/alicloud-android-sdk-httpdns-1.0.6.jar and /dev/null differ diff --git a/app/src/main/java/com/gh/base/AppController.java b/app/src/main/java/com/gh/base/AppController.java index 8d4518fca2..fcdb20e4ce 100644 --- a/app/src/main/java/com/gh/base/AppController.java +++ b/app/src/main/java/com/gh/base/AppController.java @@ -5,7 +5,6 @@ import android.app.ActivityManager; import android.app.ActivityManager.RunningAppProcessInfo; import android.app.Application; import android.content.Context; -import android.content.SharedPreferences; import android.os.Process; import android.support.v4.util.ArrayMap; import android.text.TextUtils; @@ -15,36 +14,92 @@ import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; import com.gh.base.GHPushMessageReceiver.PushHandler; -import com.gh.common.constant.Config; import com.gh.common.util.DataUtils; -import com.gh.common.util.DexUtils; -import com.gh.common.util.HotFix; import com.gh.common.util.Utils; import com.xiaomi.channel.commonutils.logger.LoggerInterface; import com.xiaomi.mipush.sdk.Logger; import com.xiaomi.mipush.sdk.MiPushClient; -import java.io.File; import java.util.ArrayList; import java.util.List; -//import com.facebook.drawee.backends.pipeline.Fresco; - public class AppController extends Application { + public static final String TAG = AppController.class.getSimpleName(); - - private RequestQueue mRequestQueue; - - private static AppController mInstance; - // xiaomi push appid public static final String APP_ID = "2882303761517352993"; // xiaomi push appkey public static final String APP_KEY = "5451735292993"; + private static AppController mInstance; private static PushHandler handler = null; + private static ArrayMap objectMap = new ArrayMap<>(); - private static ArrayMap objectMap = new ArrayMap(); + private RequestQueue mRequestQueue; + + private ArrayList list = new ArrayList<>(); + + private boolean isFinish = false; + + @Override + public void onCreate() { + super.onCreate(); + +// File dexPath = new File(getDir("dex", Context.MODE_PRIVATE), "hackdex_dex.jar"); +// DexUtils.prepareAssetsDex(this, dexPath, "hackdex_dex.jar"); +// HotFix.patch(this, dexPath.getAbsolutePath(), "dodola.hackdex.AntilazyLoad"); + +// SharedPreferences sp = this.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE); +// File directory = new File(this.getFilesDir().getAbsolutePath() + File.separator + "hotfix"); +// if (directory.exists()) { +// File[] files = directory.listFiles(); +// for (File file : files) { +// Utils.log("dex file = " + file.getName()); +// String clazz = sp.getString(file.getName(), null); +// if (clazz != null) { +// dexPath = new File(getDir("dex", Context.MODE_PRIVATE), file.getName()); +// DexUtils.prepareDex(this, dexPath, file); +// HotFix.patch(this, dexPath.getAbsolutePath(), clazz); +// Utils.log(file.getName() + " patch success"); +// } +// } +// } + + DataUtils.init(this); + + AppUncaHandler uncaHandler = new AppUncaHandler(this); + Thread.setDefaultUncaughtExceptionHandler(uncaHandler); + mInstance = this; + + // 注册push服务,注册成功后会向GHPushMessageReceiver发送广播 + // 可以从GHPushMessageReceiver的onCommandResult方法中MiPushCommandMessage对象参数中获取注册信息 + if (shouldInit()) { + MiPushClient.registerPush(this, APP_ID, APP_KEY); + } + + LoggerInterface newLogger = new LoggerInterface() { + + @Override + public void setTag(String tag) { + // ignore + } + + @Override + public void log(String content, Throwable t) { + Log.d(TAG, content, t); + } + + @Override + public void log(String content) { + Log.d(TAG, content); + } + }; + Logger.setLogger(this, newLogger); + if (handler == null) { + handler = new PushHandler(); + } + + } public static void put(String key, Object object) { objectMap.put(key, object); @@ -62,10 +117,6 @@ public class AppController extends Application { objectMap.remove(key); } - private ArrayList list = new ArrayList(); - - private boolean isFinish = false; - /** * Activity关闭时,删除Activity列表中的Activity对象 */ @@ -100,67 +151,6 @@ public class AppController extends Application { Process.killProcess(Process.myPid()); } - @Override - public void onCreate() { - super.onCreate(); - -// Fresco.initialize(getApplicationContext()); - File dexPath = new File(getDir("dex", Context.MODE_PRIVATE), "hackdex_dex.jar"); - DexUtils.prepareAssetsDex(this, dexPath, "hackdex_dex.jar"); - HotFix.patch(this, dexPath.getAbsolutePath(), "dodola.hackdex.AntilazyLoad"); - - SharedPreferences sp = this.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE); - File directory = new File(this.getFilesDir().getAbsolutePath() + File.separator + "hotfix"); - if (directory.exists()) { - File[] files = directory.listFiles(); - for (File file : files) { - Utils.log("dex file = " + file.getName()); - String clazz = sp.getString(file.getName(), null); - if (clazz != null) { - dexPath = new File(getDir("dex", Context.MODE_PRIVATE), file.getName()); - DexUtils.prepareDex(this, dexPath, file); - HotFix.patch(this, dexPath.getAbsolutePath(), clazz); - Utils.log(file.getName() + " patch success"); - } - } - } - - DataUtils.init(this); - - AppUncaHandler uncaHandler = new AppUncaHandler(this); - Thread.setDefaultUncaughtExceptionHandler(uncaHandler); - mInstance = this; - - // 注册push服务,注册成功后会向GHPushMessageReceiver发送广播 - // 可以从GHPushMessageReceiver的onCommandResult方法中MiPushCommandMessage对象参数中获取注册信息 - if (shouldInit()) { - MiPushClient.registerPush(this, APP_ID, APP_KEY); - } - - LoggerInterface newLogger = new LoggerInterface() { - - @Override - public void setTag(String tag) { - // ignore - } - - @Override - public void log(String content, Throwable t) { - Log.d(TAG, content, t); - } - - @Override - public void log(String content) { - Log.d(TAG, content); - } - }; - Logger.setLogger(this, newLogger); - if (handler == null) { - handler = new PushHandler(this); - } - - } - public static String getProcessName(Context cxt, int pid) { ActivityManager am = (ActivityManager) cxt .getSystemService(Context.ACTIVITY_SERVICE); @@ -180,19 +170,6 @@ public class AppController extends Application { return mInstance; } - public void addRequest(Request request) { - if (mRequestQueue == null) { - mRequestQueue = Volley.newRequestQueue(getApplicationContext()); - } - mRequestQueue.add(request); - } - - public void cancleRequest(Object tag){ - if (mRequestQueue != null) { - mRequestQueue.cancelAll(tag); - } - } - public static void addToRequestQueue(Request request) { request.setTag(TAG); getInstance().addRequest(request); @@ -210,7 +187,7 @@ public class AppController extends Application { } addToRequestQueue(request, tag); } - + public static void addToRequestQueue(Request request, Class clazz) { String tag = null; if (clazz != null) { @@ -224,7 +201,7 @@ public class AppController extends Application { getInstance().cancleRequest(tag); } } - + public static void canclePendingRequests(Object obj) { if (obj != null) { getInstance().cancleRequest(obj.getClass().getSimpleName()); @@ -236,6 +213,19 @@ public class AppController extends Application { getInstance().cancleRequest(clazz.getSimpleName()); } } + + public void addRequest(Request request) { + if (mRequestQueue == null) { + mRequestQueue = Volley.newRequestQueue(getApplicationContext()); + } + mRequestQueue.add(request); + } + + public void cancleRequest(Object tag){ + if (mRequestQueue != null) { + mRequestQueue.cancelAll(tag); + } + } private boolean shouldInit() { ActivityManager am = ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE)); diff --git a/app/src/main/java/com/gh/base/BaseActivity.java b/app/src/main/java/com/gh/base/BaseActivity.java index c2b13f22b8..58c49dcbde 100644 --- a/app/src/main/java/com/gh/base/BaseActivity.java +++ b/app/src/main/java/com/gh/base/BaseActivity.java @@ -5,7 +5,6 @@ import android.app.Activity; import android.content.Context; import android.os.Build; import android.os.Bundle; -import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; @@ -37,17 +36,14 @@ import onekeyshare.OnekeyShare; import onekeyshare.themes.classic.PlatformPage; public class BaseActivity extends Activity { - private String LOG = this.getClass().getName(); - private boolean LOG_ON = true; + + private SystemBarTintManager tintManager; private boolean isPause; - - private SystemBarTintManager tintManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - AppLog("onCreate"); Utils.log(this.getClass().getSimpleName()); AppController.getInstance().addActivity(this); EventBus.getDefault().register(this); @@ -65,7 +61,7 @@ public class BaseActivity extends Activity { setTranslucentStatus(true); tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); - tintManager.setStatusBarTintResource(R.color.theme_colors); + tintManager.setStatusBarTintResource(R.color.theme); SystemBarConfig config = tintManager.getConfig(); contentView.setPadding(0, config.getPixelInsetTop(false), 0, config.getPixelInsetBottom()); @@ -120,12 +116,6 @@ public class BaseActivity extends Activity { AppController.getInstance().removeActivity(this); } - public void AppLog(String str) { - if (LOG_ON) { - Log.i(LOG, str); - } - } - public void toast(String msg) { Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } @@ -231,35 +221,15 @@ public class BaseActivity extends Activity { @Override protected void onPause() { super.onPause(); - AppLog("onPause"); DataUtils.onPause(this); isPause = true; } - @Override - protected void onRestart() { - super.onRestart(); - AppLog("onRestart"); - } - @Override protected void onResume() { super.onResume(); - AppLog("onResume"); DataUtils.onResume(this); isPause = false; } - @Override - protected void onStart() { - super.onStart(); - AppLog("onStart"); - } - - @Override - protected void onStop() { - super.onStop(); - AppLog("onStop"); - } - } diff --git a/app/src/main/java/com/gh/base/BaseFragmentActivity.java b/app/src/main/java/com/gh/base/BaseFragmentActivity.java index d5d475f025..1f4c6eb5b3 100644 --- a/app/src/main/java/com/gh/base/BaseFragmentActivity.java +++ b/app/src/main/java/com/gh/base/BaseFragmentActivity.java @@ -5,7 +5,6 @@ import android.content.Context; import android.os.Build; import android.os.Bundle; import android.support.v4.app.FragmentActivity; -import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; @@ -37,15 +36,12 @@ import onekeyshare.OnekeyShare; import onekeyshare.themes.classic.PlatformPage; public class BaseFragmentActivity extends FragmentActivity { - private String LOG = this.getClass().getName(); - private boolean LOG_ON = false; private boolean isPause; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - AppLog("onCreate"); Utils.log(this.getClass().getSimpleName()); AppController.getInstance().addActivity(this); EventBus.getDefault().register(this); @@ -63,7 +59,7 @@ public class BaseFragmentActivity extends FragmentActivity { setTranslucentStatus(true); SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); - tintManager.setStatusBarTintResource(R.color.theme_colors); + tintManager.setStatusBarTintResource(R.color.theme); SystemBarConfig config = tintManager.getConfig(); contentView.setPadding(0, config.getPixelInsetTop(false), 0, config.getPixelInsetBottom()); @@ -113,12 +109,6 @@ public class BaseFragmentActivity extends FragmentActivity { AppController.getInstance().removeActivity(this); } - public void AppLog(String str) { - if (LOG_ON) { - Log.i(LOG, str); - } - } - public void toast(String msg) { Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } @@ -224,34 +214,15 @@ public class BaseFragmentActivity extends FragmentActivity { @Override protected void onPause() { super.onPause(); - AppLog("onPause"); DataUtils.onPause(this); isPause = true; } - @Override - protected void onRestart() { - super.onRestart(); - AppLog("onRestart"); - } - @Override protected void onResume() { super.onResume(); - AppLog("onResume"); DataUtils.onResume(this); isPause = false; } - @Override - protected void onStart() { - super.onStart(); - AppLog("onStart"); - } - - @Override - protected void onStop() { - super.onStop(); - AppLog("onStop"); - } } diff --git a/app/src/main/java/com/gh/base/GHPushMessageReceiver.java b/app/src/main/java/com/gh/base/GHPushMessageReceiver.java index c6cc50674e..56c3c99cca 100644 --- a/app/src/main/java/com/gh/base/GHPushMessageReceiver.java +++ b/app/src/main/java/com/gh/base/GHPushMessageReceiver.java @@ -1,6 +1,5 @@ package com.gh.base; -import android.annotation.SuppressLint; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; @@ -64,7 +63,6 @@ import java.util.Locale; public class GHPushMessageReceiver extends PushMessageReceiver { private String mRegId; - private long mResultCode = -1; private String mReason; private String mCommand; private String mMessage; @@ -74,6 +72,8 @@ public class GHPushMessageReceiver extends PushMessageReceiver { private String mStartTime; private String mEndTime; + private long mResultCode = -1; + @Override public void onReceivePassThroughMessage(Context context, MiPushMessage message) { @@ -86,15 +86,12 @@ public class GHPushMessageReceiver extends PushMessageReceiver { Utils.log("channel = " + channel); // 1判断渠道号是否一致或是否为ALL String TD_CHANNEL_ID = (String) PackageUtils.getMetaData(context, context.getPackageName(), "TD_CHANNEL_ID"); - if ("ALL".equals(channel) - || TD_CHANNEL_ID - .equalsIgnoreCase(channel)) { + if ("ALL".equals(channel) || channel.equalsIgnoreCase(TD_CHANNEL_ID)) { String type = jsonObject.getString("type"); Utils.log("type = " + type); if ("NEWS".equals(type)) { // 新闻推送 - JSONArray jsonArray = jsonObject - .getJSONArray("package"); + JSONArray jsonArray = jsonObject.getJSONArray("package"); ArrayMap map = getInstalledMapFromLocal(context); for (int i = 0; i < jsonArray.length(); i++) { Boolean b = map.get(jsonArray.getString(i)); @@ -119,14 +116,11 @@ public class GHPushMessageReceiver extends PushMessageReceiver { if (gh_version != null) { gh_version = gh_version.substring(2); // 判断gh_version是否相同 - if (gh_version.equals(apk - .getString("gh_version"))) { + if (gh_version.equals(apk.getString("gh_version"))) { // 判断version是否相同 - String version = PackageUtils - .getVersionByPackage(context, - packageName); - if (version.equals(apk - .getString("version"))) { + String version = PackageUtils.getVersionByPackage( + context, packageName); + if (apk.getString("version").equals(version)) { // 版本相同,无需显示插件更新,继续查看是否有可更新的游戏包 continue; } @@ -147,10 +141,8 @@ public class GHPushMessageReceiver extends PushMessageReceiver { e.printStackTrace(); } - Log.v(AppController.TAG, "onReceivePassThroughMessage is called. " - + message.toString()); - String log = context.getString(R.string.recv_passthrough_message, - message.getContent()); + Log.v(AppController.TAG, "onReceivePassThroughMessage is called. " + message.toString()); + String log = context.getString(R.string.recv_passthrough_message, message.getContent()); if (!TextUtils.isEmpty(message.getTopic())) { mTopic = message.getTopic(); @@ -163,8 +155,7 @@ public class GHPushMessageReceiver extends PushMessageReceiver { AppController.getHandler().sendMessage(msg); } - private void showNotification(Context context, JSONObject jsonObject, int id) - throws JSONException { + private void showNotification(Context context, JSONObject jsonObject, int id) throws JSONException { Intent intent = new Intent(); intent.setAction("com.gh.gamecenter.NOTIFICATION"); intent.putExtra("notifyId", id); @@ -185,7 +176,8 @@ public class GHPushMessageReceiver extends PushMessageReceiver { RemoteViews remoteViews = null; if (Build.MANUFACTURER.equals("Meizu") - && (Build.MODEL.startsWith("m") || Build.MODEL.startsWith("MX"))) { + && (Build.MODEL.startsWith("m") + || Build.MODEL.startsWith("MX"))) { remoteViews = new RemoteViews(context.getPackageName(), R.layout.notification_meizu); SimpleDateFormat format = new SimpleDateFormat("HH:mm", @@ -193,8 +185,8 @@ public class GHPushMessageReceiver extends PushMessageReceiver { remoteViews.setTextViewText(R.id.time, format.format(new Date())); } else if (Build.MANUFACTURER.equals("Xiaomi") && (Build.MODEL.startsWith("MI") - || Build.MODEL.startsWith("HM") || Build.MODEL - .startsWith("Redmi"))) { + || Build.MODEL.startsWith("HM") + || Build.MODEL.startsWith("Redmi"))) { // 小米系统 remoteViews = new RemoteViews(context.getPackageName(), R.layout.notification_xiaomi); @@ -304,8 +296,7 @@ public class GHPushMessageReceiver extends PushMessageReceiver { @Override public void onCommandResult(Context context, MiPushCommandMessage message) { - Log.v(AppController.TAG, - "onCommandResult is called. " + message.toString()); + Log.v(AppController.TAG, "onCommandResult is called. " + message.toString()); String command = message.getCommand(); List arguments = message.getCommandArguments(); String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments @@ -325,60 +316,49 @@ public class GHPushMessageReceiver extends PushMessageReceiver { mAlias = cmdArg1; log = context.getString(R.string.set_alias_success, mAlias); } else { - log = context.getString(R.string.set_alias_fail, - message.getReason()); + log = context.getString(R.string.set_alias_fail, message.getReason()); } } else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mAlias = cmdArg1; log = context.getString(R.string.unset_alias_success, mAlias); } else { - log = context.getString(R.string.unset_alias_fail, - message.getReason()); + log = context.getString(R.string.unset_alias_fail, message.getReason()); } } else if (MiPushClient.COMMAND_SET_ACCOUNT.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mAccount = cmdArg1; log = context.getString(R.string.set_account_success, mAccount); } else { - log = context.getString(R.string.set_account_fail, - message.getReason()); + log = context.getString(R.string.set_account_fail, message.getReason()); } } else if (MiPushClient.COMMAND_UNSET_ACCOUNT.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mAccount = cmdArg1; - log = context.getString(R.string.unset_account_success, - mAccount); + log = context.getString(R.string.unset_account_success, mAccount); } else { - log = context.getString(R.string.unset_account_fail, - message.getReason()); + log = context.getString(R.string.unset_account_fail, message.getReason()); } } else if (MiPushClient.COMMAND_SUBSCRIBE_TOPIC.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mTopic = cmdArg1; - log = context.getString(R.string.subscribe_topic_success, - mTopic); + log = context.getString(R.string.subscribe_topic_success, mTopic); } else { - log = context.getString(R.string.subscribe_topic_fail, - message.getReason()); + log = context.getString(R.string.subscribe_topic_fail, message.getReason()); } } else if (MiPushClient.COMMAND_UNSUBSCRIBE_TOPIC.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { - log = context.getString(R.string.unsubscribe_topic_success, - mTopic); + log = context.getString(R.string.unsubscribe_topic_success, mTopic); } else { - log = context.getString(R.string.unsubscribe_topic_fail, - message.getReason()); + log = context.getString(R.string.unsubscribe_topic_fail, message.getReason()); } } else if (MiPushClient.COMMAND_SET_ACCEPT_TIME.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { mStartTime = cmdArg1; mEndTime = cmdArg2; - log = context.getString(R.string.set_accept_time_success, - mStartTime, mEndTime); + log = context.getString(R.string.set_accept_time_success, mStartTime, mEndTime); } else { - log = context.getString(R.string.set_accept_time_fail, - message.getReason()); + log = context.getString(R.string.set_accept_time_fail, message.getReason()); } } else { log = message.getReason(); @@ -415,26 +395,19 @@ public class GHPushMessageReceiver extends PushMessageReceiver { AppController.getHandler().sendMessage(msg); } - @SuppressLint("SimpleDateFormat") public static String getSimpleDate() { - return new SimpleDateFormat("MM-dd hh:mm:ss").format(new Date()); + return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.getDefault()).format(new Date()); } public static class PushHandler extends Handler { - private Context context; - - public PushHandler(Context context) { - this.context = context; - } - @Override public void handleMessage(Message msg) { String s = (String) msg.obj; - if (!TextUtils.isEmpty(s)) { - // Toast.makeText(context, s, Toast.LENGTH_LONG).show(); + Utils.log(getSimpleDate() + " PushHandler:" + s); } } + } } diff --git a/app/src/main/java/com/gh/common/constant/Config.java b/app/src/main/java/com/gh/common/constant/Config.java index 78626f0391..89358d5c17 100644 --- a/app/src/main/java/com/gh/common/constant/Config.java +++ b/app/src/main/java/com/gh/common/constant/Config.java @@ -5,12 +5,9 @@ import com.gh.gamecenter.SplashScreenActivity; public final class Config { - // test host dev.ghzhushou.com/api public static final String HOST = "http://api.ghzhushou.com/"; -// public static final String HOST = "http://115.28.145.16:9001/"; - public static final String PREFERENCE = "ghzhushou"; -// public static final boolean isShow = true; public static final boolean isShow = SplashScreenActivity.isShow; + } diff --git a/app/src/main/java/com/gh/common/constant/Constants.java b/app/src/main/java/com/gh/common/constant/Constants.java index f07e542d0a..d40cc70087 100644 --- a/app/src/main/java/com/gh/common/constant/Constants.java +++ b/app/src/main/java/com/gh/common/constant/Constants.java @@ -38,4 +38,5 @@ public class Constants { public static final int SEARCH_CD = 5 * 60 * 1000; //评论 cd间隔 public static final int COMMENT_CD = 60 * 1000; + } diff --git a/app/src/main/java/com/gh/common/util/ConcernUtils.java b/app/src/main/java/com/gh/common/util/ConcernUtils.java index bb8fcfb24c..0ddfcb6ab3 100644 --- a/app/src/main/java/com/gh/common/util/ConcernUtils.java +++ b/app/src/main/java/com/gh/common/util/ConcernUtils.java @@ -11,7 +11,6 @@ import com.gh.gamecenter.volley.extended.ConcernJsonArrayExtendedRequest; import com.gh.gamecenter.volley.extended.JsonArrayExtendedRequest; import org.json.JSONArray; -import org.json.JSONException; import java.util.UUID; @@ -19,102 +18,117 @@ import java.util.UUID; * Created by khy on 2016/8/24. */ public class ConcernUtils { - public static void LoadConcernData(final String url, final DownJsonListener listener){ + + public static void loadConcernData(final String url, final DownJsonListener listener){ new Thread(new Runnable() { @Override public void run() { - JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(url, new Response.Listener() { - @Override - public void onResponse(JSONArray response) { - if (listener != null){ - listener.downSucced(response.toString()); - } - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - if (listener != null){ - listener.downFailed(); - } - } - }); + JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(url, + new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + if (listener != null){ + listener.downSucced(response.toString()); + } + } + }, + new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + if (listener != null){ + listener.downFailed(); + } + } + }); request.setShouldCache(false); AppController.addToRequestQueue(request); } }).start(); } - public static void PostConcernGameId(final String postData, final String postUrl,final DownJsonListener listener){ - new Thread(new Runnable() { + public static void postConcernGameId(final String gameId, final String postUrl, final DownJsonListener listener){ + new Thread(new Runnable() { @Override public void run() { - JSONArray jsonArray = null; - try { - jsonArray = new JSONArray(postData); - } catch (JSONException e) { - } - ConcernJsonArrayExtendedRequest request = new ConcernJsonArrayExtendedRequest(Request.Method.POST, postUrl, jsonArray, new Response.Listener() { - @Override - public void onResponse(JSONArray response) { - listener.downSucced("关注成功"); - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - listener.downFailed(); - } - }); + JSONArray data = new JSONArray(); + data.put(gameId); + + ConcernJsonArrayExtendedRequest request = new ConcernJsonArrayExtendedRequest( + Request.Method.POST, postUrl, data, + new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + if (listener != null) { + listener.downSucced("关注成功"); + } + } + }, + new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + if (listener != null) { + listener.downFailed(); + } + } + }); request.setShouldCache(false); AppController.addToRequestQueue(request); } }).start(); } - public static void DeleteConcernData(final String url, final DownJsonListener listener){ - final JSONArray jsonArray = new JSONArray(); + + public static void deleteConcernData(final String url, final DownJsonListener listener){ new Thread(new Runnable() { @Override public void run() { - ConcernJsonArrayExtendedRequest request = new ConcernJsonArrayExtendedRequest(Request.Method.DELETE, url, jsonArray, new Response.Listener() { - @Override - public void onResponse(JSONArray response) { - listener.downSucced("删除成功"); - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - listener.downFailed(); - } - }); + ConcernJsonArrayExtendedRequest request = new ConcernJsonArrayExtendedRequest( + Request.Method.DELETE, url, new JSONArray(), + new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + if (listener != null) { + listener.downSucced("删除成功"); + } + } + }, + new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + if (listener != null) { + listener.downFailed(); + } + } + }); request.setShouldCache(false); AppController.addToRequestQueue(request); } }).start(); - } - public static void UpdateConcernData(final String url,String updateData,final DownJsonListener listener){ - JSONArray jsonArray = null; - try { - jsonArray = new JSONArray(updateData); - } catch (JSONException e) { - e.printStackTrace(); - } - final JSONArray finalJsonArray = jsonArray; + + public static void updateConcernData(final String url, final JSONArray data, final DownJsonListener listener){ new Thread(new Runnable() { @Override public void run() { - ConcernJsonArrayExtendedRequest request = new ConcernJsonArrayExtendedRequest(Request.Method.PUT, url, finalJsonArray, new Response.Listener() { - @Override - public void onResponse(JSONArray response) { - listener.downSucced("跟新设备关注成功"); - } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - listener.downFailed(); - } - }); + ConcernJsonArrayExtendedRequest request = new ConcernJsonArrayExtendedRequest( + Request.Method.PUT, url, data, + new Response.Listener() { + @Override + public void onResponse(JSONArray response) { + if (listener != null) { + listener.downSucced("跟新设备关注成功"); + } + } + }, + new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + if (listener != null) { + listener.downFailed(); + } + } + }); request.setShouldCache(false); AppController.addToRequestQueue(request); } @@ -123,16 +137,15 @@ public class ConcernUtils { } public interface DownJsonListener { - void downSucced(String str); void downFailed(); - } - //获取设备号ID - public static String UUID(Context context){ + + // 获取设备号ID + public static String uuid(Context context){ final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); - final String tmDevice, tmSerial, tmPhone, androidId; + final String tmDevice, tmSerial, androidId; tmDevice = "" + tm.getDeviceId(); tmSerial = "" + tm.getSimSerialNumber(); androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); @@ -140,5 +153,6 @@ public class ConcernUtils { UUID deviceUuid = new UUID(androidId.hashCode(), ((long)tmDevice.hashCode() << 32) | tmSerial.hashCode()); return deviceUuid.toString(); } + } diff --git a/app/src/main/java/com/gh/common/util/DeviceUtils.java b/app/src/main/java/com/gh/common/util/DeviceUtils.java index 62b8767840..a9b759b0d5 100644 --- a/app/src/main/java/com/gh/common/util/DeviceUtils.java +++ b/app/src/main/java/com/gh/common/util/DeviceUtils.java @@ -15,14 +15,16 @@ public class DeviceUtils { StringBuffer buffer = new StringBuffer(); String imei = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); if (!TextUtils.isEmpty(imei)) { - buffer.append("imei=" + imei); + buffer.append("imei="); + buffer.append(imei); } String android_id = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID); if (!TextUtils.isEmpty(android_id)) { if (buffer.length() != 0) { buffer.append(","); } - buffer.append("android_id=" + android_id); + buffer.append("android_id="); + buffer.append(android_id); } WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); String mac = wm.getConnectionInfo().getMacAddress(); @@ -30,7 +32,8 @@ public class DeviceUtils { if (buffer.length() != 0) { buffer.append(","); } - buffer.append("mac=" + mac); + buffer.append("mac="); + buffer.append(mac); } return buffer.toString(); } diff --git a/app/src/main/java/com/gh/common/util/DexUtils.java b/app/src/main/java/com/gh/common/util/DexUtils.java index c7abf2a848..9b75602069 100644 --- a/app/src/main/java/com/gh/common/util/DexUtils.java +++ b/app/src/main/java/com/gh/common/util/DexUtils.java @@ -17,6 +17,7 @@ import java.io.OutputStream; * Created by sunpengfei on 15/11/4. */ public class DexUtils { + private static final int BUF_SIZE = 2048; public static boolean prepareAssetsDex(Context context, File dexInternalStoragePath, String dex_file) { @@ -53,7 +54,7 @@ public class DexUtils { } } - public static boolean prepareDex(Context context, File dexInternalStoragePath, File dex_file) { + public static boolean prepareDex(File dexInternalStoragePath, File dex_file) { BufferedInputStream bis = null; OutputStream dexWriter = null; @@ -86,4 +87,5 @@ public class DexUtils { return false; } } + } diff --git a/app/src/main/java/com/gh/common/util/DialogUtils.java b/app/src/main/java/com/gh/common/util/DialogUtils.java index e8f486f33c..253653f7fe 100644 --- a/app/src/main/java/com/gh/common/util/DialogUtils.java +++ b/app/src/main/java/com/gh/common/util/DialogUtils.java @@ -36,29 +36,30 @@ public class DialogUtils { isShowHijackDialog = true; final Dialog dialog = new Dialog(context); - View view = View.inflate(context, - R.layout.common_alertdialog, null); - TextView title = (TextView) view - .findViewById(R.id.alertdialog_title); - title.setText("警告"); - TextView content = (TextView) view - .findViewById(R.id.alertdialog_content); + View view = View.inflate(context, R.layout.common_alertdialog, null); + // 标题 + TextView title = (TextView) view.findViewById(R.id.alertdialog_title); + title.setText("警告"); + + // 内容 + TextView content = (TextView) view.findViewById(R.id.alertdialog_content); content.setText("您当前网络环境异常,下载地址已被替换(网络劫持),请更换网络环境进行下载。"); - TextView cancel = (TextView) view - .findViewById(R.id.alertdialog_cannel); + // 取消按钮 + TextView cancel = (TextView) view.findViewById(R.id.alertdialog_cannel); cancel.setText("取消"); - cancel.setOnClickListener(new OnClickListener() { + cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); - TextView confirem = (TextView) view - .findViewById(R.id.alertdialog_confirm); + + // 确定按钮 + TextView confirem = (TextView) view.findViewById(R.id.alertdialog_confirm); confirem.setText("确定"); - confirem.setOnClickListener(new OnClickListener() { + confirem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 跳转wifi管理界面 @@ -67,6 +68,7 @@ public class DialogUtils { dialog.dismiss(); } }); + dialog.setOnDismissListener(new Dialog.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { @@ -87,28 +89,30 @@ public class DialogUtils { isShowDeleteDialog = true; final Dialog dialog = new Dialog(context); - View view = View.inflate(context, - R.layout.search_history_delete_dialog, null); + View view = View.inflate(context, R.layout.search_history_delete_dialog, null); + + // 标题 TextView title = (TextView) view.findViewById(R.id.delete_dialog_title); title.setText("卸载"); - TextView content = (TextView) view - .findViewById(R.id.delete_dialog_message); + // 内容 + TextView content = (TextView) view.findViewById(R.id.delete_dialog_message); content.setText("您已安装了官方原版,该版本与插件版本冲突,是否卸载官方原版?"); - TextView cancel = (TextView) view - .findViewById(R.id.delete_dialog_cancel); + // 取消按钮 + TextView cancel = (TextView) view.findViewById(R.id.delete_dialog_cancel); cancel.setText("忽略"); - cancel.setOnClickListener(new OnClickListener() { + cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); - TextView confirem = (TextView) view - .findViewById(R.id.delete_dialog_confirm); + + // 确定按钮 + TextView confirem = (TextView) view.findViewById(R.id.delete_dialog_confirm); confirem.setText("卸载"); - confirem.setOnClickListener(new OnClickListener() { + confirem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); @@ -117,6 +121,7 @@ public class DialogUtils { } } }); + dialog.setOnDismissListener(new Dialog.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { @@ -131,24 +136,27 @@ public class DialogUtils { public static void showWarningDialog(Context context, String msg, final ConfiremListener listener) { final Dialog dialog = new Dialog(context); View view = View.inflate(context, R.layout.common_alertdialog, null); - TextView title = (TextView) view - .findViewById(R.id.alertdialog_title); - title.setText("下载提示"); - TextView content = (TextView) view.findViewById(R.id.alertdialog_content); + // 标题 + TextView title = (TextView) view.findViewById(R.id.alertdialog_title); + title.setText("下载提示"); + + // 内容 + TextView content = (TextView) view.findViewById(R.id.alertdialog_content); content.setText(msg); - TextView cancel = (TextView) view - .findViewById(R.id.alertdialog_cannel); + // 取消按钮 + TextView cancel = (TextView) view.findViewById(R.id.alertdialog_cannel); cancel.setText("取消"); - cancel.setOnClickListener(new OnClickListener() { + cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); - TextView confirem = (TextView) view - .findViewById(R.id.alertdialog_confirm); + + // 确定按钮 + TextView confirem = (TextView) view.findViewById(R.id.alertdialog_confirm); confirem.setText("继续"); confirem.setOnClickListener(new View.OnClickListener() { @Override @@ -159,6 +167,7 @@ public class DialogUtils { } } }); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(view); dialog.show(); @@ -171,19 +180,24 @@ public class DialogUtils { public static void showSuccessDialog(Context context) { final Dialog dialog = new Dialog(context); View view = View.inflate(context, R.layout.gamedetails_attention_dialog, null); + TextView title = (TextView) view.findViewById(R.id.dialog_title); title.setText("关注成功"); + + TextView message = (TextView) view.findViewById(R.id.dialog_message); + message.setText("游戏的最新动态消息会优先提醒您,包括攻略、资讯、开服信息、开测信息以及最新的插件。"); + + view.findViewById(R.id.dialog_rl_cancel).setVisibility(View.GONE); + TextView confirm = (TextView) view.findViewById(R.id.dialog_confirm); confirm.setText("我知道了"); - confirm.setOnClickListener(new OnClickListener() { + confirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); - TextView message = (TextView) view.findViewById(R.id.dialog_message); - message.setText("游戏的最新动态消息会优先提醒您,包括攻略、资讯、开服信息、开测信息以及最新的插件。"); - view.findViewById(R.id.dialog_rl_cancel).setVisibility(View.GONE); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(view); dialog.show(); @@ -192,21 +206,24 @@ public class DialogUtils { public static void showCancelDialog(Context context, final ConfiremListener listener) { final Dialog dialog = new Dialog(context); View view = View.inflate(context, R.layout.gamedetails_attention_dialog, null); + TextView title = (TextView) view.findViewById(R.id.dialog_title); title.setText("取消关注"); + + TextView message = (TextView) view.findViewById(R.id.dialog_message); + Spanned content = Html.fromHtml("取消关注游戏后,您将无法及时收到游戏的" + + "攻略、" + + "资讯等最新动态提醒,您确定取消吗?"); + message.setText(content); + TextView cancel = (TextView) view.findViewById(R.id.dialog_cancel); cancel.setText("取消"); - cancel.setOnClickListener(new OnClickListener() { + cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); - TextView message = (TextView) view.findViewById(R.id.dialog_message); - - Spanned content = Html - .fromHtml("取消关注游戏后,您将无法及时收到游戏的攻略资讯等最新动态提醒,您确定取消吗?"); - message.setText(content); view.findViewById(R.id.dialog_rl_confirm).setVisibility(View.VISIBLE); view.findViewById(R.id.dialog_confirm).setOnClickListener( @@ -219,6 +236,7 @@ public class DialogUtils { } } }); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(view); dialog.show(); @@ -228,26 +246,26 @@ public class DialogUtils { final DismissListener dListener) { final Dialog dialog = new Dialog(context); View view = View.inflate(context, R.layout.common_alertdialog, null); + TextView title = (TextView) view.findViewById(R.id.alertdialog_title); title.setText("插件化安装"); - TextView content = (TextView) view - .findViewById(R.id.alertdialog_content); + + TextView content = (TextView) view.findViewById(R.id.alertdialog_content); Spanned spanned = Html.fromHtml("您将进行插件化安装以实现插件功能,此过程将" + "卸载" + "当前使用的版本并" + "安装插件版本" + "。"); content.setText(spanned); - TextView cancel = (TextView) view - .findViewById(R.id.alertdialog_cannel); + TextView cancel = (TextView) view.findViewById(R.id.alertdialog_cannel); cancel.setText("取消"); - cancel.setOnClickListener(new OnClickListener() { + cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); - TextView confirm = (TextView) view - .findViewById(R.id.alertdialog_confirm); + + TextView confirm = (TextView) view.findViewById(R.id.alertdialog_confirm); confirm.setText("确定"); confirm.setOnClickListener(new OnClickListener() { @Override @@ -276,20 +294,22 @@ public class DialogUtils { public static void showDisclaimerDialog(Context context, String content) { final Dialog disclaimerDialog = new Dialog(context); View view = View.inflate(context, R.layout.setting_disclaimer_dialog, null); - TextView title = (TextView) view - .findViewById(R.id.disclaimer_dialog_title); + + TextView title = (TextView) view.findViewById(R.id.disclaimer_dialog_title); title.setText("免责声明"); - TextView message = (TextView) view - .findViewById(R.id.disclaimer_dialog_message); + + TextView message = (TextView) view.findViewById(R.id.disclaimer_dialog_message); Spanned spanned = Html.fromHtml(content); message.setText(spanned); + view.findViewById(R.id.disclaimer_dialog_confirm).setOnClickListener( - new OnClickListener() { + new View.OnClickListener() { @Override public void onClick(View v) { disclaimerDialog.dismiss(); } }); + disclaimerDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); disclaimerDialog.setContentView(view); disclaimerDialog.show(); diff --git a/app/src/main/java/com/gh/common/util/DisplayUtils.java b/app/src/main/java/com/gh/common/util/DisplayUtils.java index 3ef710bdd6..f13826c220 100644 --- a/app/src/main/java/com/gh/common/util/DisplayUtils.java +++ b/app/src/main/java/com/gh/common/util/DisplayUtils.java @@ -25,7 +25,7 @@ public class DisplayUtils { * 将px值转换为sp值,保证文字大小不变 * * @param pxValue - * @param fontScale + * @param pxValue * (DisplayMetrics类中属性scaledDensity) * @return */ @@ -38,7 +38,7 @@ public class DisplayUtils { * 将sp值转换为px值,保证文字大小不变 * * @param spValue - * @param fontScale + * @param spValue * (DisplayMetrics类中属性scaledDensity) * @return */ diff --git a/app/src/main/java/com/gh/common/util/DownloadItemUtils.java b/app/src/main/java/com/gh/common/util/DownloadItemUtils.java index 0641778d4e..ea3025f674 100644 --- a/app/src/main/java/com/gh/common/util/DownloadItemUtils.java +++ b/app/src/main/java/com/gh/common/util/DownloadItemUtils.java @@ -2,13 +2,13 @@ package com.gh.common.util; import android.content.Context; import android.content.Intent; +import android.graphics.Color; import android.os.Handler; import android.os.Message; import android.support.v4.util.ArrayMap; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.View; -import android.view.View.OnClickListener; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; @@ -39,19 +39,23 @@ import de.greenrobot.event.EventBus; public class DownloadItemUtils { + // 初始化gameMap public static void initializeGameMap(Context context, ArrayMap> gameMap) { gameMap.clear(); List list = DownloadManager.getInstance(context).getAll(); + String name; for (int i = 0, size = list.size(); i < size; i++) { - ArrayMap map = gameMap.get(list.get(i).getName()); + name = list.get(i).getName(); + ArrayMap map = gameMap.get(name); if (map == null) { - map = new ArrayMap(); + map = new ArrayMap<>(); + gameMap.put(name, map); } map.put(list.get(i).getMeta().get("platform"), list.get(i)); - gameMap.put(list.get(i).getName(), map); } } + // 更新下载进度条 public static void processDate(GameEntity detailedEntity, DownloadEntry downloadEntry, ArrayMap> platformMap, @@ -60,12 +64,13 @@ public class DownloadItemUtils { int index, ArrayMap statusMap) { - String platform = downloadEntry.getMeta().get("platform"); LinkedBlockingQueue queue = platformMap.get(downloadEntry.getName()); if (queue == null) { - queue = new LinkedBlockingQueue(); + queue = new LinkedBlockingQueue<>(); + platformMap.put(downloadEntry.getName(), queue); } + String platform = downloadEntry.getMeta().get("platform"); ArrayMap entryMap = detailedEntity.getEntryMap(); DownloadStatus status = downloadEntry.getStatus(); @@ -73,9 +78,8 @@ public class DownloadItemUtils { || status.equals(DownloadStatus.cancel) || status.equals(DownloadStatus.done)) { queue.remove(platform); - platformMap.put(downloadEntry.getName(), queue); if (entryMap == null) { - entryMap = new ArrayMap(); + entryMap = new ArrayMap<>(); detailedEntity.setEntryMap(entryMap); } entryMap.put(platform, downloadEntry); @@ -92,10 +96,9 @@ public class DownloadItemUtils { handler.sendMessageDelayed(msg, 3000); } } - platformMap.put(downloadEntry.getName(), queue); if (platform.equals(queue.peek())) { if (entryMap == null) { - entryMap = new ArrayMap(); + entryMap = new ArrayMap<>(); detailedEntity.setEntryMap(entryMap); } entryMap.put(platform, downloadEntry); @@ -106,6 +109,231 @@ public class DownloadItemUtils { } } + // 更新正常的条目,只有一个apk包 + public static void updateNormalItem(Context context, + TextView textView, + ProgressBar game_progressbar, + LinearLayout game_ll_info, + TextView download_speed, + TextView download_percentage, + TextView downloadBtn, + GameEntity entity, + ArrayMap statusMap, + boolean isShowPlatform) { + + String pluginPlatform = entity.getPluginPlatform(); + + ArrayMap entryMap = entity.getEntryMap(); + if (entryMap != null && !entryMap.isEmpty()) { + + DownloadEntry downloadEntry = entryMap.get(entity.getApk().get(0).getPlatform()); + + if (downloadEntry != null && (pluginPlatform == null + || pluginPlatform.equals(PlatformUtils.getInstance(context) + .getPlatformName(downloadEntry.getMeta().get("platform"))))) { + // 更改进度条和提示文本的状态 + changeStatus(context, textView, game_progressbar, game_ll_info, download_speed, download_percentage, downloadBtn, + statusMap, downloadEntry, isShowPlatform, true); + return; + } + } + + textView.setVisibility(View.VISIBLE); + game_progressbar.setVisibility(View.GONE); + game_ll_info.setVisibility(View.GONE); + + downloadBtn.setTextColor(Color.WHITE); + if (pluginPlatform != null) { + downloadBtn.setText("插件化"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style); + } else if (PackageManager.isInstalled(entity.getApk().get(0).getPackageName())) { + if (PackageManager.isCanUpdate(entity.getApk().get(0).getPackageName())) { + downloadBtn.setText("更新"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); + } else { + downloadBtn.setText("启动"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_launch_style); + } + } else { + downloadBtn.setText("下载"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); + } + + } + + // 更新插件的条目,有多个apk包 + public static void updatePluginItem(Context context, + TextView textView, + ProgressBar game_progressbar, + LinearLayout game_ll_info, + TextView download_speed, + TextView download_percentage, + TextView downloadBtn, + GameEntity entity, + ArrayMap> platformMap, + ArrayMap statusMap, + boolean isShowPlatform) { + + ArrayMap entryMap = entity.getEntryMap(); + + // 更新下载按钮状态 + int doneCount = 0; // 下载完成数量 + int updateCount = 0; // 可更新数量 + int installCount = 0; // 已安装数量 + int pluginCount = 0; // 可插件化数量 + if (entryMap != null && !entryMap.isEmpty()) { + for (String key : entryMap.keySet()) { + if (entryMap.get(key).getStatus().equals(DownloadStatus.done)) { + doneCount++; + } + } + } + + for (ApkEntity apkEntity : entity.getApk()) { + if (PackageManager.isCanUpdate(apkEntity.getPackageName())) { + updateCount++; + } + } + + PackageManager packageManager = new PackageManager(context); + for (ApkEntity apkEntity : entity.getApk()) { + if (PackageManager.isInstalled(apkEntity.getPackageName())) { + if (!packageManager.isSignature(apkEntity.getPackageName())) { + pluginCount++; + } else { + installCount++; + } + } + } + + downloadBtn.setTextColor(Color.WHITE); + if (doneCount != 0) { + downloadBtn.setText("安装"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); + } else if (updateCount != 0) { + downloadBtn.setText("更新"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); + } else if (installCount != 0) { + downloadBtn.setText("打开"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_launch_style); + } else if (pluginCount != 0) { + downloadBtn.setText("插件化"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style); + } else { + downloadBtn.setText("下载"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); + } + + if (entryMap != null && !entryMap.isEmpty()) { + + DownloadEntry downloadEntry; + + LinkedBlockingQueue queue = platformMap.get(entity.getName()); + if (queue != null && !queue.isEmpty()) { + downloadEntry = entryMap.get(queue.peek()); + } else { + downloadEntry = entryMap.get(entryMap.keyAt(0)); + } + + if (downloadEntry != null) { + // 更改进度条和提示文本的状态 + changeStatus(context, textView, game_progressbar, game_ll_info, download_speed, + download_percentage, downloadBtn, statusMap, downloadEntry, isShowPlatform, false); + return; + } + } + + textView.setVisibility(View.VISIBLE); + game_progressbar.setVisibility(View.GONE); + game_ll_info.setVisibility(View.GONE); + } + + // 更改进度条和提示文本的状态 + public static void changeStatus(Context context, + TextView textView, + ProgressBar game_progressbar, + LinearLayout game_ll_info, + TextView download_speed, + TextView download_percentage, + TextView downloadBtn, + ArrayMap statusMap, + DownloadEntry downloadEntry, + boolean isShowPlatform, + boolean isNormal) { + textView.setVisibility(View.GONE); + game_progressbar.setVisibility(View.VISIBLE); + game_ll_info.setVisibility(View.VISIBLE); + + String platform = PlatformUtils.getInstance(context) + .getPlatformName(downloadEntry.getMeta().get("platform")); + + DownloadStatus status = downloadEntry.getStatus(); + if (status.equals(DownloadStatus.downloading)) { + if (!"pause".equals(statusMap.get(downloadEntry.getUrl()))) { + game_progressbar.setProgress((int) (downloadEntry.getPercent() * 10)); + if (isShowPlatform && platform != null) { + download_speed.setText(String.format("%s - %s(剩%s)", platform, + SpeedUtils.getSpeed(downloadEntry.getSpeed()), + SpeedUtils.getRemainTime(downloadEntry.getSize(), downloadEntry.getProgress(), downloadEntry.getSpeed() * 1024))); + } else { + download_speed.setText(String.format("%s(剩%s)", SpeedUtils.getSpeed(downloadEntry.getSpeed()), + SpeedUtils.getRemainTime(downloadEntry.getSize(), downloadEntry.getProgress(), downloadEntry.getSpeed() * 1024))); + } + download_percentage.setText(downloadEntry.getPercent() + "%"); + } + + if (isNormal) { + downloadBtn.setText("下载中"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style); + downloadBtn.setTextColor(context.getResources().getColor(R.color.theme)); + } + } else if (status.equals(DownloadStatus.waiting)) { + game_progressbar.setProgress((int) (downloadEntry.getPercent() * 10)); + if (isShowPlatform && platform != null) { + download_speed.setText(String.format("%s - 等待", platform)); + } else { + download_speed.setText("等待"); + } + download_percentage.setText(downloadEntry.getPercent() + "%"); + + if (isNormal) { + downloadBtn.setText("下载中"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style); + downloadBtn.setTextColor(context.getResources().getColor(R.color.theme)); + } + } else if (status.equals(DownloadStatus.pause) + || status.equals(DownloadStatus.timeout) + || status.equals(DownloadStatus.neterror)) { + game_progressbar.setProgress((int) (downloadEntry.getPercent() * 10)); + if (isShowPlatform && platform != null) { + download_speed.setText(String.format("%s - 暂停", platform)); + } else { + download_speed.setText("暂停"); + } + download_percentage.setText(downloadEntry.getPercent() + "%"); + + if (isNormal) { + downloadBtn.setText("下载中"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style); + downloadBtn.setTextColor(context.getResources().getColor(R.color.theme)); + } + } else if (status.equals(DownloadStatus.done)) { + game_progressbar.setProgress(1000); + if (isShowPlatform && platform != null) { + download_speed.setText(String.format("%s - 下载完成", platform)); + } else { + download_speed.setText("下载完成"); + } + download_percentage.setText("100%"); + + if (isNormal) { + downloadBtn.setText("安装"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); + downloadBtn.setTextColor(Color.WHITE); + } + } + } + public static void updateItem(Context context, TextView textView, ProgressBar game_progressbar, @@ -125,182 +353,19 @@ public class DownloadItemUtils { downloadBtn.setVisibility(View.GONE); } - DownloadEntry downloadEntry = null; - - ArrayMap entryMap = entity.getEntryMap(); - if (entryMap != null && !entryMap.isEmpty()) { - - LinkedBlockingQueue queue = platformMap.get(entity.getName()); - - if (queue != null && !queue.isEmpty()) { - downloadEntry = entryMap.get(queue.peek()); - } else { - downloadEntry = entryMap.get(entryMap.keyAt(0)); - } - - String pluginPlatform = entity.getPluginPlatform(); - - if (downloadEntry != null && (pluginPlatform == null - || pluginPlatform.equals(PlatformUtils.getInstance(context) - .getPlatformName(downloadEntry.getMeta().get("platform"))))) { - textView.setVisibility(View.GONE); - game_progressbar.setVisibility(View.VISIBLE); - game_ll_info.setVisibility(View.VISIBLE); - - String platform = PlatformUtils.getInstance(context) - .getPlatformName(downloadEntry.getMeta().get("platform")); - - game_progressbar.setProgress((int) (downloadEntry.getPercent() * 10)); - - DownloadStatus status = downloadEntry.getStatus(); - if (status.equals(DownloadStatus.downloading)) { - if (!"pause".equals(statusMap.get(downloadEntry.getUrl()))) { - if (isShowPlatform && platform != null) { - download_speed.setText(String.format("%s - %s(剩%s)", platform, - SpeedUtils.getSpeed(downloadEntry.getSpeed()), - SpeedUtils.getRemainTime(downloadEntry.getSize(), downloadEntry.getProgress(), downloadEntry.getSpeed() * 1024))); - } else { - download_speed.setText(String.format("%s(剩%s)", SpeedUtils.getSpeed(downloadEntry.getSpeed()), - SpeedUtils.getRemainTime(downloadEntry.getSize(), downloadEntry.getProgress(), downloadEntry.getSpeed() * 1024))); - } - download_percentage.setText(downloadEntry.getPercent() + "%"); - } - } else if (status.equals(DownloadStatus.waiting)) { - if (isShowPlatform && platform != null) { - download_speed.setText(String.format("%s - 等待", platform)); - } else { - download_speed.setText("等待"); - } - download_percentage.setText(downloadEntry.getPercent() + "%"); - } else if (status.equals(DownloadStatus.pause) - || status.equals(DownloadStatus.timeout) - || status.equals(DownloadStatus.neterror)) { - if (isShowPlatform && platform != null) { - download_speed.setText(String.format("%s - 暂停", platform)); - } else { - download_speed.setText("暂停"); - } - download_percentage.setText(downloadEntry.getPercent() + "%"); - } else if (status.equals(DownloadStatus.done)) { - if (isShowPlatform && platform != null) { - download_speed.setText(String.format("%s - 下载完成", platform)); - } else { - download_speed.setText("下载完成"); - } - download_percentage.setText("100%"); - } else if (status.equals(DownloadStatus.cancel) - || status.equals(DownloadStatus.hijack)) { - textView.setVisibility(View.VISIBLE); - game_progressbar.setVisibility(View.GONE); - game_ll_info.setVisibility(View.GONE); - } - } else { - textView.setVisibility(View.VISIBLE); - game_progressbar.setVisibility(View.GONE); - game_ll_info.setVisibility(View.GONE); - } - } else { + if (entity.getApk() == null || entity.getApk().isEmpty()) { textView.setVisibility(View.VISIBLE); game_progressbar.setVisibility(View.GONE); game_ll_info.setVisibility(View.GONE); - } - - if (entity.getApk() == null) { - downloadBtn.setText("下载"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); - downloadBtn.setTextColor(0xFFFFFFFF); + downloadBtn.setVisibility(View.GONE); } else if (entity.getApk().size() == 1) { - String pluginPlatform = entity.getPluginPlatform(); - if (downloadEntry != null && (pluginPlatform == null - || pluginPlatform.equals(PlatformUtils.getInstance(context) - .getPlatformName(downloadEntry.getMeta().get("platform"))))) { - DownloadStatus status = downloadEntry.getStatus(); - if (status.equals(DownloadStatus.downloading) - || status.equals(DownloadStatus.waiting) - || status.equals(DownloadStatus.pause) - || status.equals(DownloadStatus.timeout) - || status.equals(DownloadStatus.neterror)) { - downloadBtn.setText("下载中"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style); - downloadBtn.setTextColor(0xFF1BA4FC); - } else if (status.equals(DownloadStatus.done)) { - downloadBtn.setText("安装"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } - } else { - if (pluginPlatform != null) { - downloadBtn.setText("插件化"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } else if (PackageManager.isInstalled(entity.getApk().get(0).getPackageName())) { - if (PackageManager.isCanUpdate(entity.getApk().get(0).getPackageName())) { - downloadBtn.setText("更新"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } else { - downloadBtn.setText("启动"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_launch_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } - } else { - downloadBtn.setText("下载"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } - } + updateNormalItem(context, textView, game_progressbar, game_ll_info, download_speed, + download_percentage, downloadBtn, entity, statusMap, isShowPlatform); } else { - int doneCount = 0; - int updateCount = 0; - int installCount = 0; - int pluginCount = 0; - if (entryMap != null && !entryMap.isEmpty()) { - for (String key : entryMap.keySet()) { - if (entryMap.get(key).getStatus().equals(DownloadStatus.done)) { - doneCount++; - } - } - } - - for (ApkEntity apkEntity : entity.getApk()) { - if (PackageManager.isCanUpdate(apkEntity.getPackageName())) { - updateCount++; - } - } - - PackageManager packageManager = new PackageManager(context); - for (ApkEntity apkEntity : entity.getApk()) { - if (PackageManager.isInstalled(apkEntity.getPackageName())) { - if (!packageManager.isSignature(apkEntity.getPackageName())) { - pluginCount++; - } else { - installCount++; - } - } - } - - if (doneCount != 0) { - downloadBtn.setText("安装"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } else if (updateCount != 0) { - downloadBtn.setText("更新"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } else if (installCount != 0) { - downloadBtn.setText("打开"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_launch_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } else if (pluginCount != 0) { - downloadBtn.setText("插件化"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } else { - downloadBtn.setText("下载"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style); - downloadBtn.setTextColor(0xFFFFFFFF); - } + updatePluginItem(context, textView, game_progressbar, game_ll_info, download_speed, + download_percentage, downloadBtn, entity, platformMap, statusMap, isShowPlatform); } + } public static void updateItem(Context context, @@ -317,6 +382,99 @@ public class DownloadItemUtils { download_percentage, downloadBtn, entity, platformMap, statusMap, true); } + public static void setNormalOnClickListener(final Context context, + final TextView downloadBtn, + final GameEntity entity, + final int position, + final RecyclerView.Adapter adapter, + final ArrayMap statusMap, + final String entrance) { + downloadBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String str = downloadBtn.getText().toString(); + if ("下载".equals(str)) { + if (NetworkUtils.isWifiConnected(context)) { + download(context, entity, downloadBtn, statusMap, entrance); + } else { + DialogUtils.showWarningDialog(context, new DialogUtils.ConfiremListener() { + @Override + public void onConfirem() { + download(context, entity, downloadBtn, statusMap, entrance); + } + }); + } + } else if ("插件化".equals(str)) { + if (NetworkUtils.isWifiConnected(context)) { + plugin(context, entity, downloadBtn, statusMap, entrance); + } else { + DialogUtils.showWarningDialog(context, new DialogUtils.ConfiremListener() { + @Override + public void onConfirem() { + plugin(context, entity, downloadBtn, statusMap, entrance); + } + }); + } + } else if ("安装".equals(str)) { + install(context, entity, position, adapter); + } else if ("启动".equals(str)) { + Map kv = new HashMap(); + kv.put("版本", entity.getApk().get(0).getPlatform()); + DataUtils.onEvent(context, "游戏启动", entity.getName(), kv); + + PackageUtils.launchApplicationByPackageName(context, entity.getApk().get(0).getPackageName()); + } else if ("下载中".equals(str)) { + context.startActivity(new Intent(context, DownloadManagerActivity.class)); + } else if ("更新".equals(str)) { + if (NetworkUtils.isWifiConnected(context)) { + update(context, entity); + } else { + DialogUtils.showWarningDialog(context, new DialogUtils.ConfiremListener() { + @Override + public void onConfirem() { + update(context, entity); + } + }); + } + } + } + }); + } + + public static void setPluginOnClickListener(final Context context, + final TextView downloadBtn, + final TextView download_speed, + final TextView download_percentage, + final GameEntity entity, + final ArrayMap statusMap, + final String entrance, + final DismissEntity dismissEntity, + final String location) { + downloadBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(final View v) { + if (NetworkUtils.isWifiConnected(context)) { + if (!dismissEntity.isShow()) { + dismissEntity.setShow(true); + DownloadDialog.getInstance(context).showPopupWindow( + v, entity, entrance, statusMap, download_speed, download_percentage, location); + } + } else { + DialogUtils.showWarningDialog(context, new DialogUtils.ConfiremListener() { + @Override + public void onConfirem() { + if (!dismissEntity.isShow()) { + dismissEntity.setShow(true); + DownloadDialog.getInstance(context).showPopupWindow( + v, entity, entrance, statusMap, download_speed, download_percentage, location); + } + } + }); + } + } + }); + } + public static void setOnClickListener(Context context, TextView downloadBtn, TextView download_speed, @@ -334,133 +492,51 @@ public class DownloadItemUtils { dismissEntity, location); } - public static void setOnClickListener(final Context context, - final TextView downloadBtn, - final TextView download_speed, - final TextView download_percentage, - final GameEntity entity, - final int position, - final RecyclerView.Adapter adapter, - final ArrayMap statusMap, - final ArrayMap> platformMap, - final String entrance, - final boolean isShowPlatform, - final DismissEntity dismissEntity, - final String location) { - downloadBtn.setOnClickListener(new OnClickListener() { - @Override - public void onClick(final View viewBtn) { - String str = downloadBtn.getText().toString(); - if ("下载".equals(str)) { - if (entity.getApk() == null || entity.getApk().isEmpty()) { - Toast.makeText(context, "稍等片刻~!游戏正在上传中...", Toast.LENGTH_SHORT).show(); - } else { - if (NetworkUtils.isWifiConnected(context)) { - download(context, entity, downloadBtn, statusMap, dismissEntity, - download_speed, download_percentage, viewBtn, entrance, location); - } else { - DialogUtils.showWarningDialog(context, new DialogUtils.ConfiremListener() { - @Override - public void onConfirem() { - download(context, entity, downloadBtn, statusMap, dismissEntity, - download_speed, download_percentage, viewBtn, entrance, location); - } - }); - } - } - } else if ("插件化".equals(str)) { - if (NetworkUtils.isWifiConnected(context)) { - plugin(context, entity, downloadBtn, statusMap, dismissEntity, - download_speed, download_percentage,viewBtn, entrance, location); - } else { - DialogUtils.showWarningDialog(context, new DialogUtils.ConfiremListener() { - @Override - public void onConfirem() { - plugin(context, entity, downloadBtn, statusMap, dismissEntity, - download_speed, download_percentage,viewBtn, entrance, location); - } - }); - } - } else if ("安装".equals(str)) { - if (entity.getApk().size() == 1) { - install(context, entity, position, adapter); - } else { - if (!dismissEntity.isShow()) { - dismissEntity.setShow(true); - DownloadDialog.getInstance(context).showPopupWindow( - viewBtn, entity, entrance, statusMap, download_speed, download_percentage, location); - } - } - } else if ("启动".equals(str)) { - Map kv = new HashMap(); - kv.put("版本", entity.getApk().get(0).getPlatform()); - DataUtils.onEvent(context, "游戏启动", entity.getName(), kv); + public static void setOnClickListener(Context context, + TextView downloadBtn, + TextView download_speed, + TextView download_percentage, + GameEntity entity, + int position, + RecyclerView.Adapter adapter, + ArrayMap statusMap, + ArrayMap> platformMap, + String entrance, + boolean isShowPlatform, + DismissEntity dismissEntity, + String location) { + + if (entity.getApk().size() == 1) { + setNormalOnClickListener(context, downloadBtn, entity, position, adapter, statusMap, entrance); + } else { + setPluginOnClickListener(context, downloadBtn, download_speed, download_percentage, entity, + statusMap, entrance, dismissEntity, location); + } - PackageUtils.launchApplicationByPackageName(context, entity.getApk().get(0).getPackageName()); - } else if ("下载中".equals(str)) { - context.startActivity(new Intent(context, DownloadManagerActivity.class)); - } else if ("打开".equals(str)) { - if (!dismissEntity.isShow()) { - dismissEntity.setShow(true); - DownloadDialog.getInstance(context).showPopupWindow( - viewBtn, entity, entrance, statusMap, download_speed, download_percentage, location); - } - } else if ("更新".equals(str)) { - if (NetworkUtils.isWifiConnected(context)) { - update(context, entity, statusMap, dismissEntity, - download_speed, download_percentage, viewBtn, entrance, location); - } else { - DialogUtils.showWarningDialog(context, new DialogUtils.ConfiremListener() { - @Override - public void onConfirem() { - update(context, entity, statusMap, dismissEntity, - download_speed, download_percentage, viewBtn, entrance, location); - } - }); - } - } - } - }); } //更新 - private static void update(Context context, - GameEntity entity, - ArrayMap statusMap, - DismissEntity dismissEntity, - TextView download_speed, - TextView download_percentage, - View viewBtn, - String entrance, - String location) { - if (entity.getApk().size() == 1) { - ApkEntity apkEntity = entity.getApk().get(0); - //下载可更新游戏 - Map kv = new HashMap(); - kv.put("版本", apkEntity.getPlatform()); - kv.put("状态", "下载开始"); - DataUtils.onEvent(context, "游戏更新", entity.getName(), kv); + private static void update(Context context, GameEntity entity) { + ApkEntity apkEntity = entity.getApk().get(0); + //下载可更新游戏 + Map kv = new HashMap(); + kv.put("版本", apkEntity.getPlatform()); + kv.put("状态", "下载开始"); + DataUtils.onEvent(context, "游戏更新", entity.getName(), kv); - DownloadEntry entry = new DownloadEntry(); - entry.setUrl(apkEntity.getUrl()); - entry.setName(entity.getName()); - entry.setPath(FileUtils.getDownloadPath(context, - MD5Utils.getContentMD5( - entity.getName() + "_" + System.currentTimeMillis()) + ".apk")); - HashMap meta = new HashMap(); - meta.put("ETag", apkEntity.getEtag()); - meta.put("icon", entity.getIcon()); - meta.put("platform", apkEntity.getPlatform()); - meta.put("isUpdate", "true"); - entry.setMeta(meta); - DownloadManager.getInstance(context).add(entry); - } else { - if (!dismissEntity.isShow()) { - dismissEntity.setShow(true); - DownloadDialog.getInstance(context).showPopupWindow( - viewBtn, entity, entrance, statusMap, download_speed, download_percentage, location); - } - } + DownloadEntry entry = new DownloadEntry(); + entry.setUrl(apkEntity.getUrl()); + entry.setName(entity.getName()); + entry.setPath(FileUtils.getDownloadPath(context, + MD5Utils.getContentMD5( + entity.getName() + "_" + System.currentTimeMillis()) + ".apk")); + HashMap meta = new HashMap(); + meta.put("ETag", apkEntity.getEtag()); + meta.put("icon", entity.getIcon()); + meta.put("platform", apkEntity.getPlatform()); + meta.put("isUpdate", "true"); + entry.setMeta(meta); + DownloadManager.getInstance(context).add(entry); } //下载 @@ -468,74 +544,61 @@ public class DownloadItemUtils { GameEntity entity, TextView downloadBtn, ArrayMap statusMap, - DismissEntity dismissEntity, - TextView download_speed, - TextView download_percentage, - View viewBtn, - String entrance, - String location) { - if (entity.getApk().size() == 1) { - String msg = FileUtils.isCanDownload(entity.getApk().get(0).getSize()); - if (TextUtils.isEmpty(msg)) { - Map kv = new HashMap(); - kv.put("版本", entity.getApk().get(0).getPlatform()); - kv.put("状态", "下载开始"); - DataUtils.onEvent(context, "游戏下载", entity.getName(), kv); + String entrance) { + String msg = FileUtils.isCanDownload(entity.getApk().get(0).getSize()); + if (TextUtils.isEmpty(msg)) { + Map kv = new HashMap(); + kv.put("版本", entity.getApk().get(0).getPlatform()); + kv.put("状态", "下载开始"); + DataUtils.onEvent(context, "游戏下载", entity.getName(), kv); - Map kv2 = new HashMap(); - kv2.put("版本", entity.getApk().get(0).getPlatform()); - kv2.put("状态", "下载开始"); - kv2.put("位置", entrance + "-开始"); - DataUtils.onEvent(context, "游戏下载位置", entity.getName(), kv2); + Map kv2 = new HashMap(); + kv2.put("版本", entity.getApk().get(0).getPlatform()); + kv2.put("状态", "下载开始"); + kv2.put("位置", entrance + "-开始"); + DataUtils.onEvent(context, "游戏下载位置", entity.getName(), kv2); - Map kv3 = new HashMap(); - kv3.put(entrance, "下载数"); - kv3.put(entrance, "下载开始"); - DataUtils.onEvent(context, "应用数据", entity.getName(), kv3); + Map kv3 = new HashMap(); + kv3.put(entrance, "下载数"); + kv3.put(entrance, "下载开始"); + DataUtils.onEvent(context, "应用数据", entity.getName(), kv3); - if ("主页-最新插件".equals(entrance)) { - Map kv4 = new HashMap(); - kv4.put(entity.getName(), "下载数"); - DataUtils.onEvent(context, "主页数据", "最新插件", kv4); - } else if ("主页-热门卡牌".equals(entrance)) { - Map kv4 = new HashMap(); - kv4.put(entity.getName(), "下载数"); - DataUtils.onEvent(context, "主页数据", "热门卡牌", kv4); - } else if ("主页-新测卡牌".equals(entrance)) { - Map kv4 = new HashMap(); - kv4.put(entity.getName(), "下载数"); - DataUtils.onEvent(context, "主页数据", "新测卡牌", kv4); - } - - Map map = new HashMap(); - map.put("game", entity.getName()); - map.put("method", "正常"); - map.put("platform", PlatformUtils.getInstance(context) - .getPlatformName(entity.getApk().get(0).getPlatform())); - map.put("status", "开始"); - map.put("location", "游戏详情:" + entity.getName()); - map.put("from", entrance); - map.put("network", NetworkUtils.getConnectedType(context)); - map.put("createdOn", System.currentTimeMillis() / 1000); - DataCollectionManager.onEvent(context, "download", map); - - addDownloadEntry(context, entity, 0, entrance); - Toast.makeText(context, entity.getName() + "已加入下载队列", Toast.LENGTH_SHORT).show(); - downloadBtn.setText("下载中"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style); - downloadBtn.setTextColor(0xFF1BA4FC); - EventBus.getDefault().post(new EBRedDot(1)); - - statusMap.put(entity.getApk().get(0).getUrl(), "downloading"); - } else { - Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); + if ("主页-最新插件".equals(entrance)) { + Map kv4 = new HashMap(); + kv4.put(entity.getName(), "下载数"); + DataUtils.onEvent(context, "主页数据", "最新插件", kv4); + } else if ("主页-热门卡牌".equals(entrance)) { + Map kv4 = new HashMap(); + kv4.put(entity.getName(), "下载数"); + DataUtils.onEvent(context, "主页数据", "热门卡牌", kv4); + } else if ("主页-新测卡牌".equals(entrance)) { + Map kv4 = new HashMap(); + kv4.put(entity.getName(), "下载数"); + DataUtils.onEvent(context, "主页数据", "新测卡牌", kv4); } + + Map map = new HashMap(); + map.put("game", entity.getName()); + map.put("method", "正常"); + map.put("platform", PlatformUtils.getInstance(context) + .getPlatformName(entity.getApk().get(0).getPlatform())); + map.put("status", "开始"); + map.put("location", "游戏详情:" + entity.getName()); + map.put("from", entrance); + map.put("network", NetworkUtils.getConnectedType(context)); + map.put("createdOn", System.currentTimeMillis() / 1000); + DataCollectionManager.onEvent(context, "download", map); + + addDownloadEntry(context, entity, 0, entrance); + Toast.makeText(context, entity.getName() + "已加入下载队列", Toast.LENGTH_SHORT).show(); + downloadBtn.setText("下载中"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style); + downloadBtn.setTextColor(context.getResources().getColor(R.color.theme)); + EventBus.getDefault().post(new EBRedDot(1)); + + statusMap.put(entity.getApk().get(0).getUrl(), "downloading"); } else { - if (!dismissEntity.isShow()) { - dismissEntity.setShow(true); - DownloadDialog.getInstance(context).showPopupWindow( - viewBtn, entity, entrance, statusMap, download_speed, download_percentage, location); - } + Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); } } @@ -544,74 +607,61 @@ public class DownloadItemUtils { GameEntity entity, TextView downloadBtn, ArrayMap statusMap, - DismissEntity dismissEntity, - TextView download_speed, - TextView download_percentage, - View viewBtn, - String entrance, - String location) { - if (entity.getApk().size() == 1) { - String msg = FileUtils.isCanDownload(entity.getApk().get(0).getSize()); - if (TextUtils.isEmpty(msg)) { - Map kv = new HashMap(); - kv.put("版本", entity.getApk().get(0).getPlatform()); - kv.put("状态", "下载开始"); - DataUtils.onEvent(context, "游戏下载", entity.getName(), kv); + String entrance) { + String msg = FileUtils.isCanDownload(entity.getApk().get(0).getSize()); + if (TextUtils.isEmpty(msg)) { + Map kv = new HashMap(); + kv.put("版本", entity.getApk().get(0).getPlatform()); + kv.put("状态", "下载开始"); + DataUtils.onEvent(context, "游戏下载", entity.getName(), kv); - Map kv2 = new HashMap(); - kv2.put("版本", entity.getApk().get(0).getPlatform()); - kv2.put("状态", "下载开始"); - kv2.put("位置", entrance + "-开始"); - DataUtils.onEvent(context, "游戏下载位置", entity.getName(), kv2); + Map kv2 = new HashMap(); + kv2.put("版本", entity.getApk().get(0).getPlatform()); + kv2.put("状态", "下载开始"); + kv2.put("位置", entrance + "-开始"); + DataUtils.onEvent(context, "游戏下载位置", entity.getName(), kv2); - Map kv3 = new HashMap(); - kv3.put(entrance, "下载数"); - kv3.put(entrance, "下载开始"); - DataUtils.onEvent(context, "应用数据", entity.getName(), kv3); + Map kv3 = new HashMap(); + kv3.put(entrance, "下载数"); + kv3.put(entrance, "下载开始"); + DataUtils.onEvent(context, "应用数据", entity.getName(), kv3); - if ("主页-最新插件".equals(entrance)) { - Map kv4 = new HashMap(); - kv4.put(entity.getName(), "下载数"); - DataUtils.onEvent(context, "主页数据", "最新插件", kv4); - } else if ("主页-热门卡牌".equals(entrance)) { - Map kv4 = new HashMap(); - kv4.put(entity.getName(), "下载数"); - DataUtils.onEvent(context, "主页数据", "热门卡牌", kv4); - } else if ("主页-新测卡牌".equals(entrance)) { - Map kv4 = new HashMap(); - kv4.put(entity.getName(), "下载数"); - DataUtils.onEvent(context, "主页数据", "新测卡牌", kv4); - } - - Map map = new HashMap(); - map.put("game", entity.getName()); - map.put("method", "正常"); - map.put("platform", PlatformUtils.getInstance(context) - .getPlatformName(entity.getApk().get(0).getPlatform())); - map.put("status", "开始"); - map.put("location", "游戏详情:" + entity.getName()); - map.put("from", entrance); - map.put("network", NetworkUtils.getConnectedType(context)); - map.put("createdOn", System.currentTimeMillis() / 1000); - DataCollectionManager.onEvent(context, "download", map); - - addDownloadEntry(context, entity, 0, entrance); - Toast.makeText(context, entity.getName() + "已加入下载队列", Toast.LENGTH_SHORT).show(); - downloadBtn.setText("下载中"); - downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style); - downloadBtn.setTextColor(0xFF1BA4FC); - EventBus.getDefault().post(new EBRedDot(1)); - - statusMap.put(entity.getApk().get(0).getUrl(), "downloading"); - } else { - Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); + if ("主页-最新插件".equals(entrance)) { + Map kv4 = new HashMap(); + kv4.put(entity.getName(), "下载数"); + DataUtils.onEvent(context, "主页数据", "最新插件", kv4); + } else if ("主页-热门卡牌".equals(entrance)) { + Map kv4 = new HashMap(); + kv4.put(entity.getName(), "下载数"); + DataUtils.onEvent(context, "主页数据", "热门卡牌", kv4); + } else if ("主页-新测卡牌".equals(entrance)) { + Map kv4 = new HashMap(); + kv4.put(entity.getName(), "下载数"); + DataUtils.onEvent(context, "主页数据", "新测卡牌", kv4); } + + Map map = new HashMap(); + map.put("game", entity.getName()); + map.put("method", "正常"); + map.put("platform", PlatformUtils.getInstance(context) + .getPlatformName(entity.getApk().get(0).getPlatform())); + map.put("status", "开始"); + map.put("location", "游戏详情:" + entity.getName()); + map.put("from", entrance); + map.put("network", NetworkUtils.getConnectedType(context)); + map.put("createdOn", System.currentTimeMillis() / 1000); + DataCollectionManager.onEvent(context, "download", map); + + addDownloadEntry(context, entity, 0, entrance); + Toast.makeText(context, entity.getName() + "已加入下载队列", Toast.LENGTH_SHORT).show(); + downloadBtn.setText("下载中"); + downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style); + downloadBtn.setTextColor(context.getResources().getColor(R.color.theme)); + EventBus.getDefault().post(new EBRedDot(1)); + + statusMap.put(entity.getApk().get(0).getUrl(), "downloading"); } else { - if (!dismissEntity.isShow()) { - dismissEntity.setShow(true); - DownloadDialog.getInstance(context).showPopupWindow( - viewBtn, entity, entrance, statusMap, download_speed, download_percentage, location); - } + Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); } } @@ -645,7 +695,7 @@ public class DownloadItemUtils { } } - public static void addDownloadEntry(Context context, GameEntity game, int position, String entrance) { + private static void addDownloadEntry(Context context, GameEntity game, int position, String entrance) { ApkEntity apkEntity = game.getApk().get(position); diff --git a/app/src/main/java/com/gh/common/util/FileUtils.java b/app/src/main/java/com/gh/common/util/FileUtils.java index 5a9708a326..b664b43a84 100644 --- a/app/src/main/java/com/gh/common/util/FileUtils.java +++ b/app/src/main/java/com/gh/common/util/FileUtils.java @@ -134,9 +134,7 @@ public class FileUtils { @SuppressWarnings("deprecation") public static float getFreeSpaceByPath(String path) { StatFs statfs = new StatFs(path); - long blockSize = statfs.getBlockSize(); - long availableBlocks = statfs.getAvailableBlocks(); return availableBlocks * blockSize / 1024f / 1024f; @@ -168,8 +166,7 @@ public class FileUtils { DataInputStream dis = null; FileOutputStream fos = null; try { - HttpURLConnection connection = (HttpURLConnection) new URL(url) - .openConnection(); + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(5 * 1000); connection.setReadTimeout(5 * 1000); diff --git a/app/src/main/java/com/gh/common/util/GameViewUtils.java b/app/src/main/java/com/gh/common/util/GameViewUtils.java index fc6a4975a5..ca52a764d1 100644 --- a/app/src/main/java/com/gh/common/util/GameViewUtils.java +++ b/app/src/main/java/com/gh/common/util/GameViewUtils.java @@ -1,7 +1,6 @@ package com.gh.common.util; import android.content.Context; -import android.graphics.Color; import android.util.TypedValue; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; @@ -27,50 +26,53 @@ import java.util.TimeZone; */ public class GameViewUtils { - public static void setLabelList(Context context, LinearLayout labelLayout, - List tag) { + public static void setLabelList(Context context, LinearLayout labelLayout, List tag) { labelLayout.removeAllViews(); if (tag == null || tag.isEmpty()) { - labelLayout.addView(getGameTagView(context, "官方版")); + labelLayout.addView(getGameTagView(context, "官方版", 0)); } else { for (int i = 0, size = tag.size() > 3 ? 3 : tag.size(); i < size; i++) { - labelLayout.addView(getGameTagView(context, tag.get(i))); + if (i == size - 1) { + labelLayout.addView(getGameTagView(context, tag.get(i), 0)); + } else { + labelLayout.addView(getGameTagView(context, tag.get(i), DisplayUtils.dip2px(context, 5))); + } } } } // 获取游戏标签列表视图 - public static void setLabelList(Context context, LinearLayout labelLayout, - String tag) { + public static void setLabelList(Context context, LinearLayout labelLayout, String tag) { labelLayout.removeAllViews(); // 添加tag标签 if (tag != null && !tag.isEmpty()) { String[] tags = tag.split(","); for (int i = 0; i < tags.length; i++) { - labelLayout.addView(getGameTagView(context, tags[i])); + if (i == tags.length - 1) { + labelLayout.addView(getGameTagView(context, tags[i], 0)); + } else { + labelLayout.addView(getGameTagView(context, tags[i], DisplayUtils.dip2px(context, 5))); + } } } } - public static TextView getGameTagView(Context context, String tagStr) { - LayoutParams lp = new LayoutParams( + public static TextView getGameTagView(Context context, String tagStr, int rightMargin) { + LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - lp.setMargins(0, 0, DisplayUtils.dip2px(context, 5), 0); + lparams.rightMargin = rightMargin; TextView tag = new TextView(context); tag.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); tag.setSingleLine(true); tag.setText(tagStr); if ("官方版".equals(tagStr) || "已关注".equals(tagStr)) { tag.setBackgroundResource(R.drawable.border_green_bg); - tag.setTextColor(Color.parseColor("#05c400")); - } else if ("已安装".equals(tagStr)) { - tag.setBackgroundResource(R.drawable.border_red_bg); - tag.setTextColor(Color.parseColor("#bc2132")); + tag.setTextColor(context.getResources().getColor(R.color.tag_green)); } else { tag.setBackgroundResource(R.drawable.border_blue_bg); - tag.setTextColor(0xff1BA4FC); + tag.setTextColor(context.getResources().getColor(R.color.theme)); } - tag.setLayoutParams(lp); + tag.setLayoutParams(lparams); tag.setPadding(DisplayUtils.dip2px(context, 3), 0, DisplayUtils.dip2px(context, 3), @@ -80,13 +82,10 @@ public class GameViewUtils { public static String getGameTestDate(long testTime) { - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", - Locale.CHINA); - + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); format.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai")); String testDate; - try { long today = format.parse(format.format(new Date())).getTime(); long day = Long.parseLong(testTime + "000"); diff --git a/app/src/main/java/com/gh/common/util/GzipUtils.java b/app/src/main/java/com/gh/common/util/GzipUtils.java index 144eb3bd43..19278ae6cd 100644 --- a/app/src/main/java/com/gh/common/util/GzipUtils.java +++ b/app/src/main/java/com/gh/common/util/GzipUtils.java @@ -15,8 +15,7 @@ public class GzipUtils { /* * 数据压缩 */ - public static void compress(InputStream is, OutputStream os) - throws IOException { + public static void compress(InputStream is, OutputStream os) throws IOException { GZIPOutputStream gos = null; try { gos = new GZIPOutputStream(os); @@ -38,8 +37,7 @@ public class GzipUtils { /* * 数据解压缩 */ - public static void decompress(InputStream is, OutputStream os) - throws IOException { + public static void decompress(InputStream is, OutputStream os) throws IOException { GZIPInputStream gis = null; try { gis = new GZIPInputStream(is); @@ -112,4 +110,5 @@ public class GzipUtils { } } } + } diff --git a/app/src/main/java/com/gh/common/util/HotFix.java b/app/src/main/java/com/gh/common/util/HotFix.java index 3e84ef0bdb..7f2cefc7a3 100644 --- a/app/src/main/java/com/gh/common/util/HotFix.java +++ b/app/src/main/java/com/gh/common/util/HotFix.java @@ -16,6 +16,7 @@ import dalvik.system.PathClassLoader; /* compiled from: ProGuard */ public final class HotFix { + public static void patch(Context context, String patchDexFile, String patchClassName) { if (patchDexFile != null && new File(patchDexFile).exists()) { try { @@ -153,4 +154,5 @@ public final class HotFix { } return newInstance; } + } \ No newline at end of file diff --git a/app/src/main/java/com/gh/common/util/HttpdnsUtils.java b/app/src/main/java/com/gh/common/util/HttpdnsUtils.java deleted file mode 100644 index 0a3f739472..0000000000 --- a/app/src/main/java/com/gh/common/util/HttpdnsUtils.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.gh.common.util; - -import android.content.Context; - -import com.alibaba.sdk.android.httpdns.HttpDns; -import com.alibaba.sdk.android.httpdns.HttpDnsService; - -import java.net.HttpURLConnection; -import java.net.URL; - -/** - * Created by khy on 2016/7/11. - */ -public class HttpdnsUtils { - private static HttpDnsService httpdns; - private static String accountID = "180813"; - - public static String getUrls(Context context,String url){ - httpdns = HttpDns.getService(context,accountID); - try { - URL oldUrl = new URL(url); - HttpURLConnection connection = (HttpURLConnection) oldUrl.openConnection(); - String ip = httpdns.getIpByHost(oldUrl.getHost()); - if (ip!= null){ - String newUrl = url.replaceFirst(oldUrl.getHost(), ip); - return newUrl; - } - } catch (Exception e) { - e.printStackTrace(); - } - - return null; - } - -} diff --git a/app/src/main/java/com/gh/common/util/ImageUtils.java b/app/src/main/java/com/gh/common/util/ImageUtils.java index bdd872bad9..2ee2a2d936 100644 --- a/app/src/main/java/com/gh/common/util/ImageUtils.java +++ b/app/src/main/java/com/gh/common/util/ImageUtils.java @@ -27,9 +27,11 @@ import java.util.concurrent.Executors; import de.greenrobot.event.EventBus; public class ImageUtils { + private static ImageUtils singleton; private static ImageLoader imageLoader; private static DisplayImageOptions options; + private ArrayMap> imageCache = new ArrayMap>(); ExecutorService fixedThreadPool = Executors.newFixedThreadPool(5); @@ -78,16 +80,14 @@ public class ImageUtils { } @Override - public void onLoadingComplete(String arg0, View view, - Bitmap arg2) { + public void onLoadingComplete(String arg0, View view, Bitmap arg2) { AlphaAnimation animation = new AlphaAnimation(0f, 1f); animation.setDuration(500); view.startAnimation(animation); } @Override - public void onLoadingFailed(String arg0, View arg1, - FailReason arg2) { + public void onLoadingFailed(String arg0, View arg1, FailReason arg2) { } @@ -99,21 +99,20 @@ public class ImageUtils { }); } //增加一个上下文环境,图片宽度设最大,高度自适应 - public void display(String url, ImageView imageView, int drawable,Context context) { - display(url, imageView, drawable, ScaleType.FIT_XY, null,context); + public void display(String url, ImageView imageView, int drawable, Context context) { + display(url, imageView, drawable, ScaleType.FIT_XY, null, context); } + public void display(String url, ImageView imageView, int drawable) { display(url, imageView, drawable, ScaleType.FIT_XY, null); } - public void display(final String url, final ImageView imageView, - final int drawable, final ScaleType scaleType, - final OnLoadingCompleteListener listener) { + public void display(final String url, final ImageView imageView, final int drawable, + final ScaleType scaleType, final OnLoadingCompleteListener listener) { imageLoader.displayImage(url, imageView, options, new ImageLoadingListener() { @Override - public void onLoadingComplete(String imageUri, View view, - Bitmap loadedImage) { + public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { if (imageView instanceof CircleImageView) { imageView.setScaleType(ScaleType.CENTER_CROP); } else { @@ -138,27 +137,24 @@ public class ImageUtils { } @Override - public void onLoadingFailed(String imageUri, View view, - FailReason reason) { + public void onLoadingFailed(String imageUri, View view, FailReason reason) { } }); } - public void display(final String url, final ImageView imageView, - final int drawable, final ScaleType scaleType, - final OnLoadingCompleteListener listener,final Context context) { + public void display(final String url, final ImageView imageView, final int drawable, + final ScaleType scaleType, final OnLoadingCompleteListener listener, final Context context) { imageLoader.displayImage(url, imageView, options, new ImageLoadingListener() { @Override - public void onLoadingComplete(String imageUri, View view, - Bitmap loadedImage) { + public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { int width = loadedImage.getWidth(); int height = loadedImage.getHeight(); int widthPixels = context.getResources().getDisplayMetrics().widthPixels; - widthPixels = widthPixels - (int)(context.getResources().getDisplayMetrics().density * 10); - float index = (float) height / (float) width; - int newHeight = (int)(index * widthPixels); + widthPixels = widthPixels - DisplayUtils.dip2px(context, 10); + float scale = (float) height / (float) width; + int newHeight = (int)(scale * widthPixels); ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); if (layoutParams!=null){ @@ -193,16 +189,14 @@ public class ImageUtils { } @Override - public void onLoadingFailed(String imageUri, View view, - FailReason reason) { + public void onLoadingFailed(String imageUri, View view, FailReason reason) { } }); } - public void display(final String url, final ImageView imageView, - final int drawable, final ScaleType scaleType, - final OnLoadingCompleteListener listener, final int i) { + public void display(final String url, final ImageView imageView, final int drawable, + final ScaleType scaleType, final OnLoadingCompleteListener listener, final int i) { imageLoader.displayImage(url, imageView, options, new ImageLoadingListener() { @Override diff --git a/app/src/main/java/com/gh/common/util/Installation.java b/app/src/main/java/com/gh/common/util/Installation.java index b155695b7e..51019b79b0 100644 --- a/app/src/main/java/com/gh/common/util/Installation.java +++ b/app/src/main/java/com/gh/common/util/Installation.java @@ -9,9 +9,11 @@ import java.io.RandomAccessFile; import java.util.UUID; public class Installation { - private static String sID = null; + private static final String INSTALLATION = "INSTALLATION"; + private static String sID = null; + public synchronized static String getUUID(Context context) { if (sID == null) { File installation = new File(context.getFilesDir(), INSTALLATION); @@ -42,4 +44,5 @@ public class Installation { out.write(id.getBytes()); out.close(); } + } \ No newline at end of file diff --git a/app/src/main/java/com/gh/common/util/MD5Utils.java b/app/src/main/java/com/gh/common/util/MD5Utils.java index e472d9be1e..d5f84c7c89 100644 --- a/app/src/main/java/com/gh/common/util/MD5Utils.java +++ b/app/src/main/java/com/gh/common/util/MD5Utils.java @@ -74,4 +74,5 @@ public class MD5Utils { BigInteger bigInt = new BigInteger(1, digest.digest()); return bigInt.toString(16); } + } diff --git a/app/src/main/java/com/gh/common/util/MeasureHeightLayoutManager.java b/app/src/main/java/com/gh/common/util/MeasureHeightLayoutManager.java index 07c1009582..856ad63460 100644 --- a/app/src/main/java/com/gh/common/util/MeasureHeightLayoutManager.java +++ b/app/src/main/java/com/gh/common/util/MeasureHeightLayoutManager.java @@ -17,6 +17,7 @@ public class MeasureHeightLayoutManager extends LinearLayoutManager { } private int[] mMeasuredDimension = new int[1]; + @Override public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) { @@ -32,7 +33,7 @@ public class MeasureHeightLayoutManager extends LinearLayoutManager { height = height + mMeasuredDimension[0]; } - if (height>heightSize){ + if (height > heightSize){ super.onMeasure(recycler, state, widthSpec, heightSpec); }else { setMeasuredDimension(View.MeasureSpec.getSize(widthSpec), height); @@ -40,7 +41,6 @@ public class MeasureHeightLayoutManager extends LinearLayoutManager { } - private void measureScrapChild(RecyclerView.Recycler recycler, int position, int widthSpec, int heightSpec, int[] measuredDimension) { View view = recycler.getViewForPosition(position); @@ -59,4 +59,5 @@ public class MeasureHeightLayoutManager extends LinearLayoutManager { measuredDimension[0] = getDecoratedMeasuredHeight(view) + p.bottomMargin + p.topMargin; recycler.recycleView(view); } + } \ No newline at end of file diff --git a/app/src/main/java/com/gh/common/util/NetworkUtils.java b/app/src/main/java/com/gh/common/util/NetworkUtils.java index 1d82e90aad..498e518804 100644 --- a/app/src/main/java/com/gh/common/util/NetworkUtils.java +++ b/app/src/main/java/com/gh/common/util/NetworkUtils.java @@ -9,8 +9,7 @@ public class NetworkUtils { /** * 判断是否有网络连接 * - * @param context - * 上下文 + * @param context 上下文 * @return true 有网络连接 false 无网络连接 */ public static boolean isNetworkConnected(Context context) { @@ -29,8 +28,7 @@ public class NetworkUtils { /** * 判断WIFI网络是否可用 * - * @param context - * 上下文 + * @param context 上下文 * @return true wifi可用 false wifi不可用 */ public static boolean isWifiConnected(Context context) { @@ -49,8 +47,7 @@ public class NetworkUtils { /** * 判断MOBILE网络是否可用 * - * @param context - * 上下文 + * @param context 上下文 * @return true mobile可用 false mobile不可用 */ public static boolean isMobileConnected(Context context) { @@ -106,4 +103,5 @@ public class NetworkUtils { } return "NONE"; } + } diff --git a/app/src/main/java/com/gh/common/util/NewsUtils.java b/app/src/main/java/com/gh/common/util/NewsUtils.java index 48e266bb63..f1e0588867 100644 --- a/app/src/main/java/com/gh/common/util/NewsUtils.java +++ b/app/src/main/java/com/gh/common/util/NewsUtils.java @@ -43,8 +43,7 @@ public class NewsUtils { * @param entrance * @return */ - public static void startNewsActivity(Context context, - NewsEntity newsEntity, String entrance) { + public static void startNewsActivity(Context context, NewsEntity newsEntity, String entrance) { Intent intent = new Intent(context, NewsActivity.class); NewsDetailsEntity entity = new NewsDetailsEntity(); entity.setId(newsEntity.getId()); @@ -70,12 +69,13 @@ public class NewsUtils { public void onResponse(JSONObject response) { } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { + }, + new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { - } - }); + } + }); request.setShouldCache(false); AppController.addToRequestQueue(request, NewsUtils.class); } 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 8e26c64745..4d9a7b5cfa 100644 --- a/app/src/main/java/com/gh/common/util/PlatformUtils.java +++ b/app/src/main/java/com/gh/common/util/PlatformUtils.java @@ -33,15 +33,15 @@ import de.greenrobot.event.EventBus; public class PlatformUtils { + private static PlatformUtils mInstance; + + private Context context; + private ArrayMap platformMap; private ArrayMap platformPicMap; private ArrayMap platformPicUrlMap; private ArrayMap platformColorMap; - private static PlatformUtils mInstance; - - private Context context; - private PlatformUtils(Context con) { this.context = con.getApplicationContext(); initMap(); @@ -214,7 +214,7 @@ public class PlatformUtils { if (color != null) { return color; } - return "#1BA4FC"; + return "#00B7FA"; } public int getPlatformPic(String platform) { @@ -309,4 +309,5 @@ public class PlatformUtils { }); AppController.addToRequestQueue(request, SplashScreenActivity.class); } + } diff --git a/app/src/main/java/com/gh/common/util/RSEUtils.java b/app/src/main/java/com/gh/common/util/RSEUtils.java index 832bb20674..787545543e 100644 --- a/app/src/main/java/com/gh/common/util/RSEUtils.java +++ b/app/src/main/java/com/gh/common/util/RSEUtils.java @@ -43,7 +43,6 @@ public class RSEUtils { * 使用公钥加密 * * @param content - * @param key * @return */ public static String encryptByPublic(String content) { @@ -68,10 +67,7 @@ public class RSEUtils { /** * 使用公钥解密 * - * @param content - * 密文 - * @param key - * 商户私钥 + * @param content 密文 * @return 解密后的字符串 */ public static String decryptByPublic(String content) { diff --git a/app/src/main/java/com/gh/common/util/SpeedUtils.java b/app/src/main/java/com/gh/common/util/SpeedUtils.java index 6c34784946..b1846695c6 100644 --- a/app/src/main/java/com/gh/common/util/SpeedUtils.java +++ b/app/src/main/java/com/gh/common/util/SpeedUtils.java @@ -5,7 +5,7 @@ public class SpeedUtils { public static String getSpeed(long kSpeed) { if (kSpeed >= 1000) { float mSpeed = kSpeed / 1024f; - String str = mSpeed + ""; + String str = String.valueOf(mSpeed); if (str.length() > 4) { str = str.substring(0, 4); } @@ -14,10 +14,9 @@ public class SpeedUtils { return kSpeed + "K/s"; } - public static String getRemainTime(long totalSize, long currentSize, - long speed) { + public static String getRemainTime(long totalSize, long currentSize, long speed) { long remainSize = totalSize - currentSize; - long remainTime = 0; + long remainTime; if (speed != 0) { remainTime = remainSize / speed; } else { @@ -35,4 +34,5 @@ public class SpeedUtils { return second + "秒"; } } + } diff --git a/app/src/main/java/com/gh/common/view/DownloadDialog.java b/app/src/main/java/com/gh/common/view/DownloadDialog.java index 0431fdd257..7cecf26956 100644 --- a/app/src/main/java/com/gh/common/view/DownloadDialog.java +++ b/app/src/main/java/com/gh/common/view/DownloadDialog.java @@ -631,7 +631,7 @@ public class DownloadDialog { int color = Color.parseColor(PlatformUtils.getInstance(context) .getPlatformColor(apkEntity.getPlatform())); GradientDrawable gradientDrawable = new GradientDrawable(); - gradientDrawable.setColor(0xFFFFFFFF); + gradientDrawable.setColor(Color.WHITE); gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1), color); viewHolder.itemView.setBackgroundDrawable(gradientDrawable); @@ -690,7 +690,7 @@ public class DownloadDialog { int color = Color.parseColor(PlatformUtils.getInstance( context).getPlatformColor(apkEntity.getPlatform())); GradientDrawable gradientDrawable = new GradientDrawable(); - gradientDrawable.setColor(0xFFFFFFFF); + gradientDrawable.setColor(Color.WHITE); gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1), color); viewHolder.itemView.setBackgroundDrawable(gradientDrawable); diff --git a/app/src/main/java/com/gh/common/view/HorizontalItemDecoration.java b/app/src/main/java/com/gh/common/view/HorizontalItemDecoration.java index 85b973733e..11864a09e1 100644 --- a/app/src/main/java/com/gh/common/view/HorizontalItemDecoration.java +++ b/app/src/main/java/com/gh/common/view/HorizontalItemDecoration.java @@ -1,6 +1,7 @@ package com.gh.common.view; import android.content.Context; +import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.support.v7.widget.RecyclerView; @@ -16,7 +17,7 @@ public class HorizontalItemDecoration extends RecyclerView.ItemDecoration { public HorizontalItemDecoration(Context context, int interval, int size) { paint = new Paint(); - paint.setColor(0xffffffff); + paint.setColor(Color.WHITE); mInterval = DisplayUtils.dip2px(context, interval); mSize = size; } diff --git a/app/src/main/java/com/gh/common/view/VerticalItemDecoration.java b/app/src/main/java/com/gh/common/view/VerticalItemDecoration.java index 282a702e81..f04471d28c 100644 --- a/app/src/main/java/com/gh/common/view/VerticalItemDecoration.java +++ b/app/src/main/java/com/gh/common/view/VerticalItemDecoration.java @@ -17,7 +17,7 @@ public class VerticalItemDecoration extends RecyclerView.ItemDecoration { public VerticalItemDecoration(Context context, int interval) { paint = new Paint(); - paint.setColor(context.getResources().getColor(R.color.bg_color)); + paint.setColor(context.getResources().getColor(R.color.background)); mInterval = DisplayUtils.dip2px(context, interval); } diff --git a/app/src/main/java/com/gh/gamecenter/ConcernActivity.java b/app/src/main/java/com/gh/gamecenter/ConcernActivity.java index 1829657291..f6ec24590e 100644 --- a/app/src/main/java/com/gh/gamecenter/ConcernActivity.java +++ b/app/src/main/java/com/gh/gamecenter/ConcernActivity.java @@ -9,6 +9,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; @@ -49,7 +50,7 @@ public class ConcernActivity extends BaseActivity implements OnClickListener { private RecyclerView concern_rv_show, concern_rv_recommend; private ConcernManager manager; private RelativeLayout concern_rl_title; - private TextView concern_tv_none; + private LinearLayout reuse_none_data; private List list; private List recommendList; @@ -80,7 +81,7 @@ public class ConcernActivity extends BaseActivity implements OnClickListener { if (!list.isEmpty()) { initConcernGame(); } else { - concern_tv_none.setVisibility(View.VISIBLE); + reuse_none_data.setVisibility(View.VISIBLE); concern_rv_show.setVisibility(View.GONE); } @@ -234,7 +235,7 @@ public class ConcernActivity extends BaseActivity implements OnClickListener { concernList.remove(position); concern_rv_show.getAdapter().notifyItemRemoved(position); if (list.isEmpty()) { - concern_tv_none.setVisibility(View.VISIBLE); + reuse_none_data.setVisibility(View.VISIBLE); concern_rv_show.setVisibility(View.GONE); } concern_item_btn.setClickable(false); @@ -340,7 +341,7 @@ public class ConcernActivity extends BaseActivity implements OnClickListener { concernEntity.setId(gameEntity.getId()); list.add(concernEntity); if (list.size() == 1) { - concern_tv_none.setVisibility(View.GONE); + reuse_none_data.setVisibility(View.GONE); concern_rv_show.setVisibility(View.VISIBLE); } concern_rv_show.getAdapter().notifyItemInserted(list.size() - 1); @@ -441,11 +442,11 @@ public class ConcernActivity extends BaseActivity implements OnClickListener { } concernList = new ArrayList(); if (!list.isEmpty()) { - concern_tv_none.setVisibility(View.GONE); + reuse_none_data.setVisibility(View.GONE); concern_rv_show.setVisibility(View.VISIBLE); initConcernGame(); } else { - concern_tv_none.setVisibility(View.VISIBLE); + reuse_none_data.setVisibility(View.VISIBLE); concern_rv_show.setVisibility(View.GONE); } recommendList = new ArrayList(); @@ -461,28 +462,29 @@ public class ConcernActivity extends BaseActivity implements OnClickListener { @Override protected void onDestroy() { super.onDestroy(); - String uuid = ConcernUtils.UUID(this); - JSONArray jsonArray = new JSONArray(); + String uuid = ConcernUtils.uuid(this); + JSONArray data = new JSONArray(); for (ConcernInfo concernInfo : manager.getConcernGame()) { - jsonArray.put(concernInfo.getId()); + data.put(concernInfo.getId()); } - ConcernUtils.UpdateConcernData(Config.HOST + "v2d0/device/" + uuid + "/concern", jsonArray.toString(), new ConcernUtils.DownJsonListener() { - @Override - public void downSucced(String str) { - Utils.log("更新设备关注游戏成功"); - } + ConcernUtils.updateConcernData(Config.HOST + "v2d0/device/" + uuid + "/concern", data, + new ConcernUtils.DownJsonListener() { + @Override + public void downSucced(String str) { + Utils.log("更新设备关注游戏成功"); + } - @Override - public void downFailed() { - Utils.log("更新设备关注游戏失败"); - } - }); + @Override + public void downFailed() { + Utils.log("更新设备关注游戏失败"); + } + }); view = null; concern_rv_show = null; concern_rv_recommend = null; manager = null; concern_rl_title = null; - concern_tv_none = null; + reuse_none_data = null; list = null; recommendList = null; concernList = null; diff --git a/app/src/main/java/com/gh/gamecenter/DownloadManagerActivity.java b/app/src/main/java/com/gh/gamecenter/DownloadManagerActivity.java index 1e2c10242d..1f5e9f84b2 100644 --- a/app/src/main/java/com/gh/gamecenter/DownloadManagerActivity.java +++ b/app/src/main/java/com/gh/gamecenter/DownloadManagerActivity.java @@ -35,10 +35,12 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements OnClickListener, OnPageChangeListener { private ViewPager downloadmanager_viewPager; - private TextView downloadmanager_tv_download, downloadmanager_tv_update, - downloadmanager_download_number, downloadmanager_update_number; - private LinearLayout downloadmanager_ll_download, - downloadmanager_ll_update; + private TextView downloadmanager_tv_download; + private TextView downloadmanager_tv_update; + private TextView downloadmanager_download_number; + private TextView downloadmanager_update_number; + private LinearLayout downloadmanager_ll_download; + private LinearLayout downloadmanager_ll_update; private View downloadmanager_slide_line; private LinearLayout.LayoutParams lparams; @@ -52,37 +54,32 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); View contentView = View.inflate(this, R.layout.activity_downloadmanager, null); - init(contentView, "下载更新管理"); downloadmanager_ll_download.setOnClickListener(this); downloadmanager_ll_update.setOnClickListener(this); - int currentItem = getIntent().getIntExtra("currentItem", -1); - int updateSize = PackageManager.getUpdateList().size(); - - int downloadSize = DownloadManager.getInstance(getApplicationContext()) - .getAll().size(); - if (updateSize != 0) { downloadmanager_update_number.setVisibility(View.VISIBLE); - downloadmanager_update_number.setText("" + updateSize); + downloadmanager_update_number.setText(String.valueOf(updateSize)); } else { downloadmanager_update_number.setVisibility(View.GONE); } + int downloadSize = DownloadManager.getInstance( + getApplicationContext()).getAll().size(); if (downloadSize != 0) { downloadmanager_download_number.setVisibility(View.VISIBLE); - downloadmanager_download_number.setText("" + downloadSize); + downloadmanager_download_number.setText(String.valueOf(downloadSize)); } else { downloadmanager_download_number.setVisibility(View.GONE); } + int currentItem = getIntent().getIntExtra("currentItem", -1); if (currentItem == -1) { if (updateSize != 0 && downloadSize == 0) { currentItem = 1; @@ -157,17 +154,15 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements new EBUISwitch("DownloadManagerActivity", 0)); downloadmanager_ll_download.setClickable(false); downloadmanager_ll_update.setClickable(true); - downloadmanager_tv_download.setTextColor(getResources().getColor( - R.color.theme_colors)); - downloadmanager_tv_update.setTextColor(0xFF333333); + downloadmanager_tv_download.setTextColor(getResources().getColor(R.color.theme)); + downloadmanager_tv_update.setTextColor(getResources().getColor(R.color.title)); } else { EventBus.getDefault().post( new EBUISwitch("DownloadManagerActivity", 1)); downloadmanager_ll_download.setClickable(true); downloadmanager_ll_update.setClickable(false); - downloadmanager_tv_download.setTextColor(0xFF333333); - downloadmanager_tv_update.setTextColor(getResources().getColor( - R.color.theme_colors)); + downloadmanager_tv_download.setTextColor(getResources().getColor(R.color.title)); + downloadmanager_tv_update.setTextColor(getResources().getColor(R.color.theme)); } } @@ -211,7 +206,7 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements } public void onEventMainThread(EBDownloadChanged changed) { - if (changed.getType() == "download") { + if ("download".equals(changed.getType())) { if (changed.getVisibility() == View.VISIBLE){ downloadmanager_download_number.setVisibility(View.VISIBLE); } else if (changed.getVisibility() == View.GONE) { @@ -219,15 +214,15 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements } else if (changed.getVisibility() == View.INVISIBLE) { downloadmanager_download_number.setVisibility(View.INVISIBLE); } - downloadmanager_download_number.setText(changed.getSize() + ""); - } else if (changed.getType() == "update") { + downloadmanager_download_number.setText(String.valueOf(changed.getSize())); + } else if ("update".equals(changed.getType())) { if (changed.getSize() == -1) { int number = Integer.valueOf(downloadmanager_update_number .getText().toString()); if (number == 1) { downloadmanager_update_number.setVisibility(View.GONE); } else { - downloadmanager_update_number.setText((number - 1) + ""); + downloadmanager_update_number.setText(String.valueOf(number - 1)); } } else { if (changed.getSize() != 0) { @@ -238,7 +233,7 @@ public class DownloadManagerActivity extends BaseFragmentActivity implements } else if (changed.getVisibility() == View.INVISIBLE) { downloadmanager_update_number.setVisibility(View.INVISIBLE); } - downloadmanager_update_number.setText(changed.getSize() + ""); + downloadmanager_update_number.setText(String.valueOf(changed.getSize())); } else { downloadmanager_update_number.setVisibility(View.GONE); } diff --git a/app/src/main/java/com/gh/gamecenter/GameActivity.java b/app/src/main/java/com/gh/gamecenter/GameActivity.java index f1cf962113..92bb0fd1bb 100644 --- a/app/src/main/java/com/gh/gamecenter/GameActivity.java +++ b/app/src/main/java/com/gh/gamecenter/GameActivity.java @@ -81,15 +81,13 @@ public class GameActivity extends BaseFragmentActivity implements if (position == 0) { new_game_text.setClickable(false); test_game_text.setClickable(true); - new_game_text.setTextColor(getResources().getColor( - R.color.theme_colors)); - test_game_text.setTextColor(0xFF333333); + new_game_text.setTextColor(getResources().getColor(R.color.theme)); + test_game_text.setTextColor(getResources().getColor(R.color.title)); } else { new_game_text.setClickable(true); test_game_text.setClickable(false); - new_game_text.setTextColor(0xFF333333); - test_game_text.setTextColor(getResources().getColor( - R.color.theme_colors)); + new_game_text.setTextColor(getResources().getColor(R.color.title)); + test_game_text.setTextColor(getResources().getColor(R.color.theme)); } if (position != 0) { rparams.leftMargin = (int) (width * position) + width / 4; @@ -143,16 +141,14 @@ public class GameActivity extends BaseFragmentActivity implements EventBus.getDefault().post(new EBUISwitch("GameActivity", 0)); new_game_text.setClickable(false); test_game_text.setClickable(true); - new_game_text.setTextColor(getResources().getColor( - R.color.theme_colors)); - test_game_text.setTextColor(0xFF333333); + new_game_text.setTextColor(getResources().getColor(R.color.theme)); + test_game_text.setTextColor(getResources().getColor(R.color.title)); } else { EventBus.getDefault().post(new EBUISwitch("GameActivity", 1)); new_game_text.setClickable(true); test_game_text.setClickable(false); - new_game_text.setTextColor(0xFF333333); - test_game_text.setTextColor(getResources().getColor( - R.color.theme_colors)); + new_game_text.setTextColor(getResources().getColor(R.color.title)); + test_game_text.setTextColor(getResources().getColor(R.color.theme)); } } diff --git a/app/src/main/java/com/gh/gamecenter/GameDeatilsNewsActivity.java b/app/src/main/java/com/gh/gamecenter/GameDeatilsNewsActivity.java index bf0e2f2d8c..c313ad508b 100644 --- a/app/src/main/java/com/gh/gamecenter/GameDeatilsNewsActivity.java +++ b/app/src/main/java/com/gh/gamecenter/GameDeatilsNewsActivity.java @@ -153,8 +153,8 @@ public class GameDeatilsNewsActivity extends BaseActivity{ } public StateListDrawable selectorBg(){ - GradientDrawable roundCornerShape1 = createRoundCornerShape(2, 50, Color.parseColor("#b3b3b3"), Color.parseColor("#ffffff")); - GradientDrawable roundCornerShape2 = createRoundCornerShape(0, 50, Color.TRANSPARENT, Color.parseColor("#00b7fa")); + GradientDrawable roundCornerShape1 = createRoundCornerShape(2, 50, getResources().getColor(R.color.hint), Color.WHITE); + GradientDrawable roundCornerShape2 = createRoundCornerShape(0, 50, Color.TRANSPARENT, getResources().getColor(R.color.theme)); GradientDrawable roundCornerShape3 = createRoundCornerShape(0, 50, Color.TRANSPARENT, Color.parseColor("#59d3ff")); StateListDrawable bg_install = new StateListDrawable(); @@ -191,14 +191,14 @@ public class GameDeatilsNewsActivity extends BaseActivity{ radioButton.setLayoutParams(layoutParams); radioButton.setButtonDrawable(android.R.color.transparent); radioButton.setGravity(Gravity.CENTER); - radioButton.setBackground(selectorBg()); + radioButton.setBackgroundDrawable(selectorBg()); radioButton.setText(listType.get(index)); - radioButton.setTextColor(Color.parseColor("#b3b3b3")); + radioButton.setTextColor(getResources().getColor(R.color.hint)); ll_type.addView(radioButton); if (i == selectI&&j==selectJ){ radioButton.setSelected(true); newsType = radioButton.getText().toString(); - radioButton.setTextColor(Color.parseColor("#ffffff")); + radioButton.setTextColor(Color.WHITE); } index++; final int finalI = i; diff --git a/app/src/main/java/com/gh/gamecenter/GameDetailsActivity.java b/app/src/main/java/com/gh/gamecenter/GameDetailsActivity.java index 183896eac8..9e7cd9ae04 100644 --- a/app/src/main/java/com/gh/gamecenter/GameDetailsActivity.java +++ b/app/src/main/java/com/gh/gamecenter/GameDetailsActivity.java @@ -1,6 +1,7 @@ package com.gh.gamecenter; import android.content.Intent; +import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; @@ -294,7 +295,7 @@ public class GameDetailsActivity extends BaseFragmentActivity implements gamedetails_tv_download.setText("暂无下载"); gamedetails_tv_download .setBackgroundResource(R.drawable.textview_gray_style); - gamedetails_tv_download.setTextColor(0xFF999999); + gamedetails_tv_download.setTextColor(getResources().getColor(R.color.btn_gray)); gamedetails_tv_download.setClickable(false); } else { boolean isInstalled = false; @@ -334,7 +335,7 @@ public class GameDetailsActivity extends BaseFragmentActivity implements top_tv_attention.setText("关注"); top_tv_attention .setBackgroundResource(R.drawable.textview_red_style); - top_tv_attention.setTextColor(0xffffffff); + top_tv_attention.setTextColor(Color.WHITE); } ImageUtils.getInstance(this).display(entity.getIcon(), top_iv_icon); @@ -426,7 +427,7 @@ public class GameDetailsActivity extends BaseFragmentActivity implements top_tv_attention.setText("关注"); top_tv_attention.setBackgroundResource(R.drawable.textview_red_style); - top_tv_attention.setTextColor(0xffffffff); + top_tv_attention.setTextColor(Color.WHITE); } }); } @@ -624,15 +625,13 @@ public class GameDetailsActivity extends BaseFragmentActivity implements gamedetails_tv_information.setClickable(true); gamedetails_tv_strategy.setClickable(true); - titlebar_tv_details.setTextColor(getResources().getColor( - R.color.theme_colors)); - titlebar_tv_information.setTextColor(0xFF333333); - titlebar_tv_strategy.setTextColor(0xFF333333); + titlebar_tv_details.setTextColor(getResources().getColor(R.color.theme)); + titlebar_tv_information.setTextColor(getResources().getColor(R.color.title)); + titlebar_tv_strategy.setTextColor(getResources().getColor(R.color.title)); - gamedetails_tv_details.setTextColor(getResources().getColor( - R.color.theme_colors)); - gamedetails_tv_information.setTextColor(0xFF333333); - gamedetails_tv_strategy.setTextColor(0xFF333333); + gamedetails_tv_details.setTextColor(getResources().getColor(R.color.theme)); + gamedetails_tv_information.setTextColor(getResources().getColor(R.color.title)); + gamedetails_tv_strategy.setTextColor(getResources().getColor(R.color.title)); break; case 1: if (gamedetails_ll_topbar.getVisibility() == View.VISIBLE) { @@ -648,15 +647,13 @@ public class GameDetailsActivity extends BaseFragmentActivity implements gamedetails_tv_information.setClickable(false); gamedetails_tv_strategy.setClickable(true); - titlebar_tv_details.setTextColor(0xFF333333); - titlebar_tv_information.setTextColor(getResources().getColor( - R.color.theme_colors)); - titlebar_tv_strategy.setTextColor(0xFF333333); + titlebar_tv_details.setTextColor(getResources().getColor(R.color.title)); + titlebar_tv_information.setTextColor(getResources().getColor(R.color.theme)); + titlebar_tv_strategy.setTextColor(getResources().getColor(R.color.title)); - gamedetails_tv_details.setTextColor(0xFF333333); - gamedetails_tv_information.setTextColor(getResources().getColor( - R.color.theme_colors)); - gamedetails_tv_strategy.setTextColor(0xFF333333); + gamedetails_tv_details.setTextColor(getResources().getColor(R.color.title)); + gamedetails_tv_information.setTextColor(getResources().getColor(R.color.theme)); + gamedetails_tv_strategy.setTextColor(getResources().getColor(R.color.title)); break; case 2: if (gamedetails_ll_topbar.getVisibility() == View.VISIBLE) { @@ -672,15 +669,13 @@ public class GameDetailsActivity extends BaseFragmentActivity implements gamedetails_tv_information.setClickable(true); gamedetails_tv_strategy.setClickable(false); - titlebar_tv_details.setTextColor(0xFF333333); - titlebar_tv_information.setTextColor(0xFF333333); - titlebar_tv_strategy.setTextColor(getResources().getColor( - R.color.theme_colors)); + titlebar_tv_details.setTextColor(getResources().getColor(R.color.title)); + titlebar_tv_information.setTextColor(getResources().getColor(R.color.title)); + titlebar_tv_strategy.setTextColor(getResources().getColor(R.color.theme)); - gamedetails_tv_details.setTextColor(0xFF333333); - gamedetails_tv_information.setTextColor(0xFF333333); - gamedetails_tv_strategy.setTextColor(getResources().getColor( - R.color.theme_colors)); + gamedetails_tv_details.setTextColor(getResources().getColor(R.color.title)); + gamedetails_tv_information.setTextColor(getResources().getColor(R.color.title)); + gamedetails_tv_strategy.setTextColor(getResources().getColor(R.color.theme)); break; } } diff --git a/app/src/main/java/com/gh/gamecenter/MainActivity.java b/app/src/main/java/com/gh/gamecenter/MainActivity.java index b4281fc4a7..5bc469c0ef 100644 --- a/app/src/main/java/com/gh/gamecenter/MainActivity.java +++ b/app/src/main/java/com/gh/gamecenter/MainActivity.java @@ -968,8 +968,7 @@ public class MainActivity extends BaseFragmentActivity implements case 0: home1Layout.setClickable(false); home1Image.setImageResource(R.drawable.home1_selected); - home1Title.setTextColor(getResources().getColor( - R.color.theme_colors)); + home1Title.setTextColor(getResources().getColor(R.color.theme)); if (pluginFragmentActivity == null) { List list = getSupportFragmentManager().getFragments(); if (list != null) { @@ -993,8 +992,7 @@ public class MainActivity extends BaseFragmentActivity implements case 1: home2Layout.setClickable(false); home2Image.setImageResource(R.drawable.home2_selected); - home2Title.setTextColor(getResources().getColor( - R.color.theme_colors)); + home2Title.setTextColor(getResources().getColor(R.color.theme)); if (newsFragment == null) { List list = getSupportFragmentManager().getFragments(); if (list != null) { @@ -1018,8 +1016,7 @@ public class MainActivity extends BaseFragmentActivity implements case 2: home3Layout.setClickable(false); home3Image.setImageResource(R.drawable.home3_selected); - home3Title.setTextColor(getResources().getColor( - R.color.theme_colors)); + home3Title.setTextColor(getResources().getColor(R.color.theme)); if (home3Fragment == null) { List list = getSupportFragmentManager().getFragments(); if (list != null) { @@ -1056,9 +1053,9 @@ public class MainActivity extends BaseFragmentActivity implements home1Image.setImageResource(R.drawable.home1_unselected); home2Image.setImageResource(R.drawable.home2_unselected); home3Image.setImageResource(R.drawable.home3_unselected); - home1Title.setTextColor(0xFF333333); - home2Title.setTextColor(0xFF333333); - home3Title.setTextColor(0xFF333333); + home1Title.setTextColor(getResources().getColor(R.color.title)); + home2Title.setTextColor(getResources().getColor(R.color.title)); + home3Title.setTextColor(getResources().getColor(R.color.title)); } /** diff --git a/app/src/main/java/com/gh/gamecenter/NewGameDetailsActivity.java b/app/src/main/java/com/gh/gamecenter/NewGameDetailsActivity.java index 4829a55b48..2414931c05 100644 --- a/app/src/main/java/com/gh/gamecenter/NewGameDetailsActivity.java +++ b/app/src/main/java/com/gh/gamecenter/NewGameDetailsActivity.java @@ -3,6 +3,7 @@ package com.gh.gamecenter; import android.app.Dialog; import android.content.Context; import android.content.Intent; +import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.support.v4.util.ArrayMap; @@ -32,6 +33,7 @@ import com.gh.common.constant.Config; import com.gh.common.util.ConcernUtils; import com.gh.common.util.DataUtils; import com.gh.common.util.DialogUtils; +import com.gh.common.util.DisplayUtils; import com.gh.common.util.FileUtils; import com.gh.common.util.ImageUtils; import com.gh.common.util.MD5Utils; @@ -123,16 +125,19 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + View contentView = View.inflate(this, R.layout.activity_new_gamedetails, null); + RelativeLayout reuse_actionbar = (RelativeLayout) contentView.findViewById(R.id.reuse_actionbar); iv_share = new ImageView(this); iv_share.setImageResource(R.drawable.share_icon); - float dp = getResources().getDisplayMetrics().density; - RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int)(dp*20),(int)(dp*20)); + RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( + DisplayUtils.dip2px(this, 20), DisplayUtils.dip2px(this, 20)); params.addRule( RelativeLayout.CENTER_VERTICAL); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT ); - params.setMargins(0,0,(int)(dp*10),0); + params.rightMargin = DisplayUtils.dip2px(this, 10); reuse_actionbar.addView(iv_share,params); + gameId = getIntent().getStringExtra("gameId"); entrance = getIntent().getStringExtra("entrance"); if (gameId != null) { @@ -287,7 +292,7 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick tvDowload.setText("暂无下载"); tvDowload .setBackgroundResource(R.drawable.textview_gray_style); - tvDowload.setTextColor(0xFF999999); + tvDowload.setTextColor(context.getResources().getColor(R.color.btn_gray)); tvDowload.setClickable(false); } else { boolean isInstalled = false; @@ -569,10 +574,10 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick @Override protected void onDestroy() { super.onDestroy(); - String uuid = ConcernUtils.UUID(this); - if (isConcern == true&&concernCode ==2){ + String uuid = ConcernUtils.uuid(this); + if (isConcern && concernCode == 2){ //取消关注 - ConcernUtils.DeleteConcernData(Config.HOST + "v2d0/device/" + uuid + "/concern/" + gameId, new ConcernUtils.DownJsonListener() { + ConcernUtils.deleteConcernData(Config.HOST + "v2d0/device/" + uuid + "/concern/" + gameId, new ConcernUtils.DownJsonListener() { @Override public void downSucced(String str) { Utils.log("删除提交成功==游戏详情"); @@ -584,9 +589,9 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick } }); - }else if (isConcern == false&& concernCode == 1){ + } else if (!isConcern && concernCode == 1){ //添加关注 - ConcernUtils.PostConcernGameId("[" + gameId + "]", Config.HOST + "v2d0/device/" + uuid + "/concern", new ConcernUtils.DownJsonListener() { + ConcernUtils.postConcernGameId(gameId, Config.HOST + "v2d0/device/" + uuid + "/concern", new ConcernUtils.DownJsonListener() { @Override public void downSucced(String str) { Utils.log("关注提交成功==游戏详情"); @@ -597,7 +602,7 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick Utils.log("关注提交失败==游戏详情"); } }); - }else { + } else { Utils.log("无关注操作==游戏详情"); } gameId = null; @@ -619,8 +624,8 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick handler = null; } - public class GameDetailsAdapter extends RecyclerView.Adapter{ + private Context context; public GameDetailsAdapter(Context context) { @@ -628,6 +633,7 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick getGameDetail(); getGameNews(); } + @Override public int getItemViewType(int position){ if (position == 0){ @@ -649,7 +655,7 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - View view ; + View view; switch (viewType){ case 0: view = LayoutInflater.from(context).inflate(R.layout.gamedetails_rv_item_top,parent,false); @@ -850,7 +856,7 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick attention.setText("关注"); attention .setBackgroundResource(R.drawable.textview_red_style); - attention.setTextColor(0xffffffff); + attention.setTextColor(Color.WHITE); } }); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); @@ -890,7 +896,7 @@ public class NewGameDetailsActivity extends BaseActivity implements View.OnClick } else { tv_concern.setText("关注"); tv_concern.setBackgroundResource(R.drawable.textview_red_style); - tv_concern.setTextColor(0xffffffff); + tv_concern.setTextColor(Color.WHITE); } } } diff --git a/app/src/main/java/com/gh/gamecenter/NewsActivity.java b/app/src/main/java/com/gh/gamecenter/NewsActivity.java index 9407976d1e..cac9c67308 100644 --- a/app/src/main/java/com/gh/gamecenter/NewsActivity.java +++ b/app/src/main/java/com/gh/gamecenter/NewsActivity.java @@ -765,7 +765,7 @@ public class NewsActivity extends BaseActivity implements OnClickListener { essaydetails_ll_bottom.setVisibility(View.VISIBLE); essaydetails_tv_download.setText("暂无下载"); essaydetails_tv_download.setBackgroundResource(R.drawable.textview_gray_style); - essaydetails_tv_download.setTextColor(0xFF999999); + essaydetails_tv_download.setTextColor(getResources().getColor(R.color.btn_gray)); essaydetails_tv_download.setClickable(false); } else if (Config.isShow) { essaydetails_ll_bottom.setVisibility(View.VISIBLE); @@ -857,7 +857,7 @@ public class NewsActivity extends BaseActivity implements OnClickListener { attention.setText("关注"); attention .setBackgroundResource(R.drawable.textview_red_style); - attention.setTextColor(0xffffffff); + attention.setTextColor(Color.WHITE); } }); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); @@ -1034,7 +1034,7 @@ public class NewsActivity extends BaseActivity implements OnClickListener { } else { holder.essaydetails_attention.setText("关注"); holder.essaydetails_attention.setBackgroundResource(R.drawable.textview_red_style); - holder.essaydetails_attention.setTextColor(0xffffffff); + holder.essaydetails_attention.setTextColor(Color.WHITE); } if (gameEntity.getApk() != null && !gameEntity.getApk().isEmpty()) { for (int i = 0, size = gameEntity.getApk().size(); i < size; i++) { @@ -1362,10 +1362,10 @@ public class NewsActivity extends BaseActivity implements OnClickListener { @Override protected void onDestroy() { super.onDestroy(); - String uuid = ConcernUtils.UUID(this); - if (isConcern == true&&concernCode ==2 && gameEntity.getId()!=null){ + String uuid = ConcernUtils.uuid(this); + if (isConcern && concernCode == 2 && gameEntity.getId() != null) { //取消关注 - ConcernUtils.DeleteConcernData(Config.HOST + "v2d0/device/" + uuid + "/concern/" + gameEntity.getId(), new ConcernUtils.DownJsonListener() { + ConcernUtils.deleteConcernData(Config.HOST + "v2d0/device/" + uuid + "/concern/" + gameEntity.getId(), new ConcernUtils.DownJsonListener() { @Override public void downSucced(String str) { Utils.log("删除提交成功==游戏详情"); @@ -1377,9 +1377,9 @@ public class NewsActivity extends BaseActivity implements OnClickListener { } }); - }else if (isConcern == false&& concernCode == 1&& gameEntity.getId()!=null){ + } else if (!isConcern && concernCode == 1 && gameEntity.getId() != null) { //添加关注 - ConcernUtils.PostConcernGameId("[" + gameEntity.getId() + "]", Config.HOST + "v2d0/device/" + uuid + "/concern", new ConcernUtils.DownJsonListener() { + ConcernUtils.postConcernGameId(gameEntity.getId(), Config.HOST + "v2d0/device/" + uuid + "/concern", new ConcernUtils.DownJsonListener() { @Override public void downSucced(String str) { Utils.log("关注提交成功==游戏详情"); @@ -1390,7 +1390,7 @@ public class NewsActivity extends BaseActivity implements OnClickListener { Utils.log("关注提交失败==游戏详情"); } }); - }else { + } else { Utils.log("无关注操作==游戏详情"); } isDestroy = true; diff --git a/app/src/main/java/com/gh/gamecenter/NewsSearchActivity.java b/app/src/main/java/com/gh/gamecenter/NewsSearchActivity.java index 47644cd3e8..b8ace771f2 100644 --- a/app/src/main/java/com/gh/gamecenter/NewsSearchActivity.java +++ b/app/src/main/java/com/gh/gamecenter/NewsSearchActivity.java @@ -42,7 +42,8 @@ public class NewsSearchActivity extends BaseActivity { private RecyclerView mNewsRecyclerView; private List newsEntities; private NewsSearchAdapter searchAdapter; - private TextView tvSearch, searchNonews; + private TextView tvSearch; + private LinearLayout reuse_none_data; private EditText edSearch; private LinearLayout llLoading; private LinearLayout noConnection; @@ -85,7 +86,7 @@ public class NewsSearchActivity extends BaseActivity { noConnection = (LinearLayout) findViewById(R.id.reuse_no_connection); llLoading = (LinearLayout) findViewById(R.id.gamedetails_news_ll_loading); cardView = (CardView) findViewById(R.id.gamedetails_news_cardView); - searchNonews = (TextView) findViewById(R.id.search_nonews); + reuse_none_data = (LinearLayout) findViewById(R.id.reuse_none_data); layoutManager = new MeasureHeightLayoutManager(this); @@ -167,10 +168,10 @@ public class NewsSearchActivity extends BaseActivity { cardView.setVisibility(View.VISIBLE); if (newsEntities.size() == 0){ cardView.setVisibility(View.GONE); - searchNonews.setVisibility(View.VISIBLE); + reuse_none_data.setVisibility(View.VISIBLE); }else { cardView.setVisibility(View.VISIBLE); - searchNonews.setVisibility(View.GONE); + reuse_none_data.setVisibility(View.GONE); } if (news.isEmpty() || (news.size() < 20)) { isRemove = true; @@ -203,7 +204,7 @@ public class NewsSearchActivity extends BaseActivity { newsEntities = null; searchAdapter = null; tvSearch = null; - searchNonews = null; + reuse_none_data = null; edSearch = null; llLoading = null; noConnection = null; diff --git a/app/src/main/java/com/gh/gamecenter/SearchActivity.java b/app/src/main/java/com/gh/gamecenter/SearchActivity.java index 5e103d49cc..ab1aa2fc63 100644 --- a/app/src/main/java/com/gh/gamecenter/SearchActivity.java +++ b/app/src/main/java/com/gh/gamecenter/SearchActivity.java @@ -86,7 +86,7 @@ public class SearchActivity extends BaseFragmentActivity { setTranslucentStatus(true); SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); - tintManager.setStatusBarTintResource(R.color.theme_colors); + tintManager.setStatusBarTintResource(R.color.theme); SystemBarConfig config = tintManager.getConfig(); contentView.setPadding(0, config.getPixelInsetTop(false), 0, config.getPixelInsetBottom()); diff --git a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java index 070362e8f7..12624691b8 100644 --- a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java +++ b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java @@ -107,7 +107,7 @@ public class SplashScreenActivity extends BaseActivity { if (mActionBar != null) { mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); RelativeLayout relativeLayout = new RelativeLayout(this); - relativeLayout.setBackgroundResource(R.color.theme_colors); + relativeLayout.setBackgroundResource(R.color.theme); LayoutParams params = new LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mActionBar.setCustomView(relativeLayout, params);// 自定义ActionBar布局 diff --git a/app/src/main/java/com/gh/gamecenter/SuggestionActivity.java b/app/src/main/java/com/gh/gamecenter/SuggestionActivity.java index f70dbe40f2..a52d1838ac 100644 --- a/app/src/main/java/com/gh/gamecenter/SuggestionActivity.java +++ b/app/src/main/java/com/gh/gamecenter/SuggestionActivity.java @@ -3,6 +3,7 @@ package com.gh.gamecenter; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; +import android.graphics.Color; import android.os.Bundle; import android.support.v7.widget.CardView; import android.telephony.TelephonyManager; @@ -141,7 +142,7 @@ public class SuggestionActivity extends BaseActivity implements OnClickListener TextView cancel = (TextView) view .findViewById(R.id.alertdialog_cannel); cancel.setText("我要填写"); - cancel.setTextColor(0xffFFFFFF); + cancel.setTextColor(Color.WHITE); cancel.setBackgroundResource(R.drawable.textview_blue_style); cancel.setOnClickListener(new OnClickListener() { @Override @@ -167,7 +168,7 @@ public class SuggestionActivity extends BaseActivity implements OnClickListener TextView confirm = (TextView) view .findViewById(R.id.alertdialog_confirm); confirm.setText("直接提交"); - confirm.setTextColor(0xff999999); + confirm.setTextColor(getResources().getColor(R.color.btn_gray)); confirm.setBackgroundResource(R.drawable.textview_cancel_style); confirm.setOnClickListener(new OnClickListener() { @Override @@ -208,7 +209,7 @@ public class SuggestionActivity extends BaseActivity implements OnClickListener map.put("ghversion", PackageUtils.getVersion(this)); map.put("channel", (String) PackageUtils.getMetaData(this, getPackageName(), "TD_CHANNEL_ID")); map.put("type", android.os.Build.MODEL); - map.put("sdk", android.os.Build.VERSION.SDK_INT + ""); + map.put("sdk", String.valueOf(android.os.Build.VERSION.SDK_INT)); map.put("version", android.os.Build.VERSION.RELEASE); map.put("imei", ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId()); JsonObjectRequest request = new JsonObjectRequest(Method.POST, 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 d23b8ee19f..c34a068cd0 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/SubjectAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/SubjectAdapter.java @@ -79,10 +79,8 @@ public class SubjectAdapter extends RecyclerView.Adapter(); - platformMap = new ArrayMap>(); - gameMap = new ArrayMap>(); - nameMap = new ArrayMap(); - statusMap = new ArrayMap(); + locationMap = new ArrayMap<>(); + platformMap = new ArrayMap<>(); + gameMap = new ArrayMap<>(); + nameMap = new ArrayMap<>(); + statusMap = new ArrayMap<>(); dismissEntity = new DismissEntity(false); // 黄壮华 添加 初始化游戏状态 修改2015/8/21 DownloadItemUtils.initializeGameMap(context, gameMap); - list = new ArrayList(); + list = new ArrayList<>(); isLoaded = false; isNetworkError = false; this.id = id; - initList(page); + initList(1); } public void initList(final int page) { - isLoaded =false; + isLoaded = false; JsonArrayExtendedRequest request = new JsonArrayExtendedRequest( TimestampUtils.addTimestamp(Config.HOST + "v1d50/game/column/" + id +"?page="+ page, Constants.GAME_CD), new Response.Listener() { - @Override public void onResponse(JSONArray response) { processingData(response); } + }, + new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + // 无网络连接 + if (error.getClass().equals(NoConnectionError.class) + || error.getClass().equals(TimeoutError.class)) { + if (page == 1){ + if (subject_pb_loading != null && subject_pb_loading.getVisibility() == View.VISIBLE) { + subject_pb_loading.setVisibility(View.GONE); + } + Toast.makeText(context, "网络错误", Toast.LENGTH_SHORT).show(); + subject_list.setVisibility(View.GONE); + reuse_no_connection.setVisibility(View.VISIBLE); + }else { + Toast.makeText(context, "网络错误", Toast.LENGTH_SHORT).show(); + isNetworkError = true; + notifyDataSetChanged(); + } - }, new Response.ErrorListener() { - - @Override - public void onErrorResponse(VolleyError error) { - // 无网络连接 - if (error.getClass().equals(NoConnectionError.class) - || error.getClass().equals(TimeoutError.class)) { - if (page == 1){ - if (subject_pb_loading != null && subject_pb_loading.getVisibility() == View.VISIBLE) { - subject_pb_loading.setVisibility(View.GONE); } - Toast.makeText(context, "网络错误", Toast.LENGTH_SHORT).show(); - subject_list.setVisibility(View.GONE); - reuse_no_connection.setVisibility(View.VISIBLE); - }else { - Toast.makeText(context, "网络错误", Toast.LENGTH_SHORT).show(); - isNetworkError = true; - notifyDataSetChanged(); } - - } - } - - }); + }); AppController.addToRequestQueue(request, SubjectActivity.class); } @@ -185,7 +180,7 @@ public class SubjectAdapter extends RecyclerView.Adapter kv = new HashMap(); + Map kv = new HashMap<>(); kv.put("入口", "热门卡牌"); DataUtils.onEvent(context, "游戏详情", entity.getName(), kv); diff --git a/app/src/main/java/com/gh/gamecenter/download/DownLoadFragment.java b/app/src/main/java/com/gh/gamecenter/download/DownLoadFragment.java index f96ca96bfb..910320131d 100644 --- a/app/src/main/java/com/gh/gamecenter/download/DownLoadFragment.java +++ b/app/src/main/java/com/gh/gamecenter/download/DownLoadFragment.java @@ -9,7 +9,7 @@ import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.TextView; +import android.widget.LinearLayout; import com.gh.common.util.PackageUtils; import com.gh.download.DataWatcher; @@ -41,7 +41,7 @@ public class DownLoadFragment extends Fragment { private View view; private RecyclerView downloadmanager_rv_show; private DownloadAdapter adapter; - private TextView downloadmanager_tv_none; + private LinearLayout reuse_none_data; private ArrayMap locationMap; private ArrayMap statusMap; @@ -103,8 +103,8 @@ public class DownLoadFragment extends Fragment { int base = (adapter.getDoneList().isEmpty() ? 0 : 1 + adapter.getDoneList().size()); if (adapter.getDownloadingList().size() == 1) { adapter.notifyItemRangeInserted(base, 2); - if (downloadmanager_tv_none.getVisibility() == View.VISIBLE) { - downloadmanager_tv_none.setVisibility(View.GONE); + if (reuse_none_data.getVisibility() == View.VISIBLE) { + reuse_none_data.setVisibility(View.GONE); } } else { adapter.notifyItemInserted(base + adapter.getDownloadingList().size()); @@ -129,11 +129,11 @@ public class DownLoadFragment extends Fragment { urlMap = new ArrayMap<>(); deleteList = new ArrayList<>(); - downloadmanager_tv_none = (TextView) view.findViewById(R.id.downloadmanager_tv_none); + reuse_none_data = (LinearLayout) view.findViewById(R.id.reuse_none_data); downloadmanager_rv_show = (RecyclerView) view.findViewById(R.id.downloadmanager_rv_show); downloadmanager_rv_show.setHasFixedSize(true); - adapter = new DownloadAdapter(getActivity(), downloadmanager_rv_show, downloadmanager_tv_none, + adapter = new DownloadAdapter(getActivity(), downloadmanager_rv_show, reuse_none_data, locationMap, statusMap, deleteList); downloadmanager_rv_show.setAdapter(adapter); downloadmanager_rv_show.setLayoutManager(new LinearLayoutManager(getActivity())); @@ -174,8 +174,8 @@ public class DownLoadFragment extends Fragment { EventBus.getDefault().post(new EBDownloadChanged("download", View.GONE, 0)); locationMap.clear(); adapter.notifyDataSetChanged(); - if (downloadmanager_tv_none.getVisibility() == View.GONE) { - downloadmanager_tv_none.setVisibility(View.VISIBLE); + if (reuse_none_data.getVisibility() == View.GONE) { + reuse_none_data.setVisibility(View.VISIBLE); } } else if (adapter.getDoneList().isEmpty()) { EventBus.getDefault().post(new EBDownloadChanged("download", View.VISIBLE, @@ -238,7 +238,7 @@ public class DownLoadFragment extends Fragment { adapter.notifyDataSetChanged(); if (adapter.getDownloadingList().isEmpty() && adapter.getDoneList().isEmpty()) { - downloadmanager_tv_none.setVisibility(View.VISIBLE); + reuse_none_data.setVisibility(View.VISIBLE); } } @@ -254,7 +254,7 @@ public class DownLoadFragment extends Fragment { EventBus.getDefault().unregister(this); view = null; downloadmanager_rv_show = null; - downloadmanager_tv_none = null; + reuse_none_data = null; locationMap = null; statusMap = null; urlMap = null; diff --git a/app/src/main/java/com/gh/gamecenter/download/DownloadAdapter.java b/app/src/main/java/com/gh/gamecenter/download/DownloadAdapter.java index c116da4d22..dd6e7c4192 100644 --- a/app/src/main/java/com/gh/gamecenter/download/DownloadAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/download/DownloadAdapter.java @@ -45,7 +45,7 @@ public class DownloadAdapter extends RecyclerView.Adapter downloadingList; private List doneList; @@ -56,7 +56,7 @@ public class DownloadAdapter extends RecyclerView.Adapter lMap, ArrayMap sMap, ArrayList dList) { @@ -149,7 +149,7 @@ public class DownloadAdapter extends RecyclerView.Adapter private Context context; private LinearLayout gameupdate_ll_loading; - private TextView gameupdate_tv_none; + private LinearLayout gameupdate_tv_none; private ArrayMap locationMap; private ArrayMap packageNameMap; @@ -73,7 +73,7 @@ public class UpdateAdapter extends RecyclerView.Adapter public UpdateAdapter(Context context, LinearLayout loading, - TextView none, + LinearLayout none, String packageName, boolean isUpdate) { this.context = context; @@ -468,7 +468,7 @@ public class UpdateAdapter extends RecyclerView.Adapter if (successMap.get(position - 1)) { viewHolder.gu_item_btv_update.setText("启动"); - viewHolder.gu_item_btv_update.setTextColor(0xFFFFFFFF); + viewHolder.gu_item_btv_update.setTextColor(Color.WHITE); viewHolder.gu_item_btv_update.setBackgroundResource(R.drawable.game_item_btn_launch_style); } else { DownloadEntry entry = entryMap.get(position - 1); @@ -479,17 +479,17 @@ public class UpdateAdapter extends RecyclerView.Adapter viewHolder.gu_item_btv_update.setBackgroundResource(R.drawable.game_item_btn_plugining_style); } else { viewHolder.gu_item_btv_update.setText("更新中"); - viewHolder.gu_item_btv_update.setTextColor(0xFF1BA4FC); + viewHolder.gu_item_btv_update.setTextColor(context.getResources().getColor(R.color.theme)); viewHolder.gu_item_btv_update.setBackgroundResource(R.drawable.game_item_btn_downloading_style); } } else { if (updateEntity.isPlugin()) { viewHolder.gu_item_btv_update.setText("插件化"); - viewHolder.gu_item_btv_update.setTextColor(0xFFFFFFFF); + viewHolder.gu_item_btv_update.setTextColor(Color.WHITE); viewHolder.gu_item_btv_update.setBackgroundResource(R.drawable.game_item_btn_plugin_style); } else { viewHolder.gu_item_btv_update.setText("更新"); - viewHolder.gu_item_btv_update.setTextColor(0xFFFFFFFF); + viewHolder.gu_item_btv_update.setTextColor(Color.WHITE); viewHolder.gu_item_btv_update.setBackgroundResource(R.drawable.game_item_btn_download_style); } } @@ -506,7 +506,7 @@ public class UpdateAdapter extends RecyclerView.Adapter viewHolder.gu_item_btv_update.setBackgroundResource(R.drawable.game_item_btn_plugining_style); } else { viewHolder.gu_item_btv_update.setText("更新中"); - viewHolder.gu_item_btv_update.setTextColor(0xFF1BA4FC); + viewHolder.gu_item_btv_update.setTextColor(context.getResources().getColor(R.color.theme)); viewHolder.gu_item_btv_update.setBackgroundResource(R.drawable.game_item_btn_downloading_style); } @@ -554,7 +554,7 @@ public class UpdateAdapter extends RecyclerView.Adapter size = size / 1024f; unit = "GB"; } - String str = size + ""; + String str = String.valueOf(size); int index = str.lastIndexOf("."); if (index != -1 && str.length() >= index + 3) { str = str.substring(0, index + 3); diff --git a/app/src/main/java/com/gh/gamecenter/download/UpdateFragment.java b/app/src/main/java/com/gh/gamecenter/download/UpdateFragment.java index 3f47f06961..5291935fbe 100644 --- a/app/src/main/java/com/gh/gamecenter/download/UpdateFragment.java +++ b/app/src/main/java/com/gh/gamecenter/download/UpdateFragment.java @@ -9,7 +9,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; -import android.widget.TextView; import com.gh.gamecenter.R; import com.gh.gamecenter.eventbus.EBDownloadChanged; @@ -32,7 +31,7 @@ public class UpdateFragment extends Fragment { private RecyclerView gameupdate_rv_show; private UpdateAdapter adapter; private LinearLayout gameupdate_ll_loading; - private TextView gameupdate_tv_none; + private LinearLayout reuse_none_data; private String packageName; private boolean isUpdate; @@ -69,13 +68,13 @@ public class UpdateFragment extends Fragment { gameupdate_ll_loading = (LinearLayout) view.findViewById(R.id.gameupdate_ll_loading); - gameupdate_tv_none = (TextView) view.findViewById(R.id.gameupdate_tv_none); + reuse_none_data = (LinearLayout) view.findViewById(R.id.reuse_none_data); gameupdate_rv_show = (RecyclerView) view.findViewById(R.id.gameupdate_rv_show); gameupdate_rv_show.setHasFixedSize(true); gameupdate_rv_show.setLayoutManager(new LinearLayoutManager(getActivity())); adapter = new UpdateAdapter(getActivity(), gameupdate_ll_loading, - gameupdate_tv_none, packageName, isUpdate); + reuse_none_data, packageName, isUpdate); gameupdate_rv_show.setAdapter(adapter); EventBus.getDefault().register(this); @@ -102,8 +101,8 @@ public class UpdateFragment extends Fragment { gameupdate_rv_show.getAdapter().notifyDataSetChanged(); EventBus.getDefault().post( new EBDownloadChanged("update", View.GONE, adapter.getUpdateList().size())); - if (gameupdate_tv_none.getVisibility() == View.GONE) { - gameupdate_tv_none.setVisibility(View.VISIBLE); + if (reuse_none_data.getVisibility() == View.GONE) { + reuse_none_data.setVisibility(View.VISIBLE); } } else { adapter.getUpdateList().remove(location.intValue()); @@ -138,8 +137,8 @@ public class UpdateFragment extends Fragment { if (adapter.getUpdateList().size() == 1) { adapter.getUpdateList().remove(location.intValue()); adapter.notifyItemRangeRemoved(0, 2); - if (gameupdate_tv_none.getVisibility() == View.GONE) { - gameupdate_tv_none.setVisibility(View.VISIBLE); + if (reuse_none_data.getVisibility() == View.GONE) { + reuse_none_data.setVisibility(View.VISIBLE); } } else { adapter.getUpdateList().remove(location.intValue()); @@ -164,7 +163,7 @@ public class UpdateFragment extends Fragment { view = null; gameupdate_rv_show = null; gameupdate_ll_loading = null; - gameupdate_tv_none = null; + reuse_none_data = null; packageName = null; } } diff --git a/app/src/main/java/com/gh/gamecenter/game/Game1Fragment.java b/app/src/main/java/com/gh/gamecenter/game/Game1Fragment.java index 3658a893f6..18b20bea8d 100644 --- a/app/src/main/java/com/gh/gamecenter/game/Game1Fragment.java +++ b/app/src/main/java/com/gh/gamecenter/game/Game1Fragment.java @@ -171,7 +171,7 @@ public class Game1Fragment extends Fragment implements SwipeRefreshLayout.OnRefr }); game_swipe_refresh = (SwipeRefreshLayout) view.findViewById(R.id.game_swipe_refresh); - game_swipe_refresh.setColorSchemeResources(R.color.theme_colors); + game_swipe_refresh.setColorSchemeResources(R.color.theme); game_swipe_refresh.setOnRefreshListener(this); game_pb_loading = (ProgressBarCircularIndeterminate) view.findViewById(R.id.game_pb_loading); diff --git a/app/src/main/java/com/gh/gamecenter/game/Game1FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/game/Game1FragmentAdapter.java index c8589b8df7..5777c50cf6 100644 --- a/app/src/main/java/com/gh/gamecenter/game/Game1FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/game/Game1FragmentAdapter.java @@ -325,7 +325,7 @@ public class Game1FragmentAdapter extends RecyclerView.Adapter infos = concernManager.getInstalledGame(); final int size = infos.size(); - final List list = new ArrayList(); + final List list = new ArrayList<>(); count = 0; for (ConcernInfo info : infos) { JsonObjectExtendedRequest request = new JsonObjectExtendedRequest( @@ -647,7 +647,7 @@ public class Game1FragmentAdapter extends RecyclerView.Adapter offset && position <= subjectList.get(i).getData().size() + offset) { + if (position > offset + && position <= subjectList.get(i).getData().size() + offset) { int index = position -offset-1; - if (index<0){ + if (index < 0){ index = 0; } gameEntity = subjectList.get(i).getData().get(index); @@ -756,20 +757,20 @@ public class Game1FragmentAdapter extends RecyclerView.Adapter kv = new HashMap(); + Map kv = new HashMap<>(); kv.put("名字", gameEntity.getName()); kv.put("位置", 1); DataUtils.onEvent(context, "点击", "游戏-插件-" + subjectEntity.getName(), kv); @@ -168,20 +168,20 @@ public class GameListAdapter extends RecyclerView.Adapter kv = new HashMap(); + Map kv = new HashMap<>(); kv.put("名字", gameEntity.getName()); kv.put("位置", i); DataUtils.onEvent(context, "点击", "游戏-插件-" + gameEntity, kv); @@ -233,7 +233,7 @@ public class GameListAdapter extends RecyclerView.Adapter kv = new HashMap(); + Map kv = new HashMap<>(); kv.put("名字", gameEntity.getName()); kv.put("位置", i); DataUtils.onEvent(context, "点击", "游戏-插件-" + subjectEntity.getName(), kv); diff --git a/app/src/main/java/com/gh/gamecenter/game/NewGame2FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/game/NewGame2FragmentAdapter.java index a84d6a7282..0fe13dd220 100644 --- a/app/src/main/java/com/gh/gamecenter/game/NewGame2FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/game/NewGame2FragmentAdapter.java @@ -166,9 +166,9 @@ public class NewGame2FragmentAdapter extends RecyclerView.Adapter data = subjectEntity.getData(); - int index = 0; + int index; for (int i = 0; i < subjectEntity.getData().size()+1; i++) { index = i-1; if (index<0){ @@ -184,7 +184,7 @@ public class NewGame2FragmentAdapter extends RecyclerView.Adapter kv = new HashMap(); + Map kv = new HashMap<>(); kv.put("名字", finalEntity1.getName()); kv.put("位置", position + 1); DataUtils.onEvent(mContext, "点击", "游戏-推荐-" + subjectEntity.getName(), kv); @@ -252,7 +252,7 @@ public class NewGame2FragmentAdapter extends RecyclerView.Adapter kv = new HashMap(); + Map kv = new HashMap<>(); kv.put("名字", finalEntity.getName()); kv.put("位置", position); DataUtils.onEvent(mContext, "点击", "游戏-插件-" + subjectEntity.getName(), kv); diff --git a/app/src/main/java/com/gh/gamecenter/gamedetails/GameDetailsFragment.java b/app/src/main/java/com/gh/gamecenter/gamedetails/GameDetailsFragment.java index ba16b2edbe..d6f242c39f 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetails/GameDetailsFragment.java +++ b/app/src/main/java/com/gh/gamecenter/gamedetails/GameDetailsFragment.java @@ -1,6 +1,7 @@ package com.gh.gamecenter.gamedetails; import android.content.Intent; +import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; @@ -964,7 +965,7 @@ public class GameDetailsFragment extends Fragment { RelativeLayout relativeLayout = new RelativeLayout( getActivity()); - relativeLayout.setBackgroundColor(0xffffffff); + relativeLayout.setBackgroundColor(Color.WHITE); LayoutParams params = new LayoutParams( LayoutParams.MATCH_PARENT, normalHeight); relativeLayout.setLayoutParams(params); diff --git a/app/src/main/java/com/gh/gamecenter/gamedetails/GameInformationFragment.java b/app/src/main/java/com/gh/gamecenter/gamedetails/GameInformationFragment.java index b0f504785e..099beb7bd8 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetails/GameInformationFragment.java +++ b/app/src/main/java/com/gh/gamecenter/gamedetails/GameInformationFragment.java @@ -671,7 +671,7 @@ public class GameInformationFragment extends Fragment { viewHolder.item_et_search.setText(keyword); viewHolder.item_et_search.setSelection(keyword.length()); viewHolder.item_et_search.requestFocus(); - Spanned content = Html.fromHtml("与“" + Spanned content = Html.fromHtml("与“" + keyword + "”相关的资讯共" + adapter.getNewsList().size() + "条"); viewHolder.item_tv_search_result.setText(content); @@ -693,13 +693,13 @@ public class GameInformationFragment extends Fragment { viewHolder.item_rv_select.setLayoutParams(lparams); } } else if (position >= 3 && position <= newsList.size() + 2) { - viewHolder.information_type.setText((position - 2) + ""); + viewHolder.information_type.setText(String.valueOf(position - 2)); if (currentPosition == -1) { String title = adapter .getNewsList() .get(position - 3) .getTitle() - .replace(keyword, "" + keyword + ""); + .replace(keyword, "" + keyword + ""); Spanned content = Html.fromHtml(title); viewHolder.information_title.setText(content); } else { @@ -804,9 +804,8 @@ public class GameInformationFragment extends Fragment { view = relativeLayout; } else if (isNull && i == 2) { view = LayoutInflater.from(viewGroup.getContext()).inflate( - R.layout.reuse_none_date, viewGroup, false); - TextView hint = (TextView) view - .findViewById(R.id.reuse_tv_none); + R.layout.reuse_none_data, viewGroup, false); + TextView hint = (TextView) view.findViewById(R.id.reuse_tv_none_data); hint.setText("暂无数据"); int height = fm_gameinformation_rv_show.getHeight() - DisplayUtils.dip2px(getActivity(), 29); @@ -820,9 +819,8 @@ public class GameInformationFragment extends Fragment { } else if (isRemove && (newsList == null || newsList.isEmpty()) && i == 3) { view = LayoutInflater.from(viewGroup.getContext()).inflate( - R.layout.reuse_none_date, viewGroup, false); - TextView hint = (TextView) view - .findViewById(R.id.reuse_tv_none); + R.layout.reuse_none_data, viewGroup, false); + TextView hint = (TextView) view.findViewById(R.id.reuse_tv_none_data); int height = 0; if (currentPosition == -1) { hint.setText("搜索为空"); diff --git a/app/src/main/java/com/gh/gamecenter/gamedetails/GameStrategyFragment.java b/app/src/main/java/com/gh/gamecenter/gamedetails/GameStrategyFragment.java index f4089a4c8f..f82e3a29c6 100644 --- a/app/src/main/java/com/gh/gamecenter/gamedetails/GameStrategyFragment.java +++ b/app/src/main/java/com/gh/gamecenter/gamedetails/GameStrategyFragment.java @@ -683,7 +683,7 @@ public class GameStrategyFragment extends Fragment { viewHolder.item_et_search.setText(keyword); viewHolder.item_et_search.setSelection(keyword.length()); viewHolder.item_et_search.requestFocus(); - Spanned content = Html.fromHtml("与“" + Spanned content = Html.fromHtml("与“" + keyword + "”相关的资讯共" + adapter.getNewsList().size() + "条"); viewHolder.item_tv_search_result.setText(content); @@ -706,7 +706,7 @@ public class GameStrategyFragment extends Fragment { } } else if (position >= 3 && position <= adapter.getNewsList().size() + 2) { - viewHolder.information_type.setText((position - 2) + ""); + viewHolder.information_type.setText(String.valueOf(position - 2)); if (currentPosition == -1) { String title = adapter .getNewsList() @@ -714,7 +714,7 @@ public class GameStrategyFragment extends Fragment { .getTitle() .replace( keyword, - "" + keyword + "" + keyword + ""); Spanned content = Html.fromHtml(title); viewHolder.information_title.setText(content); @@ -823,9 +823,8 @@ public class GameStrategyFragment extends Fragment { view = relativeLayout; } else if (isNull && i == 2) { view = LayoutInflater.from(viewGroup.getContext()).inflate( - R.layout.reuse_none_date, viewGroup, false); - TextView hint = (TextView) view - .findViewById(R.id.reuse_tv_none); + R.layout.reuse_none_data, viewGroup, false); + TextView hint = (TextView) view.findViewById(R.id.reuse_tv_none_data); hint.setText("暂无数据"); int height = fm_gamestrategy_rv_show.getHeight() - DisplayUtils.dip2px(getActivity(), 29); @@ -840,9 +839,8 @@ public class GameStrategyFragment extends Fragment { } else if (isRemove && (newsList == null || newsList.isEmpty()) && i == 3) { view = LayoutInflater.from(viewGroup.getContext()).inflate( - R.layout.reuse_none_date, viewGroup, false); - TextView hint = (TextView) view - .findViewById(R.id.reuse_tv_none); + R.layout.reuse_none_data, viewGroup, false); + TextView hint = (TextView) view.findViewById(R.id.reuse_tv_none_data); int height = 0; if (currentPosition == -1) { hint.setText("搜索为空"); diff --git a/app/src/main/java/com/gh/gamecenter/news/NewNews4Fragment.java b/app/src/main/java/com/gh/gamecenter/news/NewNews4Fragment.java index 284b338495..dff1671a3f 100644 --- a/app/src/main/java/com/gh/gamecenter/news/NewNews4Fragment.java +++ b/app/src/main/java/com/gh/gamecenter/news/NewNews4Fragment.java @@ -12,7 +12,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; -import android.widget.TextView; import com.gc.materialdesign.views.ProgressBarCircularIndeterminate; import com.gh.common.constant.Config; @@ -24,7 +23,6 @@ import com.gh.gamecenter.db.info.ConcernInfo; import com.gh.gamecenter.manager.ConcernManager; import org.json.JSONArray; -import org.json.JSONException; import java.util.ArrayList; import java.util.Collections; @@ -41,7 +39,7 @@ public class NewNews4Fragment extends Fragment implements NewNews4FragmentAdapte private NewNews4FragmentAdapter mNews4FragmentAdapter; private LinearLayoutManager mLayoutManager; private LinearLayout noConnection; - private TextView noConcern; + private LinearLayout reuse_none_data; private SwipeRefreshLayout mSwipeRefreshLayout; private ProgressBarCircularIndeterminate mProgressBar; @@ -49,13 +47,9 @@ public class NewNews4Fragment extends Fragment implements NewNews4FragmentAdapte private boolean isRemove = false; private boolean isNetworkError = false; - private NewNews4Fragment news4Fragment = this; - private int page = 1; - private String updateGameId; - - private List listGameId; + private List gameIdList; private ConcernManager manager; @@ -64,42 +58,26 @@ public class NewNews4Fragment extends Fragment implements NewNews4FragmentAdapte public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.what == 0){ - String concernID = (String) msg.obj; StringBuffer concernKey = new StringBuffer(); concernKey.setLength(0); StringBuffer gameIdPostData = new StringBuffer(); - listGameId.clear(); - try { - JSONArray jsonArray = new JSONArray(concernID); - for (int i= 0; i< jsonArray.length(); i++){ - String gameId = (String) jsonArray.get(i); - listGameId.add(gameId); - if (i< 5){ - gameIdPostData.append(gameId + "-"); - } + for (int i = 0, size = gameIdList.size(); i < size; i++){ + if (i < 5) { + gameIdPostData.append(gameIdList.get(i)); + gameIdPostData.append("-"); } - //数据进行排序后进行MD5操作 - Collections.sort(listGameId, new Comparator() { - @Override - public int compare(String lhs, String rhs) { - return lhs.compareTo(rhs); - } - }); - for (int i= 0; i< listGameId.size(); i++) { - concernKey.append(listGameId.get(i)); - } - String contentMD5 = MD5Utils.getContentMD5(concernKey.toString()); - - if (gameIdPostData.length()>0){ - gameIdPostData.deleteCharAt(gameIdPostData.length()-1); - } - mNews4FragmentAdapter = new NewNews4FragmentAdapter(getActivity(), news4Fragment, contentMD5,gameIdPostData.toString(),page); - mRecyclerView.setAdapter(mNews4FragmentAdapter); - - } catch (JSONException e) { - e.printStackTrace(); } + for (int i = 0; i < gameIdList.size(); i++) { + concernKey.append(gameIdList.get(i)); + } + String contentMD5 = MD5Utils.getContentMD5(concernKey.toString()); + if (gameIdPostData.length() > 0) { + gameIdPostData.deleteCharAt(gameIdPostData.length() - 1); + } + mNews4FragmentAdapter = new NewNews4FragmentAdapter(getActivity(), NewNews4Fragment.this, + contentMD5, gameIdPostData.toString(), page); + mRecyclerView.setAdapter(mNews4FragmentAdapter); } } }; @@ -107,20 +85,20 @@ public class NewNews4Fragment extends Fragment implements NewNews4FragmentAdapte public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_news4,null); + mView = View.inflate(getActivity(), R.layout.fragment_news4, null); mRecyclerView = (RecyclerView) mView.findViewById(R.id.news4_rv); mSwipeRefreshLayout = (SwipeRefreshLayout) mView.findViewById(R.id.news4_swipe_refresh); mProgressBar = (ProgressBarCircularIndeterminate) mView.findViewById(R.id.news4_pb_loading); noConnection = (LinearLayout) mView.findViewById(R.id.reuse_no_connection); - noConcern = (TextView) mView.findViewById(R.id.concern_tv_none); + reuse_none_data = (LinearLayout) mView.findViewById(R.id.reuse_none_data); mLayoutManager = new LinearLayoutManager(getActivity()); mRecyclerView.setLayoutManager(mLayoutManager); manager = new ConcernManager(getActivity()); - listGameId = new ArrayList<>(); + gameIdList = new ArrayList<>(); - LoadConcernGameId(); + loadConcernGameId(); mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override @@ -136,13 +114,13 @@ public class NewNews4Fragment extends Fragment implements NewNews4FragmentAdapte } }); - mSwipeRefreshLayout.setColorSchemeResources(R.color.theme_colors); + mSwipeRefreshLayout.setColorSchemeResources(R.color.theme); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { page = 1; isRemove = false; - LoadConcernGameId(); + loadConcernGameId(); } }); noConnection.setOnClickListener(new View.OnClickListener() { @@ -154,27 +132,30 @@ public class NewNews4Fragment extends Fragment implements NewNews4FragmentAdapte @Override public void run() { isNetworkError = false; - LoadConcernGameId(); + loadConcernGameId(); } },1000); } }); } - private void LoadConcernGameId() { - JSONArray jsonArray = new JSONArray(); + private void loadConcernGameId() { List concernGame = manager.getConcernGame(); - + gameIdList.clear(); for (ConcernInfo concernInfo : concernGame) { - jsonArray.put(concernInfo.getId()); + gameIdList.add(concernInfo.getId()); } - updateGameId = jsonArray.toString(); - Message message = new Message(); - message.obj = jsonArray.toString(); - message.what = 0; - handler.sendMessage(message); - noConcern.setVisibility(View.GONE); + // 对数据进行排序 + Collections.sort(gameIdList, new Comparator() { + @Override + public int compare(String lhs, String rhs) { + return lhs.compareTo(rhs); + } + }); + + handler.sendEmptyMessage(0); + reuse_none_data.setVisibility(View.GONE); } @Nullable @@ -206,28 +187,28 @@ public class NewNews4Fragment extends Fragment implements NewNews4FragmentAdapte @Override public void isNetworkError(boolean netWorkError) { isNetworkError = netWorkError; - if (isNetworkError == true){ + if (isNetworkError){ noConnection.setVisibility(View.VISIBLE); }else { noConnection.setVisibility(View.GONE); } } - @Override - public void updateconcern() { - String uuid = ConcernUtils.UUID(getActivity()); + public void updateConcern() { + String uuid = ConcernUtils.uuid(getActivity()); - ConcernUtils.UpdateConcernData(Config.HOST + "v2d0/device/" + uuid + "/concern", updateGameId, new ConcernUtils.DownJsonListener() { - @Override - public void downSucced(String str) { - Utils.log("更新设备游戏成功"); - } + ConcernUtils.updateConcernData(Config.HOST + "v2d0/device/" + uuid + "/concern", new JSONArray(gameIdList), + new ConcernUtils.DownJsonListener() { + @Override + public void downSucced(String str) { + Utils.log("更新设备游戏成功"); + } - @Override - public void downFailed() { - Utils.log("更新设备游戏失败"); - } - }); + @Override + public void downFailed() { + Utils.log("更新设备游戏失败"); + } + }); } @Override @@ -236,7 +217,7 @@ public class NewNews4Fragment extends Fragment implements NewNews4FragmentAdapte if (mSwipeRefreshLayout.isRefreshing()){ mSwipeRefreshLayout.setRefreshing(false); } - noConcern.setVisibility(View.VISIBLE); + reuse_none_data.setVisibility(View.VISIBLE); } } diff --git a/app/src/main/java/com/gh/gamecenter/news/NewNews4FragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/news/NewNews4FragmentAdapter.java index a81b8c3fa2..45ffb59da9 100644 --- a/app/src/main/java/com/gh/gamecenter/news/NewNews4FragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/news/NewNews4FragmentAdapter.java @@ -118,7 +118,7 @@ public class NewNews4FragmentAdapter extends RecyclerView.Adapter 5){ LoadJosnData(page); - callBackListener.updateconcern(); + callBackListener.updateConcern(); }else { callBackListener.concernNewsData(true); } @@ -321,7 +321,7 @@ public class NewNews4FragmentAdapter extends RecyclerView.Adapter(); - viewsMap = new ArrayMap(); - urlList = new ArrayList(); + newsList = new ArrayList<>(); + viewsMap = new ArrayMap<>(); + urlList = new ArrayList<>(); isLoading = false; isRemove = false; @@ -257,7 +257,7 @@ public class News1FragmentAdapter extends RecyclerView.Adapter kv = new HashMap(); + Map kv = new HashMap<>(); kv.put("名字", newsEntity.getTitle()); kv.put("位置", position + 1); DataUtils.onEvent(context, "点击", "资讯-资讯", kv); @@ -274,7 +274,7 @@ public class News1FragmentAdapter extends RecyclerView.Adapter kv = new HashMap(); + Map kv = new HashMap<>(); kv.put("名字", newsEntity.getTitle()); kv.put("位置", position + 1); DataUtils.onEvent(context, "点击", "资讯-资讯", kv); @@ -316,7 +316,7 @@ public class News1FragmentAdapter extends RecyclerView.Adapter kv = new HashMap(); + Map kv = new HashMap<>(); kv.put("名字", newsEntity.getTitle()); kv.put("位置", position + 1); DataUtils.onEvent(context, "点击", "资讯-资讯", kv); @@ -343,7 +343,7 @@ public class News1FragmentAdapter extends RecyclerView.Adapter concernList; private List concernGameList; @@ -88,7 +88,7 @@ public class News4FragmentAdapter extends RecyclerView recyclerView, ProgressBarCircularIndeterminate pbLoading, LinearLayout linearLayout, - TextView textView, + LinearLayout textView, boolean isLoad) { context = con; news_list = recyclerView; @@ -433,7 +433,7 @@ public class News4FragmentAdapter extends holder.footerview_tv_loading.setBackgroundResource(R.drawable.border_blue_bg); int i = (int) (context.getResources().getDisplayMetrics().density * 5); holder.footerview_tv_loading.setPadding(i,i,i,i); - holder.footerview_tv_loading.setTextColor(0xff1BA4FC); + holder.footerview_tv_loading.setTextColor(context.getResources().getColor(R.color.theme)); holder.itemView.setClickable(true); holder.itemView.setOnClickListener(new OnClickListener() { @Override diff --git a/app/src/main/java/com/gh/gamecenter/news/NewsFragment.java b/app/src/main/java/com/gh/gamecenter/news/NewsFragment.java index 97d9537c99..7aad647ca4 100644 --- a/app/src/main/java/com/gh/gamecenter/news/NewsFragment.java +++ b/app/src/main/java/com/gh/gamecenter/news/NewsFragment.java @@ -186,7 +186,7 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View int downloadSize = DownloadManager.getInstance(getActivity()).getAll().size(); if (downloadSize != 0) { downloadHint.setVisibility(View.VISIBLE); - downloadHint.setText(downloadSize + ""); + downloadHint.setText(String.valueOf(downloadSize)); int width = DisplayUtils.dip2px(getActivity(), 12); RelativeLayout.LayoutParams rparams = new RelativeLayout.LayoutParams( width, width); @@ -253,7 +253,7 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View if (id == R.id.actionbar_notification) { DataUtils.onEvent(getActivity(), "主页", "关注图标"); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("location", "关注图标"); map.put("createOn", System.currentTimeMillis() / 1000); map.put("page", "主页"); @@ -263,23 +263,17 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View } else if (id == R.id.actionbar_rl_download) { DataUtils.onEvent(getActivity(), "主页", "下载图标"); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("location", "下载图标"); map.put("createOn", System.currentTimeMillis() / 1000); map.put("page", "主页"); DataCollectionManager.onEvent(getActivity(), "click-item", map); - if (downloadHint != null - && downloadHint.getVisibility() == View.VISIBLE) { - downloadHint.setVisibility(View.GONE); - EventBus.getDefault().post(new EBTopState("隐藏", null)); - } - startActivity(new Intent(getActivity(), - DownloadManagerActivity.class)); + startActivity(new Intent(getActivity(), DownloadManagerActivity.class)); } else if (id == R.id.actionbar_search_input) { DataUtils.onEvent(getActivity(), "主页", "搜索框"); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("location", "搜索框"); map.put("createOn", System.currentTimeMillis() / 1000); map.put("page", "主页"); @@ -292,7 +286,7 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View } else if (id == R.id.actionbar_iv_search) { DataUtils.onEvent(getActivity(), "主页", "搜索图标"); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("location", "搜索图标"); map.put("createOn", System.currentTimeMillis() / 1000); map.put("page", "主页"); @@ -335,37 +329,37 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View tvYuanchuang.setClickable(true); tvGonglve.setClickable(true); tvGuanzhu.setClickable(true); - tvZixun.setTextColor(getResources().getColor(R.color.theme_colors)); - tvYuanchuang.setTextColor(0xFF333333); - tvGonglve.setTextColor(0xFF333333); - tvGuanzhu.setTextColor(0xFF333333); + tvZixun.setTextColor(getResources().getColor(R.color.theme)); + tvYuanchuang.setTextColor(getResources().getColor(R.color.title)); + tvGonglve.setTextColor(getResources().getColor(R.color.title)); + tvGuanzhu.setTextColor(getResources().getColor(R.color.title)); } else if (position == 1) { tvZixun.setClickable(true); tvYuanchuang.setClickable(false); tvGonglve.setClickable(true); tvGuanzhu.setClickable(true); - tvZixun.setTextColor(0xFF333333); - tvYuanchuang.setTextColor(getResources().getColor(R.color.theme_colors)); - tvGonglve.setTextColor(0xFF333333); - tvGuanzhu.setTextColor(0xFF333333); + tvZixun.setTextColor(getResources().getColor(R.color.title)); + tvYuanchuang.setTextColor(getResources().getColor(R.color.theme)); + tvGonglve.setTextColor(getResources().getColor(R.color.title)); + tvGuanzhu.setTextColor(getResources().getColor(R.color.title)); } else if (position == 2) { tvZixun.setClickable(true); tvYuanchuang.setClickable(true); tvGonglve.setClickable(false); tvGuanzhu.setClickable(true); - tvZixun.setTextColor(0xFF333333); - tvYuanchuang.setTextColor(0xFF333333); - tvGonglve.setTextColor(getResources().getColor(R.color.theme_colors)); - tvGuanzhu.setTextColor(0xFF333333); + tvZixun.setTextColor(getResources().getColor(R.color.title)); + tvYuanchuang.setTextColor(getResources().getColor(R.color.title)); + tvGonglve.setTextColor(getResources().getColor(R.color.theme)); + tvGuanzhu.setTextColor(getResources().getColor(R.color.title)); }else if (position == 3){ tvZixun.setClickable(true); tvYuanchuang.setClickable(true); tvGonglve.setClickable(true); tvGuanzhu.setClickable(false); - tvZixun.setTextColor(0xFF333333); - tvYuanchuang.setTextColor(0xFF333333); - tvGonglve.setTextColor(0xFF333333); - tvGuanzhu.setTextColor(getResources().getColor(R.color.theme_colors)); + tvZixun.setTextColor(getResources().getColor(R.color.title)); + tvYuanchuang.setTextColor(getResources().getColor(R.color.title)); + tvGonglve.setTextColor(getResources().getColor(R.color.title)); + tvGuanzhu.setTextColor(getResources().getColor(R.color.theme)); } } @@ -407,7 +401,7 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View int downloadSize = DownloadManager.getInstance(getActivity()).getAll().size(); if (type == 1 && downloadSize == 0) { downloadHint.setVisibility(View.VISIBLE); - downloadHint.setText((downloadSize + type) + ""); + downloadHint.setText(String.valueOf(downloadSize + type)); int width = DisplayUtils.dip2px(getActivity(), 12); RelativeLayout.LayoutParams rparams = new RelativeLayout.LayoutParams( width, width); @@ -432,7 +426,7 @@ public class NewsFragment extends Fragment implements View.OnClickListener, View } } else if (downloadSize != 0) { downloadHint.setVisibility(View.VISIBLE); - downloadHint.setText((downloadSize + type) + ""); + downloadHint.setText(String.valueOf(downloadSize + type)); } } diff --git a/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.java b/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.java index 7397d6d7b2..6738db6153 100644 --- a/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.java +++ b/app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.java @@ -95,9 +95,9 @@ public class PersonalFragment extends Fragment implements View.OnClickListener, dis = outMetrics.widthPixels / 4 + DisplayUtils.dip2px(getActivity(), 20); - me_tv_top_install.setTextColor(0xFF1BA4FC); + me_tv_top_install.setTextColor(getActivity().getResources().getColor(R.color.theme)); me_tv_top_install.setClickable(false); - me_tv_top_concern.setTextColor(0xFF333333); + me_tv_top_concern.setTextColor(getActivity().getResources().getColor(R.color.title)); me_tv_top_concern.setClickable(true); me_ll_topbar = (LinearLayout) view.findViewById(R.id.me_ll_topbar); @@ -121,9 +121,9 @@ public class PersonalFragment extends Fragment implements View.OnClickListener, rparams4.rightMargin = width - DisplayUtils.dip2px(getActivity(), 10); me_tv_topbar_concern.setLayoutParams(rparams4); - me_tv_top_install.setTextColor(0xFF1BA4FC); + me_tv_top_install.setTextColor(getActivity().getResources().getColor(R.color.theme)); me_tv_top_install.setClickable(false); - me_tv_top_concern.setTextColor(0xFF333333); + me_tv_top_concern.setTextColor(getActivity().getResources().getColor(R.color.title)); me_tv_top_concern.setClickable(true); me_topbar_slide_line = view.findViewById(R.id.me_topbar_slide_line); @@ -170,14 +170,14 @@ public class PersonalFragment extends Fragment implements View.OnClickListener, } previous = 0; - me_tv_top_install.setTextColor(0xFF1BA4FC); + me_tv_top_install.setTextColor(getActivity().getResources().getColor(R.color.theme)); me_tv_top_install.setClickable(false); - me_tv_top_concern.setTextColor(0xFF333333); + me_tv_top_concern.setTextColor(getActivity().getResources().getColor(R.color.title)); me_tv_top_concern.setClickable(true); - me_tv_topbar_install.setTextColor(0xFF1BA4FC); + me_tv_topbar_install.setTextColor(getActivity().getResources().getColor(R.color.theme)); me_tv_topbar_install.setClickable(false); - me_tv_topbar_concern.setTextColor(0xFF333333); + me_tv_topbar_concern.setTextColor(getActivity().getResources().getColor(R.color.title)); me_tv_topbar_concern.setClickable(true); } else { if (me_ll_topbar.getVisibility() == View.VISIBLE) { @@ -185,14 +185,14 @@ public class PersonalFragment extends Fragment implements View.OnClickListener, } previous = 1; - me_tv_top_install.setTextColor(0xFF333333); + me_tv_top_install.setTextColor(getActivity().getResources().getColor(R.color.title)); me_tv_top_install.setClickable(true); - me_tv_top_concern.setTextColor(0xFF1BA4FC); + me_tv_top_concern.setTextColor(getActivity().getResources().getColor(R.color.theme)); me_tv_top_concern.setClickable(false); - me_tv_topbar_install.setTextColor(0xFF333333); + me_tv_topbar_install.setTextColor(getActivity().getResources().getColor(R.color.title)); me_tv_topbar_install.setClickable(true); - me_tv_topbar_concern.setTextColor(0xFF1BA4FC); + me_tv_topbar_concern.setTextColor(getActivity().getResources().getColor(R.color.theme)); me_tv_topbar_concern.setClickable(false); } } diff --git a/app/src/main/java/com/gh/gamecenter/personal/PersonalFragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/personal/PersonalFragmentAdapter.java index ebb1d7b4f9..7f9958ee80 100644 --- a/app/src/main/java/com/gh/gamecenter/personal/PersonalFragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/personal/PersonalFragmentAdapter.java @@ -408,13 +408,13 @@ public class PersonalFragmentAdapter extends holder.me_tv_download.setVisibility(View.GONE); } else { holder.me_tv_download.setVisibility(View.VISIBLE); - holder.me_tv_download.setText("" + downloadSize); + holder.me_tv_download.setText(String.valueOf(downloadSize)); } if (updateSize == 0) { holder.me_tv_update.setVisibility(View.GONE); } else { holder.me_tv_update.setVisibility(View.VISIBLE); - holder.me_tv_update.setText("" + updateSize); + holder.me_tv_update.setText(String.valueOf(updateSize)); } } else if (viewHolder instanceof MultiFunctionViewHolder) { MultiFunctionViewHolder holder = (MultiFunctionViewHolder) viewHolder; @@ -434,15 +434,15 @@ public class PersonalFragmentAdapter extends holder.rootView.setClickable(false); if (isLoading) { holder.personal_ll_loading.setVisibility(View.VISIBLE); - holder.personal_tv_none.setVisibility(View.GONE); + holder.reuse_none_data.setVisibility(View.GONE); holder.personal_rl_label.setVisibility(View.GONE); } else if (gameDetailedList.isEmpty()) { holder.personal_ll_loading.setVisibility(View.GONE); - holder.personal_tv_none.setVisibility(View.VISIBLE); + holder.reuse_none_data.setVisibility(View.VISIBLE); holder.personal_rl_label.setVisibility(View.GONE); } else { holder.personal_ll_loading.setVisibility(View.GONE); - holder.personal_tv_none.setVisibility(View.GONE); + holder.reuse_none_data.setVisibility(View.GONE); holder.personal_rl_label.setVisibility(View.VISIBLE); } } @@ -714,7 +714,7 @@ public class PersonalFragmentAdapter extends public class MultiFunctionViewHolder extends ViewHolder { private LinearLayout personal_ll_loading; - private TextView personal_tv_none; + private LinearLayout reuse_none_data; private RelativeLayout personal_rl_label; private ContentLoadingProgressBar personal_progressbar; private TextView personal_loading; @@ -726,8 +726,8 @@ public class PersonalFragmentAdapter extends rootView = convertView; personal_ll_loading = (LinearLayout) convertView .findViewById(R.id.personal_ll_loading); - personal_tv_none = (TextView) convertView - .findViewById(R.id.personal_tv_none); + reuse_none_data = (LinearLayout) convertView + .findViewById(R.id.reuse_none_data); personal_rl_label = (RelativeLayout) convertView .findViewById(R.id.personal_rl_label); personal_progressbar = (ContentLoadingProgressBar) convertView @@ -1130,7 +1130,7 @@ public class PersonalFragmentAdapter extends fragmentActivity).getPlatformColor( pList.get(location).getPlatform())); GradientDrawable gradientDrawable = new GradientDrawable(); - gradientDrawable.setColor(0xffffffff); + gradientDrawable.setColor(Color.WHITE); gradientDrawable.setStroke( DisplayUtils.dip2px(fragmentActivity, 1), color); int padding = DisplayUtils.dip2px(fragmentActivity, 1); diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchDetailFragment.java b/app/src/main/java/com/gh/gamecenter/search/SearchDetailFragment.java index 683ed8901b..798a1e296a 100644 --- a/app/src/main/java/com/gh/gamecenter/search/SearchDetailFragment.java +++ b/app/src/main/java/com/gh/gamecenter/search/SearchDetailFragment.java @@ -9,7 +9,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; -import android.widget.TextView; import com.gh.base.AppController; import com.gh.gamecenter.R; @@ -23,8 +22,8 @@ public class SearchDetailFragment extends Fragment { private View view; private RecyclerView search_detail; private LinearLayout search_loading; - private TextView search_nogame; - private LinearLayout search_connection; + private LinearLayout reuse_none_date; + private LinearLayout reuse_no_connection; private DismissEntity dismissEntity; @@ -37,8 +36,8 @@ public class SearchDetailFragment extends Fragment { view = View.inflate(getActivity(), R.layout.fm_search, null); search_loading = (LinearLayout) view.findViewById(R.id.search_gamedetails_ll_loading); - search_nogame = (TextView) view.findViewById(R.id.search_gamedetails_tv_nogame); - search_connection = (LinearLayout) view.findViewById(R.id.search_gamedetails_ll_connection); + reuse_none_date = (LinearLayout) view.findViewById(R.id.reuse_none_data); + reuse_no_connection = (LinearLayout) view.findViewById(R.id.reuse_no_connection); dismissEntity = new DismissEntity(false); @@ -46,7 +45,7 @@ public class SearchDetailFragment extends Fragment { search_detail.setHasFixedSize(true); search_detail.setLayoutManager(new LinearLayoutManager(getActivity())); search_detail.setAdapter(new SearchDetailFragmentAdapter(getActivity(), search_detail, - search_loading, search_nogame, search_connection, key, dismissEntity)); + search_loading, reuse_none_date, reuse_no_connection, key, dismissEntity)); EventBus.getDefault().register(this); } @@ -73,7 +72,7 @@ public class SearchDetailFragment extends Fragment { public void search(String key) { search_detail.setAdapter(new SearchDetailFragmentAdapter(getActivity(), search_detail, - search_loading, search_nogame, search_connection, key, dismissEntity)); + search_loading, reuse_none_date, reuse_no_connection, key, dismissEntity)); } @Override @@ -84,8 +83,8 @@ public class SearchDetailFragment extends Fragment { view = null; search_detail = null; search_loading = null; - search_nogame = null; - search_connection = null; + reuse_none_date = null; + reuse_no_connection = null; dismissEntity = null; key = null; } diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchDetailFragmentAdapter.java b/app/src/main/java/com/gh/gamecenter/search/SearchDetailFragmentAdapter.java index aee21c96cb..1002bfb4ac 100644 --- a/app/src/main/java/com/gh/gamecenter/search/SearchDetailFragmentAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/search/SearchDetailFragmentAdapter.java @@ -11,7 +11,6 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.LinearLayout; -import android.widget.TextView; import com.android.volley.Response; import com.android.volley.VolleyError; @@ -49,7 +48,7 @@ public class SearchDetailFragmentAdapter extends RecyclerView.Adapter gameList; @@ -59,7 +58,7 @@ public class SearchDetailFragmentAdapter extends RecyclerView.Adapter - + diff --git a/app/src/main/res/drawable/border.xml b/app/src/main/res/drawable/border.xml index 8aa461834d..ae344c0915 100644 --- a/app/src/main/res/drawable/border.xml +++ b/app/src/main/res/drawable/border.xml @@ -1,7 +1,7 @@ - + + android:color="@color/theme" /> - + \ No newline at end of file diff --git a/app/src/main/res/drawable/border_dialog_bg.xml b/app/src/main/res/drawable/border_dialog_bg.xml index 50a9df2417..1185c7605c 100644 --- a/app/src/main/res/drawable/border_dialog_bg.xml +++ b/app/src/main/res/drawable/border_dialog_bg.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/res/drawable/border_green_bg.xml b/app/src/main/res/drawable/border_green_bg.xml index ddccf20f8a..9b14d3c305 100644 --- a/app/src/main/res/drawable/border_green_bg.xml +++ b/app/src/main/res/drawable/border_green_bg.xml @@ -4,9 +4,9 @@ + android:color="@color/tag_green" /> - + \ No newline at end of file diff --git a/app/src/main/res/drawable/border_normal_bg.xml b/app/src/main/res/drawable/border_normal_bg.xml index 89f099a193..3eb1d2aaff 100644 --- a/app/src/main/res/drawable/border_normal_bg.xml +++ b/app/src/main/res/drawable/border_normal_bg.xml @@ -1,5 +1,9 @@ - - - + + + + + + diff --git a/app/src/main/res/drawable/border_red_bg.xml b/app/src/main/res/drawable/border_red_bg.xml index d422c8fefd..6b0bfcc73f 100644 --- a/app/src/main/res/drawable/border_red_bg.xml +++ b/app/src/main/res/drawable/border_red_bg.xml @@ -8,6 +8,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/border_update_bg.xml b/app/src/main/res/drawable/border_update_bg.xml index 51b80ae9f0..04d164d0c8 100644 --- a/app/src/main/res/drawable/border_update_bg.xml +++ b/app/src/main/res/drawable/border_update_bg.xml @@ -2,7 +2,7 @@ - + - + + android:color="@color/content" /> diff --git a/app/src/main/res/drawable/cardview_item_style.xml b/app/src/main/res/drawable/cardview_item_style.xml index b4a124bd14..ba6e33ce72 100644 --- a/app/src/main/res/drawable/cardview_item_style.xml +++ b/app/src/main/res/drawable/cardview_item_style.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/game_item_btn_download_dn.xml b/app/src/main/res/drawable/game_item_btn_download_dn.xml index b77b281c10..60c304d536 100644 --- a/app/src/main/res/drawable/game_item_btn_download_dn.xml +++ b/app/src/main/res/drawable/game_item_btn_download_dn.xml @@ -3,16 +3,16 @@ - + - + - + diff --git a/app/src/main/res/drawable/game_item_btn_download_up.xml b/app/src/main/res/drawable/game_item_btn_download_up.xml index 595c27ec5f..b3417d4088 100644 --- a/app/src/main/res/drawable/game_item_btn_download_up.xml +++ b/app/src/main/res/drawable/game_item_btn_download_up.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/res/drawable/game_item_btn_downloading_style.xml b/app/src/main/res/drawable/game_item_btn_downloading_style.xml index c39ad0f88b..65f8bca25b 100644 --- a/app/src/main/res/drawable/game_item_btn_downloading_style.xml +++ b/app/src/main/res/drawable/game_item_btn_downloading_style.xml @@ -4,10 +4,10 @@ + android:color="@color/theme" /> - + - + \ No newline at end of file diff --git a/app/src/main/res/drawable/game_item_btn_launch_dn.xml b/app/src/main/res/drawable/game_item_btn_launch_dn.xml index e069827456..8c9437c650 100644 --- a/app/src/main/res/drawable/game_item_btn_launch_dn.xml +++ b/app/src/main/res/drawable/game_item_btn_launch_dn.xml @@ -5,14 +5,14 @@ - + - + diff --git a/app/src/main/res/drawable/game_item_btn_launch_up.xml b/app/src/main/res/drawable/game_item_btn_launch_up.xml index 3a913cc78b..db0e1bb952 100644 --- a/app/src/main/res/drawable/game_item_btn_launch_up.xml +++ b/app/src/main/res/drawable/game_item_btn_launch_up.xml @@ -4,6 +4,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/game_item_btn_pause_dn.xml b/app/src/main/res/drawable/game_item_btn_pause_dn.xml index 57b9ffbf3f..7621ebbbc7 100644 --- a/app/src/main/res/drawable/game_item_btn_pause_dn.xml +++ b/app/src/main/res/drawable/game_item_btn_pause_dn.xml @@ -5,14 +5,14 @@ - + - + diff --git a/app/src/main/res/drawable/game_item_btn_pause_up.xml b/app/src/main/res/drawable/game_item_btn_pause_up.xml index f195cdb8b8..bd80a724fd 100644 --- a/app/src/main/res/drawable/game_item_btn_pause_up.xml +++ b/app/src/main/res/drawable/game_item_btn_pause_up.xml @@ -4,6 +4,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/game_item_btn_plugin_dn.xml b/app/src/main/res/drawable/game_item_btn_plugin_dn.xml index 9e17b7b3a5..465d2fe43a 100644 --- a/app/src/main/res/drawable/game_item_btn_plugin_dn.xml +++ b/app/src/main/res/drawable/game_item_btn_plugin_dn.xml @@ -5,14 +5,14 @@ - + - + diff --git a/app/src/main/res/drawable/game_item_btn_plugin_up.xml b/app/src/main/res/drawable/game_item_btn_plugin_up.xml index 0f1d02010b..0730c573ad 100644 --- a/app/src/main/res/drawable/game_item_btn_plugin_up.xml +++ b/app/src/main/res/drawable/game_item_btn_plugin_up.xml @@ -4,6 +4,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/game_item_btn_plugining_style.xml b/app/src/main/res/drawable/game_item_btn_plugining_style.xml index 044c03304e..4b22501013 100644 --- a/app/src/main/res/drawable/game_item_btn_plugining_style.xml +++ b/app/src/main/res/drawable/game_item_btn_plugining_style.xml @@ -4,10 +4,10 @@ + android:color="@color/btn_plugin" /> - + - + \ No newline at end of file diff --git a/app/src/main/res/drawable/md_back_off.xml b/app/src/main/res/drawable/md_back_off.xml index 20d2fb1460..b34f5882b5 100644 --- a/app/src/main/res/drawable/md_back_off.xml +++ b/app/src/main/res/drawable/md_back_off.xml @@ -1,15 +1,20 @@ - + + - - + + + + + - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/news_search_bg.xml b/app/src/main/res/drawable/news_search_bg.xml index e833c4e722..394e64cc8f 100644 --- a/app/src/main/res/drawable/news_search_bg.xml +++ b/app/src/main/res/drawable/news_search_bg.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/res/drawable/news_search_btn.xml b/app/src/main/res/drawable/news_search_btn.xml index 4733e6b7b5..a2fafc0107 100644 --- a/app/src/main/res/drawable/news_search_btn.xml +++ b/app/src/main/res/drawable/news_search_btn.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/oval_download_hint_bg.xml b/app/src/main/res/drawable/oval_download_hint_bg.xml index 4e1c685659..d3ac2782f4 100644 --- a/app/src/main/res/drawable/oval_download_hint_bg.xml +++ b/app/src/main/res/drawable/oval_download_hint_bg.xml @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/oval_gray_bg.xml b/app/src/main/res/drawable/oval_gray_bg.xml index 34774f7b7a..c93462b846 100644 --- a/app/src/main/res/drawable/oval_gray_bg.xml +++ b/app/src/main/res/drawable/oval_gray_bg.xml @@ -3,7 +3,7 @@ - + diff --git a/app/src/main/res/drawable/oval_hint_up.xml b/app/src/main/res/drawable/oval_hint_up.xml index e7a77aea5b..1d3925ba22 100644 --- a/app/src/main/res/drawable/oval_hint_up.xml +++ b/app/src/main/res/drawable/oval_hint_up.xml @@ -2,7 +2,7 @@ - + - + diff --git a/app/src/main/res/drawable/oval_scarlet_bg.xml b/app/src/main/res/drawable/oval_scarlet_bg.xml index 1e8a0b4675..f488ade1dc 100644 --- a/app/src/main/res/drawable/oval_scarlet_bg.xml +++ b/app/src/main/res/drawable/oval_scarlet_bg.xml @@ -3,7 +3,7 @@ - + diff --git a/app/src/main/res/drawable/oval_search_bg.xml b/app/src/main/res/drawable/oval_search_bg.xml index 6e7663beef..c63f83ebd4 100644 --- a/app/src/main/res/drawable/oval_search_bg.xml +++ b/app/src/main/res/drawable/oval_search_bg.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/res/drawable/progressbar_bg_style.xml b/app/src/main/res/drawable/progressbar_bg_style.xml index bc376327c4..2f8a6c9626 100644 --- a/app/src/main/res/drawable/progressbar_bg_style.xml +++ b/app/src/main/res/drawable/progressbar_bg_style.xml @@ -7,8 +7,8 @@ + android:endColor="@color/btn_pause" + android:startColor="@color/btn_pause" /> @@ -19,8 +19,8 @@ + android:endColor="@color/theme" + android:startColor="@color/theme" /> diff --git a/app/src/main/res/drawable/progressbar_normal_radius_style.xml b/app/src/main/res/drawable/progressbar_normal_radius_style.xml index 3eaa4af658..5fc04d220c 100644 --- a/app/src/main/res/drawable/progressbar_normal_radius_style.xml +++ b/app/src/main/res/drawable/progressbar_normal_radius_style.xml @@ -4,9 +4,10 @@ - + + @@ -15,8 +16,8 @@ + android:endColor="@color/theme" + android:startColor="@color/theme" /> diff --git a/app/src/main/res/drawable/progressbar_normal_style.xml b/app/src/main/res/drawable/progressbar_normal_style.xml index e5d009a356..37790ac132 100644 --- a/app/src/main/res/drawable/progressbar_normal_style.xml +++ b/app/src/main/res/drawable/progressbar_normal_style.xml @@ -4,8 +4,8 @@ + android:endColor="@color/btn_pause" + android:startColor="@color/btn_pause" /> @@ -13,8 +13,8 @@ + android:endColor="@color/theme" + android:startColor="@color/theme" /> diff --git a/app/src/main/res/drawable/reuse_list_item_style.xml b/app/src/main/res/drawable/reuse_list_item_style.xml index b4a124bd14..ba6e33ce72 100644 --- a/app/src/main/res/drawable/reuse_list_item_style.xml +++ b/app/src/main/res/drawable/reuse_list_item_style.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/reuse_listview_item_style.xml b/app/src/main/res/drawable/reuse_listview_item_style.xml index 3819be1a69..478e6faff8 100644 --- a/app/src/main/res/drawable/reuse_listview_item_style.xml +++ b/app/src/main/res/drawable/reuse_listview_item_style.xml @@ -1,8 +1,8 @@ - - - + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/reuse_radiobutton_item_style.xml b/app/src/main/res/drawable/reuse_radiobutton_item_style.xml deleted file mode 100644 index b442d76dc6..0000000000 --- a/app/src/main/res/drawable/reuse_radiobutton_item_style.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/shape.xml b/app/src/main/res/drawable/shape.xml index 9405f1297f..cb51b50fcd 100644 --- a/app/src/main/res/drawable/shape.xml +++ b/app/src/main/res/drawable/shape.xml @@ -1,9 +1,9 @@ - - + + diff --git a/app/src/main/res/drawable/ssdk_oks_classic_progressbar.xml b/app/src/main/res/drawable/ssdk_oks_classic_progressbar.xml index 5e67f84ad0..90f2b04c28 100644 --- a/app/src/main/res/drawable/ssdk_oks_classic_progressbar.xml +++ b/app/src/main/res/drawable/ssdk_oks_classic_progressbar.xml @@ -14,7 +14,7 @@ android:centerX="0.50" android:centerY="0.50" android:endColor="#09bb07" - android:startColor="#ffffff" + android:startColor="@android:color/white" android:type="sweep" android:useLevel="false" /> diff --git a/app/src/main/res/drawable/textview_blue_dn.xml b/app/src/main/res/drawable/textview_blue_dn.xml index 6ebdd1fabc..09d83e7f9e 100644 --- a/app/src/main/res/drawable/textview_blue_dn.xml +++ b/app/src/main/res/drawable/textview_blue_dn.xml @@ -3,7 +3,7 @@ - + diff --git a/app/src/main/res/drawable/textview_blue_up.xml b/app/src/main/res/drawable/textview_blue_up.xml index 22326d4a15..2029f6051e 100644 --- a/app/src/main/res/drawable/textview_blue_up.xml +++ b/app/src/main/res/drawable/textview_blue_up.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/res/layout/activity_concern.xml b/app/src/main/res/layout/activity_concern.xml index ac53e0bcd8..355b12ae69 100644 --- a/app/src/main/res/layout/activity_concern.xml +++ b/app/src/main/res/layout/activity_concern.xml @@ -2,7 +2,6 @@ + android:layout_height="match_parent" + android:background="@color/background"> - + - - + diff --git a/app/src/main/res/layout/activity_downloadmanager.xml b/app/src/main/res/layout/activity_downloadmanager.xml index 6152a6d718..0460e2c8dc 100644 --- a/app/src/main/res/layout/activity_downloadmanager.xml +++ b/app/src/main/res/layout/activity_downloadmanager.xml @@ -9,7 +9,7 @@ @@ -57,7 +57,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏更新" - android:textColor="#333333" /> + android:textColor="@color/title" /> @@ -75,7 +75,7 @@ android:id="@+id/downloadmanager_slide_line" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@color/theme_colors" /> + android:background="@color/theme" /> @@ -42,7 +42,7 @@ android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:text="加载中..." - android:textColor="#666666" + android:textColor="@color/content" android:textSize="14sp" /> @@ -68,7 +68,7 @@ android:layout_height="match_parent" android:background="@drawable/textview_blue_style" android:gravity="center" - android:textColor="#ffffff" /> + android:textColor="@android:color/white" /> + android:background="@android:color/white" > + android:textColor="@color/theme" /> + android:background="@color/theme" /> + android:textColor="@color/title" /> + android:background="@color/theme" /> + android:background="@color/theme" /> + android:background="@color/background"> diff --git a/app/src/main/res/layout/activity_gamedetails.xml b/app/src/main/res/layout/activity_gamedetails.xml index 50088e3d63..1c9dafca9c 100644 --- a/app/src/main/res/layout/activity_gamedetails.xml +++ b/app/src/main/res/layout/activity_gamedetails.xml @@ -21,7 +21,7 @@ android:id="@+id/gamedetails_ll_top" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="#ffffff" + android:background="@android:color/white" android:orientation="vertical" > @@ -70,7 +70,7 @@ android:background="@drawable/textview_red_style" android:gravity="center" android:text="关注" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="12sp" /> @@ -93,7 +93,7 @@ android:layout_weight="1" android:gravity="center" android:text="详情" - android:textColor="@color/theme_colors" + android:textColor="@color/theme" android:textSize="16sp" /> @@ -122,19 +122,19 @@ android:id="@+id/titlebar_slide_line" android:layout_width="wrap_content" android:layout_height="2dp" - android:background="@color/theme_colors" /> + android:background="@color/theme" /> + android:background="@color/theme" /> @@ -157,7 +157,7 @@ android:layout_weight="1" android:gravity="center" android:text="详情" - android:textColor="@color/theme_colors" + android:textColor="@color/theme" android:textSize="16sp" /> @@ -186,12 +186,12 @@ android:id="@+id/gamedetails_slide_line" android:layout_width="wrap_content" android:layout_height="2dp" - android:background="@color/theme_colors" /> + android:background="@color/theme" /> + android:background="@color/theme" /> + android:textColor="@android:color/white" /> diff --git a/app/src/main/res/layout/activity_gamedetails_news.xml b/app/src/main/res/layout/activity_gamedetails_news.xml index edb82b031b..730c0370a1 100644 --- a/app/src/main/res/layout/activity_gamedetails_news.xml +++ b/app/src/main/res/layout/activity_gamedetails_news.xml @@ -1,11 +1,13 @@ + android:background="@color/background"> + + + + + + + + + + + + - + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c693e9103a..fc65b95bde 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -37,7 +37,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏" - android:textColor="@color/theme_colors" + android:textColor="@color/theme" android:textSize="11sp" /> @@ -61,7 +61,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="资讯" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="11sp" /> @@ -85,7 +85,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="我的光环" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="11sp" /> diff --git a/app/src/main/res/layout/activity_new_gamedetails.xml b/app/src/main/res/layout/activity_new_gamedetails.xml index faa23d0126..2dbb4be59f 100644 --- a/app/src/main/res/layout/activity_new_gamedetails.xml +++ b/app/src/main/res/layout/activity_new_gamedetails.xml @@ -14,7 +14,7 @@ android:id="@+id/gamedetails_rv" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/bg_color" + android:background="@color/background" android:layout_above="@id/gamedetails_ll_bottom"/> + android:textColor="@android:color/white" /> diff --git a/app/src/main/res/layout/activity_plugin.xml b/app/src/main/res/layout/activity_plugin.xml index 4a06f782c9..f842e52b06 100644 --- a/app/src/main/res/layout/activity_plugin.xml +++ b/app/src/main/res/layout/activity_plugin.xml @@ -15,7 +15,7 @@ android:id="@+id/plugin_list" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/bg_color" > + android:background="@color/background" > + android:background="@color/theme" /> diff --git a/app/src/main/res/layout/activity_setting.xml b/app/src/main/res/layout/activity_setting.xml index 21e714f903..c4412dba75 100644 --- a/app/src/main/res/layout/activity_setting.xml +++ b/app/src/main/res/layout/activity_setting.xml @@ -3,7 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/bg_color" + android:background="@color/background" android:orientation="vertical"> @@ -40,7 +40,7 @@ android:gravity="center" android:text="一键修复下载" android:textSize="18dp" - android:textColor="#FFFFFF"/> + android:textColor="@android:color/white"/> @@ -68,7 +68,7 @@ android:layout_height="wrap_content" android:layout_centerVertical="true" android:text="正文字号" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="16sp" /> @@ -111,7 +111,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="自动安装" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="16sp" /> @@ -287,7 +287,7 @@ android:layout_height="wrap_content" android:layout_centerVertical="true" android:text="清除缓存" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="16sp" /> @@ -327,7 +327,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="意见反馈" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="16sp" /> diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml index 80e487e098..bf617e3574 100644 --- a/app/src/main/res/layout/activity_splash.xml +++ b/app/src/main/res/layout/activity_splash.xml @@ -14,7 +14,7 @@ android:id="@+id/splash_ll_normal" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/theme_colors" + android:background="@color/theme" android:gravity="center" android:orientation="vertical" > diff --git a/app/src/main/res/layout/activity_subject.xml b/app/src/main/res/layout/activity_subject.xml index 502a6e8b05..c9fb9d93f8 100644 --- a/app/src/main/res/layout/activity_subject.xml +++ b/app/src/main/res/layout/activity_subject.xml @@ -15,7 +15,7 @@ android:id="@+id/subject_list" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/bg_color" > + android:background="@color/background" > + android:background="@color/theme" /> diff --git a/app/src/main/res/layout/activity_suggest.xml b/app/src/main/res/layout/activity_suggest.xml index 9c652f6492..a057f1c915 100644 --- a/app/src/main/res/layout/activity_suggest.xml +++ b/app/src/main/res/layout/activity_suggest.xml @@ -104,7 +104,7 @@ android:foreground="?android:attr/selectableItemBackground" app:cardCornerRadius="0dp" app:cardElevation="2dp" - app:cardBackgroundColor="#1BA4FC" + app:cardBackgroundColor="@color/theme" app:cardUseCompatPadding="true"> diff --git a/app/src/main/res/layout/activity_viewimage.xml b/app/src/main/res/layout/activity_viewimage.xml index e8fbcf66df..be9f1d193a 100644 --- a/app/src/main/res/layout/activity_viewimage.xml +++ b/app/src/main/res/layout/activity_viewimage.xml @@ -15,7 +15,7 @@ android:id="@+id/viewimage_slide_line" android:layout_width="match_parent" android:layout_height="1dp" - android:background="@color/theme_colors" + android:background="@color/theme" android:layout_alignParentBottom="true" android:layout_marginBottom="10dp"/> diff --git a/app/src/main/res/layout/app_update_hint_dialog.xml b/app/src/main/res/layout/app_update_hint_dialog.xml index aed42d4e51..ba103630df 100644 --- a/app/src/main/res/layout/app_update_hint_dialog.xml +++ b/app/src/main/res/layout/app_update_hint_dialog.xml @@ -64,7 +64,7 @@ + android:background="@color/content"/> diff --git a/app/src/main/res/layout/app_updating_dialog.xml b/app/src/main/res/layout/app_updating_dialog.xml index 300ac77005..9d29993839 100644 --- a/app/src/main/res/layout/app_updating_dialog.xml +++ b/app/src/main/res/layout/app_updating_dialog.xml @@ -13,7 +13,7 @@ android:layout_marginBottom="10dp" android:layout_marginTop="10dp" android:text="正在更新" - android:textColor="@color/theme_colors" + android:textColor="@color/theme" android:textSize="16sp" /> @@ -72,7 +72,7 @@ android:background="@drawable/textview_cancel_style" android:gravity="center" android:text="取消" - android:textColor="#FFFFFF" + android:textColor="@android:color/white" android:textSize="14sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/common_alertdialog.xml b/app/src/main/res/layout/common_alertdialog.xml index 17cc2b94bf..7f30207f4a 100644 --- a/app/src/main/res/layout/common_alertdialog.xml +++ b/app/src/main/res/layout/common_alertdialog.xml @@ -56,7 +56,7 @@ android:layout_width="0dp" android:layout_height="50dp" android:layout_weight="1" - android:background="@color/theme_colors" + android:background="@color/theme" android:gravity="center" android:text="确定" android:textColor="#fff" diff --git a/app/src/main/res/layout/concern_item.xml b/app/src/main/res/layout/concern_item.xml index 32a5043960..aa28609dde 100644 --- a/app/src/main/res/layout/concern_item.xml +++ b/app/src/main/res/layout/concern_item.xml @@ -22,7 +22,7 @@ android:ellipsize="end" android:gravity="center" android:singleLine="true" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="14sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/concern_rv_item.xml b/app/src/main/res/layout/concern_rv_item.xml index eb1cba5537..70c542d439 100644 --- a/app/src/main/res/layout/concern_rv_item.xml +++ b/app/src/main/res/layout/concern_rv_item.xml @@ -39,7 +39,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="少年三国志" - android:textColor="#00b7fa" + android:textColor="@color/theme" android:textSize="16sp" android:layout_marginBottom="5dp"/> @@ -51,7 +51,7 @@ @@ -59,7 +59,7 @@ diff --git a/app/src/main/res/layout/downloadmanager.xml b/app/src/main/res/layout/downloadmanager.xml index 70526a315b..9c857e6287 100644 --- a/app/src/main/res/layout/downloadmanager.xml +++ b/app/src/main/res/layout/downloadmanager.xml @@ -9,16 +9,6 @@ android:layout_height="match_parent" > - + \ No newline at end of file diff --git a/app/src/main/res/layout/downloadmanager_item.xml b/app/src/main/res/layout/downloadmanager_item.xml index 41b638eee7..938ce22562 100644 --- a/app/src/main/res/layout/downloadmanager_item.xml +++ b/app/src/main/res/layout/downloadmanager_item.xml @@ -37,7 +37,7 @@ android:layout_height="wrap_content" android:ellipsize="end" android:singleLine="true" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="15sp" /> @@ -84,7 +84,7 @@ android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:text="下载" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:background="@drawable/textview_blue_style" android:gravity="center" android:textSize="14sp" /> @@ -109,7 +109,7 @@ android:layout_height="wrap_content" android:layout_marginLeft="3dp" android:text="删除" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/downloadmanager_item_head.xml b/app/src/main/res/layout/downloadmanager_item_head.xml index 85ce038d21..58eecaa02b 100644 --- a/app/src/main/res/layout/downloadmanager_item_head.xml +++ b/app/src/main/res/layout/downloadmanager_item_head.xml @@ -11,7 +11,7 @@ android:layout_marginLeft="12dp" android:layout_marginTop="8dp" android:text="下载中" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="14sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/downloadmanager_rv_item.xml b/app/src/main/res/layout/downloadmanager_rv_item.xml index 730d678772..b4bfd7b828 100644 --- a/app/src/main/res/layout/downloadmanager_rv_item.xml +++ b/app/src/main/res/layout/downloadmanager_rv_item.xml @@ -76,7 +76,7 @@ android:gravity="right" android:singleLine="true" android:text="44.5%" - android:textColor="#666666" + android:textColor="@color/content" android:textSize="10sp" /> @@ -124,7 +124,7 @@ android:background="@drawable/textview_blue_style" android:gravity="center" android:text="下载" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/essaydetails_item_top.xml b/app/src/main/res/layout/essaydetails_item_top.xml index b44f07f8d5..1d558f5a9f 100644 --- a/app/src/main/res/layout/essaydetails_item_top.xml +++ b/app/src/main/res/layout/essaydetails_item_top.xml @@ -93,14 +93,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="12dp" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="16sp" /> @@ -113,7 +113,7 @@ android:background="@drawable/textview_red_style" android:gravity="center" android:text="关注" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="12sp" /> diff --git a/app/src/main/res/layout/fm_downloadmanager_item.xml b/app/src/main/res/layout/fm_downloadmanager_item.xml index ea2648931e..30daf32dd3 100644 --- a/app/src/main/res/layout/fm_downloadmanager_item.xml +++ b/app/src/main/res/layout/fm_downloadmanager_item.xml @@ -96,7 +96,7 @@ android:layout_width="60dp" android:layout_height="28.5dp" android:text="下载" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:background="@drawable/game_item_btn_download_style" android:gravity="center" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/fm_search.xml b/app/src/main/res/layout/fm_search.xml index 8ec6c61465..bb49e7e356 100644 --- a/app/src/main/res/layout/fm_search.xml +++ b/app/src/main/res/layout/fm_search.xml @@ -31,43 +31,12 @@ android:layout_height="wrap_content" android:layout_margin="10dp" android:text="搜索中..." - android:textColor="#666666" + android:textColor="@color/content" android:textSize="14sp" /> - + - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/fm_update_item.xml b/app/src/main/res/layout/fm_update_item.xml index e69981a07a..468e503fb8 100644 --- a/app/src/main/res/layout/fm_update_item.xml +++ b/app/src/main/res/layout/fm_update_item.xml @@ -66,7 +66,7 @@ android:background="@drawable/game_item_btn_download_style" android:gravity="center" android:text="更新" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/fragment_news.xml b/app/src/main/res/layout/fragment_news.xml index 5303284f0c..d0b81ea636 100644 --- a/app/src/main/res/layout/fragment_news.xml +++ b/app/src/main/res/layout/fragment_news.xml @@ -9,7 +9,7 @@ + android:background="@android:color/white" > + android:textColor="@color/theme" /> + android:textColor="@color/title" /> + android:textColor="@color/title" /> + android:textColor="@color/title" /> + android:background="@color/theme" /> + android:background="@color/theme" /> + android:background="@color/background"> + android:background="@color/theme" /> @@ -36,25 +36,13 @@ android:layout_height="wrap_content" android:gravity="center" android:text="我的游戏" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:paddingLeft="16dp" android:textSize="12sp" /> - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_news4.xml b/app/src/main/res/layout/fragment_news4.xml index 8478f21e0a..1435cbefcf 100644 --- a/app/src/main/res/layout/fragment_news4.xml +++ b/app/src/main/res/layout/fragment_news4.xml @@ -16,7 +16,7 @@ android:id="@+id/news4_rv" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/bg_color"> + android:background="@color/background"> @@ -25,21 +25,11 @@ android:layout_width="40dp" android:layout_height="40dp" android:layout_centerInParent="true" - android:background="@color/theme_colors" /> + android:background="@color/theme" /> - + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_original.xml b/app/src/main/res/layout/fragment_original.xml index 96858c284a..ede35af083 100644 --- a/app/src/main/res/layout/fragment_original.xml +++ b/app/src/main/res/layout/fragment_original.xml @@ -17,7 +17,7 @@ android:id="@+id/original_list" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/bg_color"> + android:background="@color/background"> @@ -26,7 +26,7 @@ android:layout_width="40dp" android:layout_height="40dp" android:layout_centerInParent="true" - android:background="@color/theme_colors" /> + android:background="@color/theme" /> diff --git a/app/src/main/res/layout/game_download_dialog.xml b/app/src/main/res/layout/game_download_dialog.xml index 8e313dfbe4..ce868f4e3a 100644 --- a/app/src/main/res/layout/game_download_dialog.xml +++ b/app/src/main/res/layout/game_download_dialog.xml @@ -9,7 +9,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:background="#ffffff" + android:background="@android:color/white" android:orientation="vertical" > + android:background="@color/theme" /> + android:textColor="@android:color/white" /> \ No newline at end of file diff --git a/app/src/main/res/layout/game_news_type_list_item.xml b/app/src/main/res/layout/game_news_type_list_item.xml index bcc767d36b..3b142d6dbc 100644 --- a/app/src/main/res/layout/game_news_type_list_item.xml +++ b/app/src/main/res/layout/game_news_type_list_item.xml @@ -12,7 +12,7 @@ android:layout_height="match_parent" android:gravity="center" android:textSize="16sp" - android:textColor="#FFFFFF" + android:textColor="@android:color/white" android:background="@drawable/game_item_btn_download_up"/> \ No newline at end of file diff --git a/app/src/main/res/layout/game_normal_item.xml b/app/src/main/res/layout/game_normal_item.xml index 774ff6b3f5..85ea402a62 100644 --- a/app/src/main/res/layout/game_normal_item.xml +++ b/app/src/main/res/layout/game_normal_item.xml @@ -2,8 +2,8 @@ + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp"> @@ -131,7 +131,7 @@ android:background="@drawable/game_item_btn_download_style" android:gravity="center" android:text="下载" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/game_test_item.xml b/app/src/main/res/layout/game_test_item.xml index cf775fdd63..96f8dc6c92 100644 --- a/app/src/main/res/layout/game_test_item.xml +++ b/app/src/main/res/layout/game_test_item.xml @@ -13,7 +13,7 @@ android:text="1" android:gravity="center" android:layout_centerVertical="true" - android:textColor="#333333" + android:textColor="@color/title" android:layout_marginRight="4dp" android:maxLength="3" android:textSize="14sp" @@ -94,7 +94,7 @@ android:gravity="right" android:singleLine="true" android:text="44.5%" - android:textColor="#666666" + android:textColor="@color/content" android:textSize="10sp" /> @@ -132,7 +132,7 @@ android:paddingRight="4dp" android:paddingTop="2dp" android:text="null" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="12sp" /> @@ -159,7 +159,7 @@ android:background="@drawable/game_item_btn_download_style" android:gravity="center" android:text="下载" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/gamedetails.xml b/app/src/main/res/layout/gamedetails.xml index 486729aaf1..1f744809fc 100644 --- a/app/src/main/res/layout/gamedetails.xml +++ b/app/src/main/res/layout/gamedetails.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:text="加载中..." - android:textColor="#666666" + android:textColor="@color/content" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/gamedetails_attention_dialog.xml b/app/src/main/res/layout/gamedetails_attention_dialog.xml index 6fc78ced40..fef8284a4e 100644 --- a/app/src/main/res/layout/gamedetails_attention_dialog.xml +++ b/app/src/main/res/layout/gamedetails_attention_dialog.xml @@ -13,7 +13,7 @@ android:layout_marginLeft="15dp" android:layout_marginTop="8dp" android:text="关注成功" - android:textColor="@color/theme_colors" + android:textColor="@color/theme" android:textSize="16sp" /> @@ -83,7 +83,7 @@ android:paddingRight="14dp" android:paddingTop="3dp" android:text="确定" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/gamedetails_item_intro.xml b/app/src/main/res/layout/gamedetails_item_intro.xml index b003c6e12d..74ddaf3b5b 100644 --- a/app/src/main/res/layout/gamedetails_item_intro.xml +++ b/app/src/main/res/layout/gamedetails_item_intro.xml @@ -2,7 +2,7 @@ + android:background="@android:color/white" > + android:background="@color/theme" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gamedetails_item_loading.xml b/app/src/main/res/layout/gamedetails_item_loading.xml index a09af5e8c4..8f75ec8c7c 100644 --- a/app/src/main/res/layout/gamedetails_item_loading.xml +++ b/app/src/main/res/layout/gamedetails_item_loading.xml @@ -18,7 +18,7 @@ android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:text="加载中..." - android:textColor="#666666" + android:textColor="@color/content" android:textSize="14sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gamedetails_item_news_item.xml b/app/src/main/res/layout/gamedetails_item_news_item.xml index 20f7852a77..de3cd0077a 100644 --- a/app/src/main/res/layout/gamedetails_item_news_item.xml +++ b/app/src/main/res/layout/gamedetails_item_news_item.xml @@ -7,7 +7,7 @@ + android:background="@color/background" /> diff --git a/app/src/main/res/layout/gamedetails_item_newservice.xml b/app/src/main/res/layout/gamedetails_item_newservice.xml index 41a8a8b1c6..34781865eb 100644 --- a/app/src/main/res/layout/gamedetails_item_newservice.xml +++ b/app/src/main/res/layout/gamedetails_item_newservice.xml @@ -2,7 +2,7 @@ + android:background="@android:color/white" > + android:background="@color/theme" /> + android:background="@android:color/white" > + android:background="@color/background" /> + android:background="@color/background" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gamedetails_item_screenshot.xml b/app/src/main/res/layout/gamedetails_item_screenshot.xml index 32febb3f65..8a221c8d6d 100644 --- a/app/src/main/res/layout/gamedetails_item_screenshot.xml +++ b/app/src/main/res/layout/gamedetails_item_screenshot.xml @@ -2,14 +2,14 @@ + android:background="@android:color/white" > + android:background="@color/background" /> + android:background="@color/background" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gamedetails_newservice_item.xml b/app/src/main/res/layout/gamedetails_newservice_item.xml index a6a9908702..c65c459282 100644 --- a/app/src/main/res/layout/gamedetails_newservice_item.xml +++ b/app/src/main/res/layout/gamedetails_newservice_item.xml @@ -17,7 +17,7 @@ android:paddingBottom="3dp" android:background="@drawable/border_gray_bg" android:gravity="center" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="12sp" /> diff --git a/app/src/main/res/layout/gamedetails_rv_item_top.xml b/app/src/main/res/layout/gamedetails_rv_item_top.xml index 1d4d153c00..bfa26362ae 100644 --- a/app/src/main/res/layout/gamedetails_rv_item_top.xml +++ b/app/src/main/res/layout/gamedetails_rv_item_top.xml @@ -64,7 +64,7 @@ android:background="@drawable/textview_blue_style" android:gravity="center" android:text="关注" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gameinformaiton_item_search.xml b/app/src/main/res/layout/gameinformaiton_item_search.xml index 26defc4d25..d47aa5e795 100644 --- a/app/src/main/res/layout/gameinformaiton_item_search.xml +++ b/app/src/main/res/layout/gameinformaiton_item_search.xml @@ -2,7 +2,7 @@ @@ -92,7 +92,7 @@ android:layout_weight="1" android:ellipsize="end" android:singleLine="true" - android:textColor="#666666" + android:textColor="@color/content" android:textSize="14sp" /> + android:background="@color/background" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gameinformation.xml b/app/src/main/res/layout/gameinformation.xml index 3aa49aace0..efdd5f7bbb 100644 --- a/app/src/main/res/layout/gameinformation.xml +++ b/app/src/main/res/layout/gameinformation.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:text="加载中..." - android:textColor="#666666" + android:textColor="@color/content" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/gameinformation_item.xml b/app/src/main/res/layout/gameinformation_item.xml index 1392af869a..3e9260159a 100644 --- a/app/src/main/res/layout/gameinformation_item.xml +++ b/app/src/main/res/layout/gameinformation_item.xml @@ -16,7 +16,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" - android:textColor="@color/theme_colors" + android:textColor="@color/theme" android:textSize="12sp" /> + android:background="@color/background" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gameinformation_select_item.xml b/app/src/main/res/layout/gameinformation_select_item.xml index d5ddda39ff..697f805181 100644 --- a/app/src/main/res/layout/gameinformation_select_item.xml +++ b/app/src/main/res/layout/gameinformation_select_item.xml @@ -11,7 +11,7 @@ android:layout_centerInParent="true" android:background="@drawable/textview_search_style" android:gravity="center" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="16sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gamestrategy.xml b/app/src/main/res/layout/gamestrategy.xml index 90e9b74d91..90f8d44673 100644 --- a/app/src/main/res/layout/gamestrategy.xml +++ b/app/src/main/res/layout/gamestrategy.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:text="加载中..." - android:textColor="#666666" + android:textColor="@color/content" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/gameupdate.xml b/app/src/main/res/layout/gameupdate.xml index 64d843c36d..78d93790d8 100644 --- a/app/src/main/res/layout/gameupdate.xml +++ b/app/src/main/res/layout/gameupdate.xml @@ -9,17 +9,7 @@ android:layout_height="match_parent" > - + diff --git a/app/src/main/res/layout/gameupdate_item.xml b/app/src/main/res/layout/gameupdate_item.xml index dea0f2780c..cdc16ad441 100644 --- a/app/src/main/res/layout/gameupdate_item.xml +++ b/app/src/main/res/layout/gameupdate_item.xml @@ -28,21 +28,21 @@ android:id="@+id/gu_item_tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="15sp" /> @@ -54,7 +54,7 @@ android:background="@drawable/textview_green_style" android:gravity="center" android:text="更新" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> @@ -65,7 +65,7 @@ android:layout_marginTop="3dp" android:ellipsize="end" android:singleLine="true" - android:textColor="#666666" + android:textColor="@color/content" android:textSize="12sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/gameupdate_item_top.xml b/app/src/main/res/layout/gameupdate_item_top.xml index 2acff4de64..f7ebfec90c 100644 --- a/app/src/main/res/layout/gameupdate_item_top.xml +++ b/app/src/main/res/layout/gameupdate_item_top.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/layout/home3_fragment.xml b/app/src/main/res/layout/home3_fragment.xml index 64a7934fa2..8291ce4c0d 100644 --- a/app/src/main/res/layout/home3_fragment.xml +++ b/app/src/main/res/layout/home3_fragment.xml @@ -14,7 +14,7 @@ android:id="@+id/me_rl_top" android:layout_width="match_parent" android:layout_height="260dp" - android:background="#FFFFFFFF"> + android:background="@android:color/white"> @@ -81,14 +81,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:background="#FFFFFFFF" + android:background="@android:color/white" android:visibility="gone"> + android:background="@color/theme"/> diff --git a/app/src/main/res/layout/home3_fragment_function.xml b/app/src/main/res/layout/home3_fragment_function.xml index 2a4de61dfe..4e00c85413 100644 --- a/app/src/main/res/layout/home3_fragment_function.xml +++ b/app/src/main/res/layout/home3_fragment_function.xml @@ -2,7 +2,7 @@ + android:background="@color/theme" > @@ -78,7 +78,7 @@ android:background="@drawable/oval_hint_red_bg" android:gravity="center" android:text="2" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="10sp" /> @@ -88,7 +88,7 @@ android:layout_marginBottom="10dp" android:layout_marginTop="3dp" android:text="下载管理" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> @@ -126,7 +126,7 @@ android:background="@drawable/oval_hint_red_bg" android:gravity="center" android:text="2" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="10sp" /> @@ -136,7 +136,7 @@ android:layout_marginBottom="10dp" android:layout_marginTop="3dp" android:text="更新管理" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> @@ -166,7 +166,7 @@ android:layout_marginBottom="10dp" android:layout_marginTop="3dp" android:text="设置" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/home_actionbar.xml b/app/src/main/res/layout/home_actionbar.xml index d422c6d708..e65954a211 100644 --- a/app/src/main/res/layout/home_actionbar.xml +++ b/app/src/main/res/layout/home_actionbar.xml @@ -3,7 +3,7 @@ android:id="@+id/home_actionbar" android:layout_width="match_parent" android:layout_height="48dp" - android:background="@color/theme_colors" + android:background="@color/theme" android:baselineAligned="false" android:gravity="center_vertical" android:orientation="horizontal" > @@ -31,7 +31,7 @@ android:layout_marginTop="8dp" android:background="@drawable/oval_hint_red_bg" android:gravity="center" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="8sp" /> diff --git a/app/src/main/res/layout/home_consolegame_item.xml b/app/src/main/res/layout/home_consolegame_item.xml index cd62ef8995..e71e314a23 100644 --- a/app/src/main/res/layout/home_consolegame_item.xml +++ b/app/src/main/res/layout/home_consolegame_item.xml @@ -28,7 +28,7 @@ android:gravity="left" android:maxLength="3" android:text="1" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="14sp" android:visibility="gone" android:clipChildren="false" /> @@ -105,7 +105,7 @@ android:gravity="right" android:singleLine="true" android:text="44.5%" - android:textColor="#666666" + android:textColor="@color/content" android:textSize="10sp" /> + android:orientation="horizontal"> + + diff --git a/app/src/main/res/layout/home_game_head_item.xml b/app/src/main/res/layout/home_game_head_item.xml index 825732cf78..690f18ba67 100644 --- a/app/src/main/res/layout/home_game_head_item.xml +++ b/app/src/main/res/layout/home_game_head_item.xml @@ -2,13 +2,14 @@ @@ -16,11 +17,10 @@ android:id="@+id/head_title" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginLeft="5dp" android:layout_toRightOf="@+id/head_thumb" android:gravity="fill_vertical|center" android:text="新测卡牌" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="16sp" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/home_game_normal_item.xml b/app/src/main/res/layout/home_game_normal_item.xml index d717b75b62..0b12efa30c 100644 --- a/app/src/main/res/layout/home_game_normal_item.xml +++ b/app/src/main/res/layout/home_game_normal_item.xml @@ -12,7 +12,7 @@ android:text="1" android:gravity="center" android:layout_centerVertical="true" - android:textColor="#333333" + android:textColor="@color/title" android:layout_marginRight="4dp" android:maxLength="3" android:textSize="14sp" @@ -89,7 +89,7 @@ android:gravity="right" android:singleLine="true" android:text="44.5%" - android:textColor="#666666" + android:textColor="@color/content" android:textSize="10sp" /> @@ -154,7 +154,7 @@ android:background="@drawable/textview_blue_style" android:gravity="center" android:text="下载" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/home_game_test_item.xml b/app/src/main/res/layout/home_game_test_item.xml index 5a0967f721..ea5f7ee691 100644 --- a/app/src/main/res/layout/home_game_test_item.xml +++ b/app/src/main/res/layout/home_game_test_item.xml @@ -14,7 +14,7 @@ android:gravity="center" android:maxLength="3" android:text="1" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="14sp" android:visibility="gone" /> @@ -57,7 +57,7 @@ android:ellipsize="end" android:singleLine="true" android:text="九游版 1.2MB/s(剩3分30秒)" - android:textColor="#666666" + android:textColor="@color/content" android:textSize="12sp" /> @@ -97,7 +97,7 @@ android:background="@drawable/textview_blue_style" android:gravity="center" android:text="下载" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> @@ -141,7 +141,7 @@ android:paddingRight="4dp" android:paddingTop="2dp" android:text="null" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="12sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/home_list_item_gamenormal_type.xml b/app/src/main/res/layout/home_list_item_gamenormal_type.xml index 1721bb48e5..c1118ebfd5 100644 --- a/app/src/main/res/layout/home_list_item_gamenormal_type.xml +++ b/app/src/main/res/layout/home_list_item_gamenormal_type.xml @@ -20,7 +20,7 @@ android:layout_toRightOf="@id/home1_game_thumb" android:ellipsize="end" android:singleLine="true" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="15sp" /> @@ -97,7 +97,7 @@ android:background="@drawable/textview_blue_style" android:gravity="center" android:text="下载" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> @@ -109,7 +109,7 @@ android:layout_marginTop="5dp" android:ellipsize="end" android:maxLines="2" - android:textColor="#666666" + android:textColor="@color/content" android:textSize="13sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/home_list_item_newsimage_type.xml b/app/src/main/res/layout/home_list_item_newsimage_type.xml index 61ff41568e..49d04b1d1b 100644 --- a/app/src/main/res/layout/home_list_item_newsimage_type.xml +++ b/app/src/main/res/layout/home_list_item_newsimage_type.xml @@ -25,7 +25,7 @@ android:ellipsize="end" android:gravity="left" android:maxLines="1" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="16sp" android:textStyle="bold" /> @@ -36,7 +36,7 @@ android:ellipsize="end" android:gravity="right" android:maxLines="1" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="15sp" android:textStyle="bold" /> diff --git a/app/src/main/res/layout/home_list_item_newsnormal_type.xml b/app/src/main/res/layout/home_list_item_newsnormal_type.xml index b1637045d3..119a8c3e70 100644 --- a/app/src/main/res/layout/home_list_item_newsnormal_type.xml +++ b/app/src/main/res/layout/home_list_item_newsnormal_type.xml @@ -15,7 +15,7 @@ android:gravity="center" android:paddingLeft="1dp" android:paddingRight="1dp" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="12sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/mygame_item.xml b/app/src/main/res/layout/mygame_item.xml index 28b2a52d1b..2180287eee 100644 --- a/app/src/main/res/layout/mygame_item.xml +++ b/app/src/main/res/layout/mygame_item.xml @@ -38,7 +38,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="5dp" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="15sp" /> @@ -58,14 +58,14 @@ android:background="@drawable/textview_orange_style" android:gravity="center" android:text="打开" - android:textColor="#ffffff" /> + android:textColor="@android:color/white" /> @@ -33,7 +33,7 @@ android:layout_below="@id/platform_item_tv_name" android:gravity="center" android:text="插件化" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:visibility="gone" /> \ No newline at end of file diff --git a/app/src/main/res/layout/news_list_item_category.xml b/app/src/main/res/layout/news_list_item_category.xml index 6cb430b246..28c0707667 100644 --- a/app/src/main/res/layout/news_list_item_category.xml +++ b/app/src/main/res/layout/news_list_item_category.xml @@ -11,7 +11,7 @@ android:layout_height="wrap_content" android:gravity="center" android:text="我的游戏" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:paddingLeft="16dp" android:textSize="12sp" /> diff --git a/app/src/main/res/layout/news_list_item_gamenormal_type.xml b/app/src/main/res/layout/news_list_item_gamenormal_type.xml index b00095e133..a0daf58637 100644 --- a/app/src/main/res/layout/news_list_item_gamenormal_type.xml +++ b/app/src/main/res/layout/news_list_item_gamenormal_type.xml @@ -19,7 +19,7 @@ android:layout_toRightOf="@+id/news_game_thumb" android:ellipsize="end" android:singleLine="true" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="15sp" /> - + diff --git a/app/src/main/res/layout/plugin1_autoscrollviewpager_viewholder.xml b/app/src/main/res/layout/plugin1_autoscrollviewpager_viewholder.xml index a708c4d4dd..4756b6ba1b 100644 --- a/app/src/main/res/layout/plugin1_autoscrollviewpager_viewholder.xml +++ b/app/src/main/res/layout/plugin1_autoscrollviewpager_viewholder.xml @@ -28,7 +28,7 @@ android:layout_height="match_parent" android:gravity="center" android:text="加载失败,点击重试" - android:textColor="#333333" + android:textColor="@color/title" android:textSize="14sp" android:visibility="gone" /> diff --git a/app/src/main/res/layout/plugin1_fragment.xml b/app/src/main/res/layout/plugin1_fragment.xml index f777de33ba..63892c93bb 100644 --- a/app/src/main/res/layout/plugin1_fragment.xml +++ b/app/src/main/res/layout/plugin1_fragment.xml @@ -12,7 +12,7 @@ android:id="@+id/game_list" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/bg_color"> + android:background="@color/background"> @@ -21,7 +21,7 @@ android:layout_width="40dp" android:layout_height="40dp" android:layout_centerInParent="true" - android:background="@color/theme_colors" /> + android:background="@color/theme" /> diff --git a/app/src/main/res/layout/plugin_container_fragments.xml b/app/src/main/res/layout/plugin_container_fragments.xml index 73940a893c..9e51688c1b 100644 --- a/app/src/main/res/layout/plugin_container_fragments.xml +++ b/app/src/main/res/layout/plugin_container_fragments.xml @@ -9,7 +9,7 @@ + android:background="@android:color/white" > + android:textColor="@color/theme" /> + android:textColor="@color/title" /> + android:textColor="@color/title" /> + android:background="@color/theme" /> + android:background="@color/theme" /> \ No newline at end of file diff --git a/app/src/main/res/layout/refresh_footerview.xml b/app/src/main/res/layout/refresh_footerview.xml index 97d1fb8f60..2313cd6300 100644 --- a/app/src/main/res/layout/refresh_footerview.xml +++ b/app/src/main/res/layout/refresh_footerview.xml @@ -18,7 +18,7 @@ android:layout_height="wrap_content" android:layout_margin="10dp" android:text="加载中..." - android:textColor="#666666" + android:textColor="@color/content" android:textSize="14sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/reuse_actionbar.xml b/app/src/main/res/layout/reuse_actionbar.xml index 48dfcdffb2..fa260578a8 100644 --- a/app/src/main/res/layout/reuse_actionbar.xml +++ b/app/src/main/res/layout/reuse_actionbar.xml @@ -3,7 +3,7 @@ android:id="@+id/reuse_actionbar" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/theme_colors" > + android:background="@color/theme" > \ No newline at end of file diff --git a/app/src/main/res/layout/reuse_no_connection.xml b/app/src/main/res/layout/reuse_no_connection.xml index 29d561d5eb..0fc3bf4cb9 100644 --- a/app/src/main/res/layout/reuse_no_connection.xml +++ b/app/src/main/res/layout/reuse_no_connection.xml @@ -3,22 +3,30 @@ android:id="@+id/reuse_no_connection" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/bg_color" - android:gravity="center" android:orientation="vertical" + android:gravity="center" android:visibility="gone" > + android:src="@drawable/reuse_network_error" /> + android:text="噢,网络好似开小差了~" + android:textColor="#c7c7c7" + android:textSize="15sp" /> + + \ No newline at end of file diff --git a/app/src/main/res/layout/reuse_nodata_skip.xml b/app/src/main/res/layout/reuse_nodata_skip.xml new file mode 100644 index 0000000000..08859efa67 --- /dev/null +++ b/app/src/main/res/layout/reuse_nodata_skip.xml @@ -0,0 +1,29 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/reuse_none_data.xml b/app/src/main/res/layout/reuse_none_data.xml new file mode 100644 index 0000000000..8373e4c291 --- /dev/null +++ b/app/src/main/res/layout/reuse_none_data.xml @@ -0,0 +1,24 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/reuse_none_date.xml b/app/src/main/res/layout/reuse_none_date.xml deleted file mode 100644 index 43f7078a68..0000000000 --- a/app/src/main/res/layout/reuse_none_date.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/search_actionbar.xml b/app/src/main/res/layout/search_actionbar.xml index 2ba9e32029..52fac246ee 100644 --- a/app/src/main/res/layout/search_actionbar.xml +++ b/app/src/main/res/layout/search_actionbar.xml @@ -2,7 +2,7 @@ @@ -62,7 +62,7 @@ android:layout_weight="1.5" android:gravity="center" android:text="搜索" - android:textColor="#FFFFFF" + android:textColor="@android:color/white" android:textSize="16sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/search_history_delete_dialog.xml b/app/src/main/res/layout/search_history_delete_dialog.xml index 50bb663c15..9a49f85b00 100644 --- a/app/src/main/res/layout/search_history_delete_dialog.xml +++ b/app/src/main/res/layout/search_history_delete_dialog.xml @@ -13,7 +13,7 @@ android:layout_marginLeft="20dp" android:layout_marginTop="8dp" android:text="清空" - android:textColor="@color/theme_colors" + android:textColor="@color/theme" android:textSize="16sp" /> @@ -73,7 +73,7 @@ android:background="@drawable/textview_blue_style" android:gravity="center" android:text="确定" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/set_wait_dialog.xml b/app/src/main/res/layout/set_wait_dialog.xml index caf34d030b..7b5efe0af4 100644 --- a/app/src/main/res/layout/set_wait_dialog.xml +++ b/app/src/main/res/layout/set_wait_dialog.xml @@ -11,7 +11,7 @@ android:layout_marginLeft="70dp" android:layout_marginRight="70dp" android:layout_marginTop="15dp" - android:background="@color/theme_colors" /> + android:background="@color/theme" /> \ No newline at end of file diff --git a/app/src/main/res/layout/setting_disclaimer_dialog.xml b/app/src/main/res/layout/setting_disclaimer_dialog.xml index dc79d4e5ed..05cbf74d5e 100644 --- a/app/src/main/res/layout/setting_disclaimer_dialog.xml +++ b/app/src/main/res/layout/setting_disclaimer_dialog.xml @@ -12,7 +12,7 @@ android:layout_marginBottom="3dp" android:layout_marginLeft="20dp" android:layout_marginTop="8dp" - android:textColor="@color/theme_colors" + android:textColor="@color/theme" android:textSize="16sp" /> @@ -51,7 +51,7 @@ android:background="@drawable/textview_blue_style" android:gravity="center" android:text="确定" - android:textColor="#ffffff" + android:textColor="@android:color/white" android:textSize="14sp" /> diff --git a/app/src/main/res/layout/viewimage_item.xml b/app/src/main/res/layout/viewimage_item.xml index 56ff42b54d..6d0eecb805 100644 --- a/app/src/main/res/layout/viewimage_item.xml +++ b/app/src/main/res/layout/viewimage_item.xml @@ -21,6 +21,6 @@ android:layout_height="40dp" android:layout_centerInParent="true" android:visibility="gone" - android:background="@color/theme_colors" /> + android:background="@color/theme" /> \ No newline at end of file diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml deleted file mode 100644 index 63fc816444..0000000000 --- a/app/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 64dp - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 5293b0003c..ab21eb9fe4 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,18 +1,32 @@ - #6633B5E5 - #1BA4FC - #F5F5F5 - #edf2f4 - #FFFFFF - #E7E7E7 - #ffffff - #c9c9c9 - #666666 - #DCDCDC - #333333 - #666666 + + #00B7FA + + #3A3A3A + + #9A9A9A + + #B3B3B3 + + #EDF2F4 + + #EDEDED + + #E7E7E7 + + + #00B7FA + #06D0A8 + #FFB13C + #C7C7C7 + #A7A8B2 + + + #05C400 + #FFB13C + #FF6A28 #fda34d @@ -24,6 +38,5 @@ #fda34d #2ec991 - - #1BA4FC + \ No newline at end of file