diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 862a7ce385..bb0eb6ff89 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -260,13 +260,7 @@
-
-
-
-
-
+
diff --git a/app/src/main/java/com/gh/base/GHPushMessageReceiver.java b/app/src/main/java/com/gh/base/GHPushMessageReceiver.java
deleted file mode 100644
index 33795721b7..0000000000
--- a/app/src/main/java/com/gh/base/GHPushMessageReceiver.java
+++ /dev/null
@@ -1,323 +0,0 @@
-package com.gh.base;
-
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
-import android.graphics.BitmapFactory;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.v4.app.NotificationCompat;
-import android.support.v4.util.ArrayMap;
-import android.text.TextUtils;
-import android.widget.RemoteViews;
-
-import com.gh.common.util.AppDebugConfig;
-import com.gh.common.util.EntranceUtils;
-import com.gh.common.util.PackageUtils;
-import com.gh.common.util.TokenUtils;
-import com.gh.gamecenter.BuildConfig;
-import com.gh.gamecenter.R;
-import com.halo.assistant.HaloApp;
-import com.lightgame.download.FileUtils;
-import com.lightgame.utils.Utils;
-import com.xiaomi.mipush.sdk.ErrorCode;
-import com.xiaomi.mipush.sdk.MiPushClient;
-import com.xiaomi.mipush.sdk.MiPushCommandMessage;
-import com.xiaomi.mipush.sdk.MiPushMessage;
-import com.xiaomi.mipush.sdk.PushMessageReceiver;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-
-import static com.gh.common.util.EntranceUtils.ENTRANCE_MIPUSH;
-import static com.gh.common.util.EntranceUtils.HOST_ARTICLE;
-import static com.gh.common.util.EntranceUtils.HOST_GAME;
-import static com.gh.common.util.EntranceUtils.HOST_WEB;
-import static com.gh.common.util.EntranceUtils.HOST_COLUMN;
-import static com.gh.common.util.EntranceUtils.KEY_ENTRANCE;
-import static com.gh.common.util.EntranceUtils.KEY_GAMEID;
-import static com.gh.common.util.EntranceUtils.KEY_ID;
-import static com.gh.common.util.EntranceUtils.KEY_NEWSID;
-import static com.gh.common.util.EntranceUtils.KEY_TARGET;
-import static com.gh.common.util.EntranceUtils.KEY_TO;
-import static com.gh.common.util.EntranceUtils.KEY_TYPE;
-import static com.gh.common.util.EntranceUtils.KEY_URL;
-
-/**
- * 1、PushMessageReceiver是个抽象类,该类继承了BroadcastReceiver。
- * 2、需要将自定义的DemoMessageReceiver注册在AndroidManifest.xml文件中
- *
- *
- *
- *
- * 3、DemoMessageReceiver的onReceivePassThroughMessage方法用来接收服务器向客户端发送的透传消息
- * 4、DemoMessageReceiver的onNotificationMessageClicked方法用来接收服务器向客户端发送的通知消息,
- * 这个回调方法会在用户手动点击通知后触发
- * 5、DemoMessageReceiver的onNotificationMessageArrived方法用来接收服务器向客户端发送的通知消息,
- * 这个回调方法是在通知消息到达客户端时触发。另外应用在前台时不弹出通知的通知消息到达客户端也会触发这个回调函数
- * 6、DemoMessageReceiver的onCommandResult方法用来接收客户端向服务器发送命令后的响应结果
- * 7、DemoMessageReceiver的onReceiveRegisterResult方法用来接收客户端向服务器发送注册命令后的响应结果
- * 8、以上这些方法运行在非UI线程中
- *
- * @author mayixiang
- * //TODO 请勿更改此类路径,若需更改时请注意更改./libraries/MiPush/proguard-library.txt混淆对应配置
- */
-public class GHPushMessageReceiver extends PushMessageReceiver {
-
- private String mAlias;
-
- @Override
- public void onReceivePassThroughMessage(Context context, MiPushMessage message) {
- if (BuildConfig.DEBUG) {
- AppDebugConfig.logMethodWithParams(this, message);
- }
- // 1判断notifyid是否为4
- try {
- //TODO what is magic number 4?
- if (message.getNotifyId() == 4) {
- JSONObject jsonObject = new JSONObject(message.getContent());
- Utils.log(jsonObject.toString());
- String channel = jsonObject.getString("channel");
- Utils.log("channel = " + channel);
-
- // 1判断渠道号是否一致或是否为ALL
- String packageChannel = HaloApp.getInstance().getChannel();
- if ("ALL".equals(channel) || channel.equalsIgnoreCase(packageChannel)) {
- String type = jsonObject.getString(KEY_TYPE);
- Utils.log("type = " + type);
- JSONArray jsonArray;
- ArrayMap map;
- // TODO: 19/11/17 和下面的onClick处理又不一致
- switch (type) {
- case "NEWS":
- // 新闻推送
- jsonArray = jsonObject.getJSONArray("package");
- map = getInstalledMapFromLocal(context);
- for (int i = 0; i < jsonArray.length(); i++) {
- Boolean b = map.get(jsonArray.getString(i));
- if (b != null) {
- // 显示推送的消息
- showNotification(context, jsonObject, 0);
- break;
- }
- }
- break;
- case "PLUGIN_UPDATE":
- // 插件更新推送 // TODO: 19/11/17 为什么以前的umeng推送没有插件更新推送
- jsonArray = jsonObject.getJSONArray("apk");
- map = getInstalledMapFromLocal(context);
- for (int i = 0; i < jsonArray.length(); i++) {
- JSONObject apk = jsonArray.getJSONObject(i);
- String packageName = apk.getString("package");
- Boolean b = map.get(packageName);
- if (b != null) {
- // 判断是否gh_version是否相同
- String gh_version = (String) PackageUtils
- .getMetaData(context, packageName, "gh_version");
- if (gh_version != null) {
- gh_version = gh_version.substring(2);
- // 判断gh_version是否相同
- if (gh_version.equals(apk.getString("gh_version"))) {
- // 判断version是否相同
- String version = PackageUtils.getVersionByPackage(context, packageName);
- if (apk.getString("version").equals(version)) {
- // 版本相同,无需显示插件更新,继续查看是否有可更新的游戏包
- continue;
- }
- }
- }
- // 显示推送的消息
- showNotification(context, jsonObject, 1);
- break;
- }
- }
- break;
- case "NEW_GAME":
- // 新游推送 // TODO: 19/11/17 为什么以前的umeng推送没有新游推送更新推送
- showNotification(context, jsonObject, 2);
- break;
- default:
- break;
- }
- }
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- private ArrayMap getInstalledMapFromLocal(Context context) {
- ArrayMap map = new ArrayMap<>();
- ArrayList list = getAllPackageName(context);
- for (String str : list) {
- map.put(str, true);
- }
- return map;
- }
-
- 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);
- intent.putExtra("notifyData", jsonObject.toString());
- PendingIntent pendingIntent = PendingIntent.getBroadcast(context, id, intent, PendingIntent.FLAG_ONE_SHOT);
-
- NotificationManager nManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
-
- RemoteViews remoteViews = null;
-
- if (Build.MANUFACTURER.equals("Meizu") &&
- (Build.MODEL.startsWith("m") || Build.MODEL.startsWith("MX"))) {
- remoteViews = new RemoteViews(context.getPackageName(), R.layout.notification_meizu);
- SimpleDateFormat format = new SimpleDateFormat("HH:mm", Locale.getDefault());
- 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"))) {
- // 小米系统
- remoteViews = new RemoteViews(context.getPackageName(), R.layout.notification_xiaomi);
- SimpleDateFormat format = new SimpleDateFormat("ah:mm", Locale.getDefault());
- remoteViews.setTextViewText(R.id.time, format.format(new Date()));
- } else if (Build.MANUFACTURER.equals("HUAWEI")) {
- // 华为系统
- remoteViews = new RemoteViews(context.getPackageName(), R.layout.notification_huawei);
- }
-
- String url = jsonObject.getString("icon");
- String path = context.getCacheDir() + File.separator + url.substring(url.lastIndexOf("/") + 1);
- int result = FileUtils.downloadFile(url, path);
- if (result != 200) {
- // 下载出错,使用光环logo
- path = null;
- }
-
- final NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
- .setTicker(jsonObject.getString("pushTitle"))
- .setContentTitle(jsonObject.getString("pushTitle"))
- .setContentText(jsonObject.getString("pushDesc"))
- .setContentIntent(pendingIntent)
- .setDefaults(Notification.DEFAULT_SOUND) // 添加系统默认声音
- .setAutoCancel(true); // FLAG_AUTO_CANCEL表明当通知被用户点击时,通知将被清除。
-
- if (remoteViews != null) {
- if (path == null) {
- remoteViews.setImageViewBitmap(R.id.icon, BitmapFactory.decodeResource(context.getResources(), R.drawable.logo));
- } else {
- remoteViews.setImageViewBitmap(R.id.icon, BitmapFactory.decodeFile(path));
- }
- remoteViews.setTextViewText(R.id.title, jsonObject.getString("pushTitle"));
- remoteViews.setTextViewText(R.id.intro, jsonObject.getString("pushDesc"));
-
- builder.setSmallIcon(R.drawable.logo);
- builder.setCustomContentView(remoteViews);
-
- } else {
- builder.setSmallIcon(R.drawable.logo_black);
- if (path == null) {
- builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.logo));
- } else {
- builder.setLargeIcon(BitmapFactory.decodeFile(path));
- }
- }
-
- nManager.notify(((int) System.currentTimeMillis() / 1000), builder.build());// 通过通知管理器来发起通知。如果id不同,则每click,在status哪里增加一个提示
- }
-
- private ArrayList getAllPackageName(Context context) {
- ArrayList list = new ArrayList<>();
- List packageInfos = context.getPackageManager().getInstalledPackages(0);
- for (PackageInfo packageInfo : packageInfos) {
- if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
- list.add(packageInfo.packageName);
- }
- }
- return list;
- }
-
- @Override
- public void onNotificationMessageClicked(Context context, MiPushMessage message) {
- if (BuildConfig.DEBUG) {
- AppDebugConfig.logMethodWithParams(this, message);
- }
- try {
- String content = message.getContent();
- JSONObject response = new JSONObject(content);
- Bundle bundle = new Bundle();
- bundle.putString(KEY_ENTRANCE, ENTRANCE_MIPUSH);
- String type = response.getString(KEY_TYPE);
- String target = response.getString(KEY_TARGET);
-
- switch (type) {
- case HOST_ARTICLE:
- bundle.putString(KEY_TO, "NewsDetailActivity");
- bundle.putString(KEY_NEWSID, target);
- break;
- case HOST_GAME:
- bundle.putString(KEY_TO, "GameDetailActivity");
- bundle.putString(KEY_GAMEID, target);
- break;
- case HOST_COLUMN:
- bundle.putString(KEY_TO, "SubjectActivity");
- bundle.putString(KEY_ID, target);
- break;
- case HOST_WEB:
- bundle.putString(KEY_TO, "WebActivity");
- bundle.putString(KEY_URL, target);
- break;
- }
- EntranceUtils.jumpActivity(context, bundle);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void onNotificationMessageArrived(Context context, MiPushMessage message) {
- if (BuildConfig.DEBUG) {
- AppDebugConfig.logMethodWithParams(this, message);
- }
- }
-
- @Override
- public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {
- if (BuildConfig.DEBUG) {
- AppDebugConfig.logMethodWithParams(this, message);
- }
- }
-
- @Override
- public void onCommandResult(Context context, MiPushCommandMessage message) {
- if (BuildConfig.DEBUG) {
- AppDebugConfig.logMethodWithParams(this, message);
- }
-
- String command = message.getCommand();
- List arguments = message.getCommandArguments();
-
- if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) {
- if (message.getResultCode() == ErrorCode.SUCCESS) {
- mAlias = arguments.get(0);
- }
- }
-
- if (TextUtils.isEmpty(mAlias)) {
- //添加别名
- MiPushClient.setAlias(context, TokenUtils.getDeviceId(context), null);
- }
- }
-
-}
diff --git a/app/src/main/java/com/gh/base/fragment/BaseFragment.java b/app/src/main/java/com/gh/base/fragment/BaseFragment.java
index 84e8b895a6..b50f09264c 100644
--- a/app/src/main/java/com/gh/base/fragment/BaseFragment.java
+++ b/app/src/main/java/com/gh/base/fragment/BaseFragment.java
@@ -31,8 +31,7 @@ import rx.schedulers.Schedulers;
public abstract class BaseFragment extends Fragment implements OnRequestCallBackListener,
View.OnClickListener, OnListClickListener{
- // TODO private view
- protected View view;
+ private View view;
protected boolean isEverPause;
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 94d71396f2..61b00b5710 100644
--- a/app/src/main/java/com/gh/common/util/DialogUtils.java
+++ b/app/src/main/java/com/gh/common/util/DialogUtils.java
@@ -366,30 +366,6 @@ public class DialogUtils {
showWarningDialog(context, "插件化安装", spanned, listener);
}
- public static void showDisclaimerDialog(Context context, String content) {
- final Dialog disclaimerDialog = new Dialog(context);
- View view = View.inflate(context, R.layout.dialog_disclaimer, null);
-
-// TextView title = (TextView) view.findViewById(R.id.disclaimer_title);
-// title.setText("免责声明");
-
- TextView message = (TextView) view.findViewById(R.id.disclaimer_message);
- Spanned spanned = Html.fromHtml(content);
- message.setText(spanned);
-
- view.findViewById(R.id.disclaimer_confirm).setOnClickListener(
- new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- disclaimerDialog.dismiss();
- }
- });
-
- disclaimerDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
- disclaimerDialog.setContentView(view);
- disclaimerDialog.show();
- }
-
/**
* Material Design 风格弹窗
*
@@ -405,42 +381,6 @@ public class DialogUtils {
public static void showAlertDialog(Context context, String title, CharSequence message
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
-// AlertDialog alertDialog = new AlertDialog.Builder(context, R.style.GhAlertDialog)
-// .setTitle(title)
-// .setMessage(message)
-// .setPositiveButton(positive, new DialogInterface.OnClickListener() {
-// @Override
-// public void onClick(DialogInterface dialog, int which) {
-// if (cmListener != null) {
-// cmListener.onConfirm();
-// }
-// }
-// })
-// .setNegativeButton(negative, new DialogInterface.OnClickListener() {
-// @Override
-// public void onClick(DialogInterface dialog, int which) {
-// if (clListener != null) {
-// clListener.onCancel();
-// }
-// }
-// })
-// .create();
-// alertDialog.show();
-//
-// TextView mesage = (TextView) alertDialog.findViewById(android.R.id.message);
-// Button positiveBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE);
-// Button negativeBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_NEGATIVE);
-//
-// positiveBtn.setTextSize(14);
-// positiveBtn.setTextColor(ContextCompat.getColor(context, R.color.theme));
-// negativeBtn.setTextSize(14);
-// negativeBtn.setTextColor(ContextCompat.getColor(context, R.color.theme));
-// if (mesage != null) {
-// mesage.setTextSize(14);
-// mesage.setTextColor(ContextCompat.getColor(context, R.color.system_bar));
-// mesage.setLineSpacing(1.0f, 1.3f);
-// }
-
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
@@ -495,35 +435,6 @@ public class DialogUtils {
public static void showAlertDialog(Context context, String title, CharSequence message
, String positive, String negative, final ConfirmListener cmListener) {
-// AlertDialog alertDialog = new AlertDialog.Builder(context, R.style.GhAlertDialog)
-// .setTitle(title)
-// .setMessage(message)
-// .setPositiveButton(positive, new DialogInterface.OnClickListener() {
-// @Override
-// public void onClick(DialogInterface dialog, int which) {
-// if (cmListener != null) {
-// cmListener.onConfirm();
-// }
-// }
-// })
-// .setNegativeButton(negative, null)
-// .create();
-// alertDialog.show();
-//
-// TextView mesage = (TextView) alertDialog.findViewById(android.R.id.message);
-// Button positiveBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE);
-// Button negativeBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_NEGATIVE);
-//
-// positiveBtn.setTextSize(14);
-// positiveBtn.setTextColor(ContextCompat.getColor(context, R.color.theme));
-// negativeBtn.setTextSize(14);
-// negativeBtn.setTextColor(ContextCompat.getColor(context, R.color.hint));
-// if (mesage != null) {
-// mesage.setTextSize(14);
-// mesage.setTextColor(ContextCompat.getColor(context, R.color.system_bar));
-// mesage.setLineSpacing(1.0f, 1.3f);
-// }
-
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
@@ -568,48 +479,6 @@ public class DialogUtils {
public static void showCancelListenerDialog(Context context, String title, CharSequence message
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
-// AlertDialog alertDialog = new AlertDialog.Builder(context, R.style.GhAlertDialog)
-// .setTitle(title)
-// .setMessage(message)
-// .setPositiveButton(positive, new DialogInterface.OnClickListener() {
-// @Override
-// public void onClick(DialogInterface dialog, int which) {
-// if (cmListener != null) {
-// cmListener.onConfirm();
-// }
-// }
-// })
-// .setNegativeButton(negative, new DialogInterface.OnClickListener() {
-// @Override
-// public void onClick(DialogInterface dialog, int which) {
-// if (clListener != null) {
-// clListener.onCancel();
-// }
-// }
-// })
-// .setOnCancelListener(new DialogInterface.OnCancelListener() {
-// @Override
-// public void onCancel(DialogInterface dialogInterface) {
-// clListener.onCancel();
-// }
-// })
-// .create();
-//
-// alertDialog.show();
-//
-// TextView mesage = (TextView) alertDialog.findViewById(android.R.id.message);
-// Button positiveBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE);
-// Button negativeBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_NEGATIVE);
-//
-// positiveBtn.setTextSize(14);
-// positiveBtn.setTextColor(ContextCompat.getColor(context, R.color.theme));
-// negativeBtn.setTextSize(14);
-// negativeBtn.setTextColor(ContextCompat.getColor(context, R.color.hint));
-// if (mesage != null) {
-// mesage.setTextSize(14);
-// mesage.setTextColor(ContextCompat.getColor(context, R.color.system_bar));
-// mesage.setLineSpacing(1.0f, 1.3f);
-// }
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
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 fc5335cda3..467485caf7 100644
--- a/app/src/main/java/com/gh/common/util/DownloadItemUtils.java
+++ b/app/src/main/java/com/gh/common/util/DownloadItemUtils.java
@@ -60,7 +60,7 @@ public class DownloadItemUtils {
gameEntity.setEntryMap(entryMap);
}
entryMap.put(platform, downloadEntity);
- if (!"pause".equals(DownloadManager.getInstance(context).getStatus(downloadEntity.getUrl()))) {
+ if (!DownloadStatus.pause.equals(DownloadManager.getInstance(context).getStatus(downloadEntity.getUrl()))) {
adapter.notifyItemChanged(index);
}
} else {
@@ -84,7 +84,7 @@ public class DownloadItemUtils {
gameEntity.setEntryMap(entryMap);
}
entryMap.put(platform, downloadEntity);
- if (!"pause".equals(DownloadManager.getInstance(context).getStatus(downloadEntity.getUrl()))) {
+ if (!DownloadStatus.pause.equals(DownloadManager.getInstance(context).getStatus(downloadEntity.getUrl()))) {
adapter.notifyItemChanged(index);
}
}
@@ -230,7 +230,7 @@ public class DownloadItemUtils {
DownloadStatus status = downloadEntity.getStatus();
if (status.equals(DownloadStatus.downloading)) {
- if (!"pause".equals(DownloadManager.getInstance(context).getStatus(downloadEntity.getUrl()))) {
+ if (!DownloadStatus.pause.equals(DownloadManager.getInstance(context).getStatus(downloadEntity.getUrl()))) {
holder.gameProgressbar.setProgress((int) (downloadEntity.getPercent() * 10));
if (isShowPlatform && platform != null) {
holder.gameDownloadSpeed.setText(String.format("%s - %s(剩%s)", platform,
diff --git a/app/src/main/java/com/gh/common/util/TokenUtils.java b/app/src/main/java/com/gh/common/util/TokenUtils.java
index c8b13fac85..ec5c42ff83 100644
--- a/app/src/main/java/com/gh/common/util/TokenUtils.java
+++ b/app/src/main/java/com/gh/common/util/TokenUtils.java
@@ -3,197 +3,20 @@ package com.gh.common.util;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
-import android.os.Environment;
import android.preference.PreferenceManager;
-import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.retrofit.StringResponse;
-import com.lightgame.utils.Utils;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
+import com.lightgame.utils.Util_System_Phone_State;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
public class TokenUtils {
- // 注册设备
-// public static synchronized void register(final Context context) {
-// Map params = new HashMap<>();
-// params.put("MANUFACTURER", Build.MANUFACTURER);
-// params.put("MODEL", Build.MODEL);
-// params.put("ANDROID_SDK", String.valueOf(Build.VERSION.SDK_INT));
-// params.put("ANDROID_VERSION", Build.VERSION.RELEASE);
-// String android_id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
-// if (!TextUtils.isEmpty(android_id)) {
-// params.put("ANDROID_ID", android_id);
-// }
-// String imei = Util_System_Phone_State.getDeviceId(context);
-// if (!TextUtils.isEmpty(imei)) {
-// params.put("IMEI", imei);
-// }
-// WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
-// String mac = wm.getConnectionInfo().getMacAddress();
-// if (!TextUtils.isEmpty(mac) || !":::::".equals(mac)) {
-// params.put("MAC", mac);
-// } else {
-// SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
-// sp.edit().putBoolean("isUploadMac", false).apply();
-// }
-// String mid = StatConfig.getMid(context);
-// if (!TextUtils.isEmpty(mid) || !"0".equals(mid)) {
-// params.put("MTA_ID", mid);
-// } else {
-// SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
-// sp.edit().putBoolean("isUploadMid", false).apply();
-// }
-// RequestBody body = RequestBody.create(MediaType.parse("application/json"), new JSONObject(params).toString());
-// RetrofitManager.getInstance(context).getApi().postRegister(body)
-// .subscribeOn(Schedulers.io())
-// .observeOn(Schedulers.io())
-// .subscribe(new JSONObjectResponse() {
-// @Override
-// public void onResponse(JSONObject response) {
-// if (response.length() != 0) {
-// try {
-// // 保存device_id
-// saveDeviceId(context, response.getString("device_id"));
-// Utils.log("device_id = " + response.getString("device_id"));
-// } catch (JSONException e) {
-// e.printStackTrace();
-// }
-// }
-// }
-// });
-// }
-
- public static synchronized void saveDeviceId(Context context, String device_id) {
- saveSharedPreferences(context, device_id);
- saveDataFile(context, device_id);
- svaeSDCard(device_id, "/gh-uuid");// SDCard根目录
- svaeSDCard(device_id, "/system"); // SDCard system目录
- svaeSDCard(device_id, "/data"); // SDCard data目录
- }
-
- //将uuid存到sp
- private static void saveSharedPreferences(Context context, String device_id) {
- SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
- SharedPreferences.Editor edit = sp.edit();
- edit.putString("uuid", device_id);
- edit.apply();
- Utils.log("saveDeviceId", "保存成功SP");
- }
-
- //将uuid存到data/data/PackageName/files文件夹下
- private static void saveDataFile(Context context, String device_id) {
- FileOutputStream fops;
- try {
- fops = context.openFileOutput("uuid", Context.MODE_PRIVATE);
- fops.write(device_id.getBytes());
- fops.close();
- Utils.log("saveDeviceId", "保存成功DataFile");
- } catch (Exception e) {
- Utils.log("保存uuid到data/data/PackageName/files文件异常" + e.toString());
- e.printStackTrace();
- }
- }
-
- //将uuid存到SD卡
- private static void svaeSDCard(String device_id, String saveDir) {
- File sdCardDir = Environment.getExternalStorageDirectory();
- String path = sdCardDir.getPath() + saveDir;
-
- File file = new File(path);
- if (!file.exists()) {
- file.mkdirs();
- }
-
- // 判断文件是否存在,存在则删除
- File uuidFile = new File(path + "/uuid");
- if (uuidFile.isFile() && uuidFile.exists()) {
- Utils.log(saveDir + "文件夹里的文件存在,执行删除操作");
- uuidFile.delete();
- }
-
- File writeFile = new File(file, "uuid");
- FileOutputStream fos;
- try {
- fos = new FileOutputStream(writeFile);
- fos.write(device_id.getBytes());
- fos.close();
- Utils.log("saveDeviceId", "保存成功SDCard" + "目录为:" + saveDir);
- } catch (Exception e) {
- Utils.log("保存uuid到SDCard异常" + saveDir + e.toString());
- e.printStackTrace();
- }
-
- }
-
-// // 获取用户token
-// public static synchronized Observable getToken(final Context context, boolean isCheck) {
-//
-// if (true) { // TODO TEST
-// return Observable.just(LoginUtils.getToken(context));
-// }
-//
-// String token = null;
-// if (isCheck) {
-// SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
-// token = sp.getString("token", null);
-// if (token != null) {
-// long expire = sp.getLong("token_expire", 0) * 1000 - 10 * 1000;
-// long time = Utils.getTime(context);
-// // 判断token是否过期
-// if (time >= expire) {
-// // token已过期
-// token = null;
-// }
-// }
-// }
-// if (token == null) {
-// Map params = new HashMap<>();
-// params.put("device_id", getDeviceId(context));
-// return RetrofitManager.getInstance(context).getApi()
-// .postLogin(RequestBody.create(MediaType.parse("application/json"), new JSONObject(params).toString()))
-// .flatMap(new Func1>() {
-// @Override
-// public Observable call(ResponseBody responseBody) {
-// String value = null;
-// try {
-// SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
-// Editor editor = sp.edit();
-// JSONObject response = new JSONObject(responseBody.string());
-// editor.putString("user_name", response.getString("name"));
-// editor.putString("user_icon", response.getString("icon"));
-// response = response.getJSONObject("token");
-// editor.putString("token", response.getString("value"));
-// editor.putLong("token_expire", response.getLong("expire"));
-// editor.apply();
-// // 服务器返回的token和本地已存的token相同,更新本地时间
-// getTime(context);
-// value = response.getString("value");
-// } catch (IOException | JSONException e) {
-// e.printStackTrace();
-// }
-// return Observable.just(value);
-// }
-// }).onErrorResumeNext(new Func1>() {
-// @Override
-// public Observable extends String> call(Throwable throwable) {
-// return Observable.error(throwable);
-// }
-// });
-// }
-// return Observable.just(token);
-// }
-
+ // TODO VERSION:3.0 之后不存在deviceId
public static synchronized String getDeviceId(Context context) {
- return loadSharedPreferences(context, false);
+ return Util_System_Phone_State.getDeviceId(context); // 暂时用IMEI代替
}
// 获取服务器时间
@@ -219,118 +42,4 @@ public class TokenUtils {
});
}
- //读取SharedPreferences的uuid
- private static String loadSharedPreferences(Context context, boolean isCheck) {
- SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
- String uuid = sp.getString("uuid", null);
- if (isCheck) {
- return uuid;
- }
- if (uuid == null) {
- return loadDataFile(context, false);
- }
- if (BuildConfig.DEBUG) {
- Utils.log("getDeviceId", "获取成功SP" + uuid);
- }
- return uuid;
- }
-
- //读取data/data/PackageName/files的uuid
- private static String loadDataFile(Context context, boolean isCheck) {
- File file = new File(context.getFilesDir(), "uuid");
- if (file.exists()) {
- try {
- FileInputStream fis = new FileInputStream(file);
- byte[] b = new byte[1024];
- int count = -1;
- String uuid = null;
- while ((count = fis.read(b)) != -1) {
- uuid = new String(b, 0, count, "UTF-8");
- }
- Utils.log("getDeviceId", "获取成功DataFile" + uuid);
- return uuid;
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else if (!isCheck) {
- String[] dirName = {"/gh-uuid", "/system", "/data"};
- for (int i = 0; i < 3; i++) {
- String s = loadSDCard(dirName[i]);
- if (s != null) {
- return s;
- }
- }
- }
- return null;
- }
-
- //读取SD卡的uuid
- private static String loadSDCard(String saveDir) {
- File sdCardDir = Environment.getExternalStorageDirectory();
- String path = sdCardDir.getPath() + saveDir;
- File file = new File(path, "uuid");
- if (file.exists()) {
- FileInputStream fis;
- ByteArrayOutputStream bos;
- try {
- fis = new FileInputStream(file);
- bos = new ByteArrayOutputStream();
- byte[] array = new byte[1024];
- int len = -1;
- while ((len = fis.read(array)) != -1) {
- bos.write(array, 0, len);
- }
- bos.close();
- fis.close();
- Utils.log("getDeviceId", "获取成功SDCard" + "目录为:" + saveDir + "::" + bos.toString());
- return bos.toString();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
-// // 检查设备信息是否已经上传完整
-// public static synchronized void checkDeviceInfo(Context context, String token) {
-// final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
-// final HashMap params = new HashMap<>();
-// if (!sp.getBoolean("isUploadExtra", false)) {
-// params.put("MANUFACTURER", Build.MANUFACTURER);
-// params.put("MODEL", Build.MODEL);
-// params.put("ANDROID_SDK", String.valueOf(Build.VERSION.SDK_INT));
-// params.put("ANDROID_VERSION", Build.VERSION.RELEASE);
-// }
-// if (!sp.getBoolean("isUploadMac", true)) {
-// WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
-// String mac = wm.getConnectionInfo().getMacAddress();
-// if (!TextUtils.isEmpty(mac) || !":::::".equals(mac)) {
-// params.put("MAC", mac);
-// }
-// }
-// if (!sp.getBoolean("isUploadMid", true)) {
-// String mid = StatConfig.getMid(context);
-// if (!TextUtils.isEmpty(mid) || !"0".equals(mid)) {
-// params.put("MTA_ID", mid);
-// }
-// }
-// if (params.size() != 0) {
-// RequestBody body = RequestBody.create(MediaType.parse("application/json"),
-// new JSONObject(params).toString());
-// RetrofitManager.getInstance(context).getApi().postDevice(token, body, TokenUtils.getDeviceId(context))
-// .subscribeOn(Schedulers.io())
-// .observeOn(AndroidSchedulers.mainThread())
-// .subscribe(new Response() {
-// @Override
-// public void onResponse(ResponseBody response) {
-// SharedPreferences.Editor editor = sp.edit();
-// editor.putBoolean("isUploadExtra", true);
-// editor.putBoolean("isUploadMac", true);
-// editor.putBoolean("isUploadMid", true);
-// editor.apply();
-// }
-// });
-// }
-// }
-
}
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 641f5ab97b..bc7fcd4b0c 100644
--- a/app/src/main/java/com/gh/common/view/DownloadDialog.java
+++ b/app/src/main/java/com/gh/common/view/DownloadDialog.java
@@ -73,7 +73,7 @@ public class DownloadDialog implements OnCollectionCallBackListener {
@Override
public void onDataChanged(DownloadEntity downloadEntity) {
if (downloadEntity.getName().equals(gameEntity.getName())
- && !"delete".equals(DownloadManager.getInstance(mContext).getStatus(downloadEntity.getUrl()))) {
+ && !DownloadStatus.delete.equals(DownloadManager.getInstance(mContext).getStatus(downloadEntity.getUrl()))) {
adapter.putDownloadEntity(downloadEntity);
diff --git a/app/src/main/java/com/gh/download/DownloadManager.java b/app/src/main/java/com/gh/download/DownloadManager.java
index c876a7b37e..69d3a3a07d 100644
--- a/app/src/main/java/com/gh/download/DownloadManager.java
+++ b/app/src/main/java/com/gh/download/DownloadManager.java
@@ -52,10 +52,7 @@ public class DownloadManager implements DownloadStatusListener {
private ArrayMap> platformMap;
private ArrayMap> gameMap;
- /**
- * TODO change to {@link DownloadStatus}
- */
- private ArrayMap statusMap;
+ private ArrayMap statusMap;
private ArrayMap downloadingMap;
private DownloadDao mDownloadDao;
@@ -69,7 +66,7 @@ public class DownloadManager implements DownloadStatusListener {
DownloadNotification.showDownloadingNotification(mContext);
- DownloadManager.getInstance(mContext).putStatus(entity.getUrl(), "delete");
+ DownloadManager.getInstance(mContext).putStatus(entity.getUrl(), DownloadStatus.delete);
downloadingMap.remove(entity.getUrl());
}
@@ -156,7 +153,7 @@ public class DownloadManager implements DownloadStatusListener {
List list = getAll();
for (DownloadEntity downloadEntity : list) {
- statusMap.put(downloadEntity.getUrl(), downloadEntity.getStatus().name());
+ statusMap.put(downloadEntity.getUrl(), downloadEntity.getStatus());
if (!DownloadStatus.done.equals(downloadEntity.getStatus())) {
downloadingMap.put(downloadEntity.getUrl(), downloadEntity);
}
@@ -242,7 +239,7 @@ public class DownloadManager implements DownloadStatusListener {
}
//TODO remove
- DownloadManager.getInstance(context).putStatus(downloadEntity.getUrl(), "downloading");
+ DownloadManager.getInstance(context).putStatus(downloadEntity.getUrl(), DownloadStatus.downloading);
// 收集下载数据
DataCollectionUtils.uploadDownload(context, downloadEntity, "开始");
@@ -264,7 +261,7 @@ public class DownloadManager implements DownloadStatusListener {
mContext.startService(getIntent(downloadEntity, DownloadStatus.add));
}
put(url, System.currentTimeMillis());
- putStatus(url, DownloadStatus.downloading.name());
+ putStatus(url, DownloadStatus.downloading);
}
Utils.log(DownloadManager.class.getSimpleName(), "add");
}
@@ -397,16 +394,16 @@ public class DownloadManager implements DownloadStatusListener {
return gameMap.get(name);
}
- void putStatus(String url, String status) {
+ private void putStatus(String url, DownloadStatus status) {
statusMap.put(url, status);
onTaskStatusChanged(getDownloadEntityByUrl(url));
}
- public String getStatus(String url) {
+ public DownloadStatus getStatus(String url) {
return statusMap.get(url);
}
- public ArrayMap getStatusMap() {
+ public ArrayMap getStatusMap() {
return statusMap;
}
@@ -506,7 +503,7 @@ public class DownloadManager implements DownloadStatusListener {
if (entry != null) {
mContext.startService(getIntent(entry, DownloadStatus.pause));
put(url, System.currentTimeMillis());
- statusMap.put(url, DownloadStatus.pause.name());
+ statusMap.put(url, DownloadStatus.pause);
}
Utils.log(DownloadManager.class.getSimpleName(), "pause");
}
diff --git a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java
index 17f728fa1d..ce988b3d77 100644
--- a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java
@@ -114,15 +114,17 @@ public class GameDetailActivity extends BaseActivity {
View mShareIv;
- private String mGameId;
private GameEntity mGameEntity;
private DownloadEntity mDownloadEntity;
private GameDetailEntity mGameDetailEntity;
+
+ private String mGameId;
private String downloadAddWord;
private String downloadOffText;
private String name; // 页面位置
private String title; // 页面标题
private String shareCode;
+
private boolean mIsTouchScreen = false;
private boolean mIsShowKaifuHint;
private boolean mIsScrollToKaiFu;
diff --git a/app/src/main/java/com/gh/gamecenter/SkipActivity.java b/app/src/main/java/com/gh/gamecenter/SkipActivity.java
index 718dc842c6..a2002428d9 100644
--- a/app/src/main/java/com/gh/gamecenter/SkipActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/SkipActivity.java
@@ -8,7 +8,6 @@ import android.text.TextUtils;
import com.gh.base.BaseActivity;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.PlatformUtils;
-import com.gh.common.util.RunningUtils;
import static com.gh.common.util.EntranceUtils.ENTRANCE_BROWSER;
import static com.gh.common.util.EntranceUtils.HOST_ARTICLE;
@@ -57,85 +56,42 @@ public class SkipActivity extends BaseActivity {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(KEY_ENTRANCE, ENTRANCE_BROWSER);
- if (RunningUtils.isRunning(this)
- && MainActivity.class.getName().equals(RunningUtils.getBaseActivity(this))) {
- // 应用正在运行,前台或后台
+ Bundle bundle = new Bundle();
- if (host != null) {
- switch (host) {
- case HOST_ARTICLE:
- intent.setClass(this, NewsDetailActivity.class);
- intent.putExtra(KEY_NEWSID, id);
- break;
- case HOST_GAME:
- intent.setClass(this, GameDetailActivity.class);
- intent.putExtra(KEY_GAMEID, id);
- break;
- case HOST_COLUMN:
- intent.setClass(this, SubjectActivity.class);
- intent.putExtra(KEY_ID, id);
- intent.putExtra(KEY_NAME, getIntent().getData().getQueryParameter(KEY_NAME));
- break;
- case HOST_SUGGESTION:
- String content = String.format("【%s-%s-V%s】",
- uri.getQueryParameter(KEY_GAME_NAME),
- PlatformUtils.getInstance(this).getPlatformName(uri.getQueryParameter(KEY_PLATFORM)),
- uri.getQueryParameter(KEY_VERSION));
- intent.putExtra(KEY_CONTENT, content);
- intent.putExtra(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN);
- intent.putExtra(EntranceUtils.KEY_SUGGESTTYPE, 4);
- intent.setClass(this, SuggestionActivity.class);
- break;
- case HOST_DOWNLOAD:
- intent.setClass(this, DownloadManagerActivity.class);
- intent.putExtra(KEY_GAMEID, id);
- intent.putExtra(KEY_PACKAGENAME, getIntent().getData().getQueryParameter(KEY_PACKAGENAME));
- break;
- }
- }
+ if (host != null) {
+ switch (host) {
+ case HOST_ARTICLE:
+ bundle.putString(KEY_TO, "NewsDetailActivity");
+ bundle.putString(KEY_NEWSID, id);
+ break;
+ case HOST_GAME:
+ bundle.putString(KEY_TO, "GameDetailActivity");
+ bundle.putString(KEY_GAMEID, id);
+ break;
+ case HOST_COLUMN:
+ bundle.putString(KEY_TO, "SubjectActivity");
+ bundle.putString(KEY_ID, id);
+ bundle.putString(KEY_NAME, getIntent().getData().getQueryParameter(KEY_NAME));
+ break;
+ case HOST_SUGGESTION:
+ String content = String.format("【%s-%s-V%s】",
+ uri.getQueryParameter(KEY_GAME_NAME),
+ PlatformUtils.getInstance(this).getPlatformName(uri.getQueryParameter(KEY_PLATFORM)),
+ uri.getQueryParameter(KEY_VERSION));
+ bundle.putString(KEY_TO, "SuggestionActivity");
+ bundle.putString(KEY_CONTENT, content);
+ bundle.putString(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN);
+ bundle.putInt(EntranceUtils.KEY_SUGGESTTYPE, 4);
+ break;
+ case HOST_DOWNLOAD:
+ bundle.putString(KEY_TO, DownloadManagerActivity.TAG);
+ bundle.putString(KEY_GAMEID, id);
+ bundle.putString(KEY_PACKAGENAME, getIntent().getData().getQueryParameter(KEY_PACKAGENAME));
+ break;
- } else {
- // 应用未在运行
- intent.setClass(this, SplashScreenActivity.class);
- intent.setAction(Intent.ACTION_MAIN);
- intent.addCategory(Intent.CATEGORY_LAUNCHER);
-
- if (host != null) {
-
- switch (host) {
- case HOST_ARTICLE:
- intent.putExtra(KEY_NEWSID, id);
- intent.putExtra(KEY_TO, "NewsDetailActivity");
- break;
- case HOST_GAME:
- intent.putExtra(KEY_NEWSID, id);
- intent.putExtra(KEY_TO, "GameDetailActivity");
- break;
- case HOST_COLUMN:
- intent.putExtra(KEY_TO, "SubjectActivity");
- intent.putExtra(KEY_ID, id);
- intent.putExtra(KEY_NAME, getIntent().getData().getQueryParameter(KEY_NAME));
- break;
- case HOST_SUGGESTION:
- String content = String.format("【%s-%s-V%s】",
- uri.getQueryParameter(KEY_GAME_NAME),
- PlatformUtils.getInstance(this).getPlatformName(uri.getQueryParameter(KEY_PLATFORM)),
- uri.getQueryParameter(KEY_VERSION));
- intent.putExtra(KEY_CONTENT, content);
- intent.putExtra(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN);
- intent.putExtra(EntranceUtils.KEY_SUGGESTTYPE, 4);
- intent.putExtra(KEY_TO, "SuggestionActivity");
- break;
- case HOST_DOWNLOAD:
- intent.putExtra(KEY_TO, DownloadManagerActivity.TAG);
- intent.putExtra(KEY_GAMEID, id);
- intent.putExtra(KEY_PACKAGENAME, getIntent().getData().getQueryParameter(KEY_PACKAGENAME));
- break;
-
- }
}
}
- startActivity(intent);
+ EntranceUtils.jumpActivity(this, bundle);
}
finish();
diff --git a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java
index 5549709f2e..53874dd0da 100644
--- a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.java
@@ -21,7 +21,6 @@ import android.widget.TextView;
import com.gh.base.BaseActivity;
import com.gh.common.util.DialogUtils;
-import com.gh.common.util.EntranceUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.PlatformUtils;
import com.gh.common.util.TagUtils;
@@ -53,10 +52,7 @@ import pub.devrel.easypermissions.EasyPermissions;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
-import static com.gh.common.util.EntranceUtils.ENTRANCE_DOWNLOAD;
import static com.gh.common.util.EntranceUtils.KEY_DATA;
-import static com.gh.common.util.EntranceUtils.KEY_ENTRANCE;
-import static com.gh.common.util.EntranceUtils.KEY_TO;
/**
* 引导页面
@@ -97,30 +93,6 @@ public class SplashScreenActivity extends BaseActivity {
return intent;
}
- // 下载消息栏跳转
- public static Intent getIntentByDownload(Context context, String keyTo) {
- Intent intent = new Intent(context, SplashScreenActivity.class);
- intent.setAction(Intent.ACTION_MAIN);
- intent.addCategory(Intent.CATEGORY_LAUNCHER);
- intent.putExtra(KEY_TO, keyTo);
- intent.putExtra(KEY_ENTRANCE, ENTRANCE_DOWNLOAD);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- return intent;
- }
-
- // 下载完成 安装消息栏跳转
- public static Intent getIntentByInstall(Context context, String path) {
- Intent intent = new Intent(context, SplashScreenActivity.class);
- intent.setAction(Intent.ACTION_MAIN);
- intent.addCategory(Intent.CATEGORY_LAUNCHER);
- intent.putExtra(KEY_TO, DownloadManagerActivity.TAG);
- intent.putExtra(EntranceUtils.KEY_CURRENTITEM, 0);
- intent.putExtra(EntranceUtils.KEY_PATH, path);
- intent.putExtra(EntranceUtils.KEY_ENTRANCE, "(安装跳转)");
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- return intent;
- }
-
@Override
protected void onCreate(Bundle savedInstanceState) {
diff --git a/app/src/main/java/com/gh/gamecenter/fragment/GameFragment.java b/app/src/main/java/com/gh/gamecenter/fragment/GameFragment.java
index 9120a50c85..93f9c6a41b 100644
--- a/app/src/main/java/com/gh/gamecenter/fragment/GameFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/fragment/GameFragment.java
@@ -52,7 +52,7 @@ public class GameFragment extends BaseFragment implements SwipeRefreshLayout.OnR
@Override
public void run() {
if (adapter.isInitPlugin()) {
- view.postDelayed(initPluginRunnable, 100);
+ postDelayedRunnable(initPluginRunnable, 100);
} else {
adapter.initPlugin();
}
@@ -64,7 +64,6 @@ public class GameFragment extends BaseFragment implements SwipeRefreshLayout.OnR
public void run() {
adapter = new GameFragmentAdapter(GameFragment.this, mGameSwipeRefresh);
mGameRv.setAdapter(adapter);
-// adapter.initSlide(true);
}
};
@@ -185,7 +184,7 @@ public class GameFragment extends BaseFragment implements SwipeRefreshLayout.OnR
}
}
} else if ("plugin".equals(status.getStatus())) {
- view.postDelayed(initPluginRunnable, 100);
+ postDelayedRunnable(initPluginRunnable, 100);
}
}
@@ -283,7 +282,7 @@ public class GameFragment extends BaseFragment implements SwipeRefreshLayout.OnR
mGameRv.setVisibility(View.VISIBLE);
mGameLoading.setVisibility(View.GONE);
mReuseNoConn.setVisibility(View.GONE);
- view.postDelayed(runnable, 1000);
+ postDelayedRunnable(runnable, 1000);
} else if (adapter.isNetworkError()) {
adapter.setNetworkError(false);
adapter.notifyItemChanged(adapter.getItemCount() - 1);
@@ -335,7 +334,7 @@ public class GameFragment extends BaseFragment implements SwipeRefreshLayout.OnR
@Override
public void onRefresh() {
- view.postDelayed(runnable, 1000);
+ postDelayedRunnable(runnable, 1000);
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/message/CommentFragment.java b/app/src/main/java/com/gh/gamecenter/message/CommentFragment.java
index 2f0b384c9b..4f36ff2dce 100644
--- a/app/src/main/java/com/gh/gamecenter/message/CommentFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/message/CommentFragment.java
@@ -101,12 +101,6 @@ public class CommentFragment extends BaseFragment implements SwipeRefreshLayout.
}
- @Override
- public void onDestroy() {
- super.onDestroy();
- view.removeCallbacks(null);
- }
-
@Override
public void loadDone() {
super.loadDone();
diff --git a/app/src/main/java/com/gh/gamecenter/receiver/DownloadReceiver.java b/app/src/main/java/com/gh/gamecenter/receiver/DownloadReceiver.java
index c2a61231dc..126667fcfb 100644
--- a/app/src/main/java/com/gh/gamecenter/receiver/DownloadReceiver.java
+++ b/app/src/main/java/com/gh/gamecenter/receiver/DownloadReceiver.java
@@ -3,6 +3,7 @@ package com.gh.gamecenter.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import com.gh.common.util.RunningUtils;
@@ -14,6 +15,8 @@ import com.gh.gamecenter.eventbus.EBSkip;
import org.greenrobot.eventbus.EventBus;
import static com.gh.common.util.EntranceUtils.ENTRANCE_DOWNLOAD;
+import static com.gh.common.util.EntranceUtils.KEY_ENTRANCE;
+import static com.gh.common.util.EntranceUtils.KEY_TO;
/**
* Created by LGT on 2016/10/10.
@@ -46,7 +49,10 @@ public class DownloadReceiver extends BroadcastReceiver {
} else {
// 助手未在运行
- context.startActivity(SplashScreenActivity.getIntentByDownload(context, DownloadManagerActivity.TAG));
+ Bundle bundle = new Bundle();
+ bundle.putString(KEY_TO, DownloadManagerActivity.TAG);
+ intent.putExtra(KEY_ENTRANCE, ENTRANCE_DOWNLOAD);
+ context.startActivity(SplashScreenActivity.getSplashScreenIntent(context, bundle));
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/receiver/InstallReceiver.java b/app/src/main/java/com/gh/gamecenter/receiver/InstallReceiver.java
index bf710f1a00..2feb8d409f 100644
--- a/app/src/main/java/com/gh/gamecenter/receiver/InstallReceiver.java
+++ b/app/src/main/java/com/gh/gamecenter/receiver/InstallReceiver.java
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.os.Bundle;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.PackageUtils;
@@ -14,6 +15,8 @@ import com.gh.gamecenter.eventbus.EBMiPush;
import org.greenrobot.eventbus.EventBus;
+import static com.gh.common.util.EntranceUtils.KEY_TO;
+
/**
* Created by LGT on 2016/10/10.
@@ -50,7 +53,13 @@ public class InstallReceiver extends BroadcastReceiver {
}
} else {
// 应用未在运行
- context.startActivity(SplashScreenActivity.getIntentByInstall(context, path));
+
+ Bundle bundle = new Bundle();
+ bundle.putString(KEY_TO, DownloadManagerActivity.TAG);
+ bundle.putInt(EntranceUtils.KEY_CURRENTITEM, 0);
+ bundle.putString(EntranceUtils.KEY_PATH, path);
+ bundle.putString(EntranceUtils.KEY_ENTRANCE, "(安装跳转)");
+ context.startActivity(SplashScreenActivity.getSplashScreenIntent(context, bundle));
}
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/receiver/NotificationReceiver.java b/app/src/main/java/com/gh/gamecenter/receiver/NotificationReceiver.java
deleted file mode 100644
index 922f5486e5..0000000000
--- a/app/src/main/java/com/gh/gamecenter/receiver/NotificationReceiver.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package com.gh.gamecenter.receiver;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
-import android.support.v4.util.ArrayMap;
-
-import com.gh.common.util.EntranceUtils;
-import com.gh.common.util.PackageUtils;
-import com.gh.common.util.RunningUtils;
-import com.gh.gamecenter.DownloadManagerActivity;
-import com.gh.gamecenter.GameDetailActivity;
-import com.gh.gamecenter.NewsDetailActivity;
-import com.gh.gamecenter.SplashScreenActivity;
-import com.gh.gamecenter.entity.GameEntity;
-import com.gh.gamecenter.eventbus.EBMiPush;
-import com.google.gson.Gson;
-
-import org.greenrobot.eventbus.EventBus;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static com.gh.common.util.EntranceUtils.KEY_TO;
-
-
-/**
- * 用于接收点击小米推送的notification的广播
- *
- * @author LGT
- */
-public class NotificationReceiver extends BroadcastReceiver {
-
- @Override
- public void onReceive(Context context, Intent intent) {
- try {
- JSONObject jsonObject = new JSONObject(intent.getStringExtra("notifyData"));
- int id = intent.getIntExtra("notifyId", 0);
- switch (id) {
- case 0:
- if (RunningUtils.isRunning(context)) {
- // 应用正在运行,前台或后台
- Intent intent1 = new Intent(context, NewsDetailActivity.class);
- intent1.putExtra(EntranceUtils.KEY_NEWSID, jsonObject.get("_id").toString());
- intent1.putExtra(EntranceUtils.KEY_ENTRANCE, EntranceUtils.ENTRANCE_MIPUSH);
- intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intent1);
- } else {
- // 应用未在运行
- Intent intent1 = new Intent(context, SplashScreenActivity.class);
- intent1.setAction(Intent.ACTION_MAIN);
- intent1.addCategory(Intent.CATEGORY_LAUNCHER);
- intent1.putExtra(KEY_TO, "NewsDetailActivity");
- intent1.putExtra(EntranceUtils.KEY_NEWSID, jsonObject.get("_id").toString());
- intent1.putExtra(EntranceUtils.KEY_ENTRANCE, EntranceUtils.ENTRANCE_MIPUSH);
- intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intent1);
- }
- break;
- case 1:
- if (RunningUtils.isRunning(context)) {
- // 应用正在运行,前台或后台
- JSONArray jsonArray = jsonObject.getJSONArray("apk");
- ArrayMap map = getInstalledMapFromLocal(context);
- ArrayList list = new ArrayList<>();
- for (int i = 0; i < jsonArray.length(); i++) {
- JSONObject apk = jsonArray.getJSONObject(i);
- String packageName = apk.getString("package");
- Boolean b = map.get(packageName);
- if (b != null) {
- // 判断是否gh_version是否相同
- String gh_version = (String) PackageUtils
- .getMetaData(context, packageName, "gh_version");
- if (gh_version != null) {
- gh_version = gh_version.substring(2);
- // 判断gh_version是否相同
- if (gh_version.equals(apk
- .getString("gh_version"))) {
- // 判断version是否相同
- String version = PackageUtils
- .getVersionByPackage(context,
- packageName);
- if (version != null && version.equals(apk.getString("version"))) {
- // 版本相同,无需显示插件更新,继续查看是否有可更新的游戏包
- continue;
- }
- }
- }
- list.add(packageName);
- }
- }
- if (RunningUtils.isEqualsTop(context, DownloadManagerActivity.class.getName())) {
- // 当前topActivity为DownloadManagerActivity
- EventBus.getDefault().post(new EBMiPush("mipush_plugin", list));
- } else {
- Intent intent2 = new Intent(context, DownloadManagerActivity.class);
- intent2.putExtra(EntranceUtils.KEY_CURRENTITEM, 1);
- intent2.putExtra("isPushIntent", true);
- intent2.putExtra(EntranceUtils.KEY_ENTRANCE, "(小米推送)");
- intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intent2);
- }
- } else {
- // 应用未在运行
- Intent intent2 = new Intent(context, SplashScreenActivity.class);
- intent2.setAction(Intent.ACTION_MAIN);
- intent2.addCategory(Intent.CATEGORY_LAUNCHER);
- intent2.putExtra(KEY_TO, DownloadManagerActivity.TAG);
- intent2.putExtra(EntranceUtils.KEY_CURRENTITEM, 1);
- intent2.putExtra("isPushIntent", true);
- intent2.putExtra(EntranceUtils.KEY_ENTRANCE, "(小米推送)");
- intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intent2);
- }
- break;
- case 2:
- String tag = jsonObject.getString("tag");
- String[] tags = tag.split(",");
-// JSONArray array = new JSONArray();
-// for (int i = 0; i < tags.length; i++) {
-// array.put(tags[i]);
-// }
- JSONArray array = new JSONArray(Arrays.asList(tags));
- jsonObject.put("tag", array);
- if (RunningUtils.isRunning(context)) {
- // 应用正在运行,前台或后台
- Gson gson = new Gson();
- GameEntity gameEntity = gson.fromJson(jsonObject.toString(), GameEntity.class);
- GameDetailActivity.startGameDetailActivity(context, gameEntity, "(小米推送)");
- } else {
- // 应用未在运行
- Intent intent3 = new Intent(context, SplashScreenActivity.class);
- intent3.setAction(Intent.ACTION_MAIN);
- intent3.addCategory(Intent.CATEGORY_LAUNCHER);
- intent3.putExtra(KEY_TO, "GameDetailActivity");
- intent3.putExtra(EntranceUtils.KEY_ENTRANCE, "(小米推送)");
- Gson gson = new Gson();
- GameEntity gameEntity = gson.fromJson(jsonObject.toString(), GameEntity.class);
- intent.putExtra("GameEntity", gameEntity);
- intent3.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intent3);
- }
- break;
- default:
- break;
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- private ArrayMap getInstalledMapFromLocal(Context context) {
- ArrayMap map = new ArrayMap<>();
- ArrayList list = getAllPackageName(context);
- for (String str : list) {
- map.put(str, true);
- }
- return map;
- }
-
- private ArrayList getAllPackageName(Context context) {
- ArrayList list = new ArrayList<>();
- List packageInfos = context.getPackageManager().getInstalledPackages(0);
- for (PackageInfo packageInfo : packageInfos) {
- if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
- list.add(packageInfo.packageName);
- }
- }
- return list;
- }
-}
diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchGameDetailFragment.java b/app/src/main/java/com/gh/gamecenter/search/SearchGameDetailFragment.java
index 3bdaf9497d..11f2f847ed 100644
--- a/app/src/main/java/com/gh/gamecenter/search/SearchGameDetailFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/search/SearchGameDetailFragment.java
@@ -38,13 +38,15 @@ import butterknife.OnClick;
public class SearchGameDetailFragment extends BaseFragment implements OnRequestCallBackListener {
@BindView(R.id.search_detail)
- RecyclerView search_detail;
+ RecyclerView mSearchDetailRv;
@BindView(R.id.search_gamedetail_ll_loading)
- LinearLayout search_loading;
+ LinearLayout mSearchLoading;
@BindView(R.id.reuse_none_data)
- LinearLayout reuse_none_date;
+ LinearLayout mSearchNoData;
@BindView(R.id.reuse_no_connection)
- LinearLayout reuse_no_connection;
+ LinearLayout mSearchNoConn;
+ @BindView(R.id.reuse_tv_none_data)
+ TextView mSearchNoDataTv;
private String key;
private String type;
@@ -55,7 +57,7 @@ public class SearchGameDetailFragment extends BaseFragment implements OnRequestC
@Override
public void run() {
adapter = new SearchGameDetailFragmentAdapter(SearchGameDetailFragment.this, key, type, mEntrance);
- search_detail.setAdapter(adapter);
+ mSearchDetailRv.setAdapter(adapter);
}
};
@@ -85,7 +87,6 @@ public class SearchGameDetailFragment extends BaseFragment implements OnRequestC
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- final LinearLayout reuse_none_data = (LinearLayout) view.findViewById(R.id.reuse_none_data);
TextView skip_tv = new TextView(getContext());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DisplayUtils.dip2px(getContext(), 140)
, DisplayUtils.dip2px(getContext(), 40));
@@ -95,7 +96,7 @@ public class SearchGameDetailFragment extends BaseFragment implements OnRequestC
skip_tv.setText(R.string.search_empty_skip_hint);
skip_tv.setTextColor(Color.WHITE);
skip_tv.setBackgroundResource(R.drawable.textview_blue_style);
- reuse_none_data.addView(skip_tv);
+ mSearchNoData.addView(skip_tv);
skip_tv.setOnClickListener(new View.OnClickListener() {
@Override
@@ -104,16 +105,14 @@ public class SearchGameDetailFragment extends BaseFragment implements OnRequestC
}
});
+ mSearchNoDataTv.setText(R.string.search_empty_hint);
- TextView reuse_tv_none_data = (TextView) view.findViewById(R.id.reuse_tv_none_data);
- reuse_tv_none_data.setText(R.string.search_empty_hint);
-
- search_detail.setHasFixedSize(true);
- search_detail.addItemDecoration(new VerticalItemDecoration(getContext(), 8, true));
- search_detail.setLayoutManager(new LinearLayoutManager(getActivity()));
- ((DefaultItemAnimator) search_detail.getItemAnimator()).setSupportsChangeAnimations(false);
+ mSearchDetailRv.setHasFixedSize(true);
+ mSearchDetailRv.addItemDecoration(new VerticalItemDecoration(getContext(), 8, true));
+ mSearchDetailRv.setLayoutManager(new LinearLayoutManager(getActivity()));
+ ((DefaultItemAnimator) mSearchDetailRv.getItemAnimator()).setSupportsChangeAnimations(false);
adapter = new SearchGameDetailFragmentAdapter(SearchGameDetailFragment.this, key, type, mEntrance);
- search_detail.setAdapter(adapter);
+ mSearchDetailRv.setAdapter(adapter);
final View decorView = getActivity().getWindow().getDecorView();
decorView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@@ -126,11 +125,11 @@ public class SearchGameDetailFragment extends BaseFragment implements OnRequestC
if (heightDifference > 0) {
FragmentActivity activity = getActivity();
if (activity != null) {
- reuse_none_data.setGravity(Gravity.CENTER_HORIZONTAL);
- reuse_none_data.setPadding(0, DisplayUtils.dip2px(activity, 10), 0, 0);
+ mSearchNoData.setGravity(Gravity.CENTER_HORIZONTAL);
+ mSearchNoData.setPadding(0, DisplayUtils.dip2px(activity, 10), 0, 0);
}
} else {
- reuse_none_data.setGravity(Gravity.CENTER);
+ mSearchNoData.setGravity(Gravity.CENTER);
}
}
});
@@ -138,10 +137,10 @@ public class SearchGameDetailFragment extends BaseFragment implements OnRequestC
@OnClick(R.id.reuse_no_connection)
public void onClick(View view) {
- search_loading.setVisibility(View.VISIBLE);
- search_detail.setVisibility(View.GONE);
- reuse_none_date.setVisibility(View.GONE);
- reuse_no_connection.setVisibility(View.GONE);
+ mSearchLoading.setVisibility(View.VISIBLE);
+ mSearchDetailRv.setVisibility(View.GONE);
+ mSearchNoData.setVisibility(View.GONE);
+ mSearchNoConn.setVisibility(View.GONE);
postDelayedRunnable(runnable, 1000);
}
@@ -162,10 +161,10 @@ public class SearchGameDetailFragment extends BaseFragment implements OnRequestC
@Override
public void loadDone() {
- search_loading.setVisibility(View.GONE);
- search_detail.setVisibility(View.VISIBLE);
- reuse_none_date.setVisibility(View.GONE);
- reuse_no_connection.setVisibility(View.GONE);
+ mSearchLoading.setVisibility(View.GONE);
+ mSearchDetailRv.setVisibility(View.VISIBLE);
+ mSearchNoData.setVisibility(View.GONE);
+ mSearchNoConn.setVisibility(View.GONE);
}
@Override
@@ -175,18 +174,18 @@ public class SearchGameDetailFragment extends BaseFragment implements OnRequestC
@Override
public void loadError() {
- search_loading.setVisibility(View.GONE);
- search_detail.setVisibility(View.GONE);
- reuse_none_date.setVisibility(View.GONE);
- reuse_no_connection.setVisibility(View.VISIBLE);
+ mSearchLoading.setVisibility(View.GONE);
+ mSearchDetailRv.setVisibility(View.GONE);
+ mSearchNoData.setVisibility(View.GONE);
+ mSearchNoConn.setVisibility(View.VISIBLE);
}
@Override
public void loadEmpty() {
- search_loading.setVisibility(View.GONE);
- search_detail.setVisibility(View.GONE);
- reuse_none_date.setVisibility(View.VISIBLE);
- reuse_no_connection.setVisibility(View.GONE);
+ mSearchLoading.setVisibility(View.GONE);
+ mSearchDetailRv.setVisibility(View.GONE);
+ mSearchNoData.setVisibility(View.VISIBLE);
+ mSearchNoConn.setVisibility(View.GONE);
}
public void setParams(String key, String type) {
diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchGameListFragment.java b/app/src/main/java/com/gh/gamecenter/search/SearchGameListFragment.java
index 483a10b823..9d2c3e4499 100644
--- a/app/src/main/java/com/gh/gamecenter/search/SearchGameListFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/search/SearchGameListFragment.java
@@ -38,13 +38,15 @@ import butterknife.OnClick;
public class SearchGameListFragment extends BaseFragment implements OnRequestCallBackListener {
@BindView(R.id.search_detail)
- RecyclerView search_detail;
+ RecyclerView mSearchRv;
@BindView(R.id.search_gamedetail_ll_loading)
- LinearLayout search_loading;
+ LinearLayout mSearchLoading;
@BindView(R.id.reuse_none_data)
- LinearLayout reuse_none_date;
+ LinearLayout mSearchNoData;
@BindView(R.id.reuse_no_connection)
- LinearLayout reuse_no_connection;
+ LinearLayout mSearchNoConn;
+ @BindView(R.id.reuse_tv_none_data)
+ TextView mSearchNoDataTv;
private String key;
private String type;
@@ -55,7 +57,7 @@ public class SearchGameListFragment extends BaseFragment implements OnRequestCal
@Override
public void run() {
adapter = new SearchGameListFragmentAdapter(SearchGameListFragment.this, key, type, mEntrance);
- search_detail.setAdapter(adapter);
+ mSearchRv.setAdapter(adapter);
}
};
@@ -82,7 +84,6 @@ public class SearchGameListFragment extends BaseFragment implements OnRequestCal
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- final LinearLayout reuse_none_data = (LinearLayout) view.findViewById(R.id.reuse_none_data);
TextView skip_tv = new TextView(getContext());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DisplayUtils.dip2px(getContext(), 140)
, DisplayUtils.dip2px(getContext(), 40));
@@ -92,7 +93,7 @@ public class SearchGameListFragment extends BaseFragment implements OnRequestCal
skip_tv.setText("告诉小编");
skip_tv.setTextColor(Color.WHITE);
skip_tv.setBackgroundResource(R.drawable.textview_blue_style);
- reuse_none_data.addView(skip_tv);
+ mSearchNoData.addView(skip_tv);
skip_tv.setOnClickListener(new View.OnClickListener() {
@Override
@@ -101,16 +102,14 @@ public class SearchGameListFragment extends BaseFragment implements OnRequestCal
}
});
+ mSearchNoDataTv.setText("搜索为空");
- TextView reuse_tv_none_data = (TextView) view.findViewById(R.id.reuse_tv_none_data);
- reuse_tv_none_data.setText("搜索为空");
-
- search_detail.setHasFixedSize(true);
- search_detail.addItemDecoration(new VerticalItemDecoration(getContext(), 1, true));
- search_detail.setLayoutManager(new LinearLayoutManager(getActivity()));
- ((DefaultItemAnimator) search_detail.getItemAnimator()).setSupportsChangeAnimations(false);
+ mSearchRv.setHasFixedSize(true);
+ mSearchRv.addItemDecoration(new VerticalItemDecoration(getContext(), 1, true));
+ mSearchRv.setLayoutManager(new LinearLayoutManager(getActivity()));
+ ((DefaultItemAnimator) mSearchRv.getItemAnimator()).setSupportsChangeAnimations(false);
adapter = new SearchGameListFragmentAdapter(SearchGameListFragment.this, key, type, mEntrance);
- search_detail.setAdapter(adapter);
+ mSearchRv.setAdapter(adapter);
final View decorView = getActivity().getWindow().getDecorView();
decorView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@@ -123,11 +122,11 @@ public class SearchGameListFragment extends BaseFragment implements OnRequestCal
if (heightDifference > 0) {
FragmentActivity activity = getActivity();
if (activity != null) {
- reuse_none_data.setGravity(Gravity.CENTER_HORIZONTAL);
- reuse_none_data.setPadding(0, DisplayUtils.dip2px(activity, 10), 0, 0);
+ mSearchNoData.setGravity(Gravity.CENTER_HORIZONTAL);
+ mSearchNoData.setPadding(0, DisplayUtils.dip2px(activity, 10), 0, 0);
}
} else {
- reuse_none_data.setGravity(Gravity.CENTER);
+ mSearchNoData.setGravity(Gravity.CENTER);
}
}
});
@@ -135,10 +134,10 @@ public class SearchGameListFragment extends BaseFragment implements OnRequestCal
@OnClick(R.id.reuse_no_connection)
public void onClick(View view) {
- search_loading.setVisibility(View.VISIBLE);
- search_detail.setVisibility(View.GONE);
- reuse_none_date.setVisibility(View.GONE);
- reuse_no_connection.setVisibility(View.GONE);
+ mSearchLoading.setVisibility(View.VISIBLE);
+ mSearchRv.setVisibility(View.GONE);
+ mSearchNoData.setVisibility(View.GONE);
+ mSearchNoConn.setVisibility(View.GONE);
postDelayedRunnable(runnable, 1000);
}
@@ -160,10 +159,10 @@ public class SearchGameListFragment extends BaseFragment implements OnRequestCal
@Override
public void loadDone() {
- search_loading.setVisibility(View.GONE);
- search_detail.setVisibility(View.VISIBLE);
- reuse_none_date.setVisibility(View.GONE);
- reuse_no_connection.setVisibility(View.GONE);
+ mSearchLoading.setVisibility(View.GONE);
+ mSearchRv.setVisibility(View.VISIBLE);
+ mSearchNoData.setVisibility(View.GONE);
+ mSearchNoConn.setVisibility(View.GONE);
}
@Override
@@ -173,18 +172,18 @@ public class SearchGameListFragment extends BaseFragment implements OnRequestCal
@Override
public void loadError() {
- search_loading.setVisibility(View.GONE);
- search_detail.setVisibility(View.GONE);
- reuse_none_date.setVisibility(View.GONE);
- reuse_no_connection.setVisibility(View.VISIBLE);
+ mSearchLoading.setVisibility(View.GONE);
+ mSearchRv.setVisibility(View.GONE);
+ mSearchNoData.setVisibility(View.GONE);
+ mSearchNoConn.setVisibility(View.VISIBLE);
}
@Override
public void loadEmpty() {
- search_loading.setVisibility(View.GONE);
- search_detail.setVisibility(View.GONE);
- reuse_none_date.setVisibility(View.VISIBLE);
- reuse_no_connection.setVisibility(View.GONE);
+ mSearchLoading.setVisibility(View.GONE);
+ mSearchRv.setVisibility(View.GONE);
+ mSearchNoData.setVisibility(View.VISIBLE);
+ mSearchNoConn.setVisibility(View.GONE);
}
public void setParams(String key, String type) {
diff --git a/app/src/main/res/layout/activity_normal.xml b/app/src/main/res/layout/activity_normal.xml
index 0f11ed8b40..9e0450c054 100644
--- a/app/src/main/res/layout/activity_normal.xml
+++ b/app/src/main/res/layout/activity_normal.xml
@@ -4,7 +4,6 @@
android:layout_height = "match_parent"
android:orientation = "vertical" >
-
diff --git a/app/src/main/res/layout/activity_plugin.xml b/app/src/main/res/layout/activity_plugin.xml
index 789e7a5d34..3dfb0d7377 100644
--- a/app/src/main/res/layout/activity_plugin.xml
+++ b/app/src/main/res/layout/activity_plugin.xml
@@ -13,7 +13,7 @@
+ android:layout_height = "match_parent" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fm_concern.xml b/app/src/main/res/layout/fm_concern.xml
index 3e9be09211..d04bcd457c 100644
--- a/app/src/main/res/layout/fm_concern.xml
+++ b/app/src/main/res/layout/fm_concern.xml
@@ -6,7 +6,7 @@
+ android:layout_height = "match_parent" />
diff --git a/app/src/main/res/layout/fm_search.xml b/app/src/main/res/layout/fm_search.xml
index 3e75cb8d22..fe0a86847b 100644
--- a/app/src/main/res/layout/fm_search.xml
+++ b/app/src/main/res/layout/fm_search.xml
@@ -10,7 +10,7 @@
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:overScrollMode = "never"
- android:visibility = "gone" >
+ android:visibility = "gone" />
-
-
-
-
-
-
-
-
-
+ android:layout_height = "wrap_content" />
+ android:paddingTop = "5dp" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/gamedetail_item_intro.xml b/app/src/main/res/layout/gamedetail_item_intro.xml
index f0636355ba..2bf58892d7 100644
--- a/app/src/main/res/layout/gamedetail_item_intro.xml
+++ b/app/src/main/res/layout/gamedetail_item_intro.xml
@@ -27,7 +27,7 @@
+ android:layout_height = "225dp" />
+ android:layout_height = "70dp" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/notification_meizu.xml b/app/src/main/res/layout/notification_meizu.xml
deleted file mode 100644
index 2d152a30f0..0000000000
--- a/app/src/main/res/layout/notification_meizu.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/notification_xiaomi.xml b/app/src/main/res/layout/notification_xiaomi.xml
deleted file mode 100644
index 638f558d93..0000000000
--- a/app/src/main/res/layout/notification_xiaomi.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libraries/LGLibrary b/libraries/LGLibrary
index 236d5837f7..b8d8ff44fd 160000
--- a/libraries/LGLibrary
+++ b/libraries/LGLibrary
@@ -1 +1 @@
-Subproject commit 236d5837f7e2641f4d72e7d4b1deaddd215b60e1
+Subproject commit b8d8ff44fdb5cdc08baba25f489a1aafe7a54554