1、更改部分下载类,未完成

2、@#&@*#
This commit is contained in:
CsHeng
2017-06-29 11:17:01 +08:00
parent 5cbf06f6a6
commit f97ccd5c5d
126 changed files with 454 additions and 6379 deletions

View File

@ -6,16 +6,17 @@ import android.content.SharedPreferences.Editor;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.text.TextUtils;
import com.gh.common.constant.Config;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.retrofit.StringResponse;
import com.lightgame.utils.Util_System_Phone_State;
import com.lightgame.utils.Utils;
import com.tencent.stat.StatConfig;
import org.json.JSONException;
@ -59,14 +60,14 @@ public class TokenUtils {
if (!TextUtils.isEmpty(mac) || !":::::".equals(mac)) {
params.put("MAC", mac);
} else {
SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
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 = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
sp.edit().putBoolean("isUploadMid", false).apply();
}
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new JSONObject(params).toString());
@ -99,7 +100,7 @@ public class TokenUtils {
//将uuid存到sp
private static void saveSharedPreferences(Context context, String device_id) {
SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor edit = sp.edit();
edit.putString("uuid", device_id);
edit.apply();
@ -155,7 +156,7 @@ public class TokenUtils {
public static synchronized Observable<String> getToken(final Context context, boolean isCheck) {
String token = null;
if (isCheck) {
SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
token = sp.getString("token", null);
if (token != null) {
long expire = sp.getLong("token_expire", 0) * 1000 - 10 * 1000;
@ -177,7 +178,7 @@ public class TokenUtils {
public Observable<String> call(ResponseBody responseBody) {
String value = null;
try {
SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
Editor editor = sp.edit();
JSONObject response = new JSONObject(responseBody.string());
editor.putString("user_name", response.getString("name"));
@ -210,7 +211,7 @@ public class TokenUtils {
// 获取服务器时间
public static synchronized void getTime(Context context) {
final SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
RetrofitManager.getApi().getTime()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@ -233,7 +234,7 @@ public class TokenUtils {
//读取SharedPreferences的uuid
private static String loadSharedPreferences(Context context, boolean isCheck) {
SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
String uuid = sp.getString("uuid", null);
if (isCheck) {
return uuid;
@ -305,7 +306,7 @@ public class TokenUtils {
// 检查设备信息是否已经上传完整
public static synchronized void checkDeviceInfo(Context context, String token) {
final SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
final HashMap<String, String> params = new HashMap<>();
if (!sp.getBoolean("isUploadExtra", false)) {
params.put("MANUFACTURER", Build.MANUFACTURER);