3.0Bug修复/UI优化/礼包优化
暂时未解决:礼包页面切换时,礼包搜索条自动顶上去/LibaoEntity getId和getLibaoId混乱
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@ -696,9 +697,9 @@ public class MainActivity extends BaseActivity {
|
||||
// 执行跳转事件
|
||||
handler.postDelayed(skipRun, 500);
|
||||
|
||||
if (sp.getBoolean("changeDefaultIcon", false) && sp.getInt("default_user_icon", 0) != 0) {
|
||||
postDefaultIcon(sp.getInt("default_user_icon", 0));
|
||||
}
|
||||
// if (sp.getBoolean("changeDefaultIcon", false) && sp.getInt("default_user_icon", 0) != 0) {
|
||||
// postDefaultIcon(sp.getInt("default_user_icon", 0));
|
||||
// }
|
||||
|
||||
getSuggestionType();
|
||||
|
||||
@ -719,9 +720,9 @@ public class MainActivity extends BaseActivity {
|
||||
super.onDestroy();
|
||||
DownloadManager.getInstance(this).removeObserver(dataWatcher);
|
||||
|
||||
if (sp.getBoolean("changeDefaultIcon", false) && sp.getInt("default_user_icon", 0) != 0) {
|
||||
postDefaultIcon(sp.getInt("default_user_icon", 0));
|
||||
}
|
||||
// if (sp.getBoolean("changeDefaultIcon", false) && sp.getInt("default_user_icon", 0) != 0) {
|
||||
// postDefaultIcon(sp.getInt("default_user_icon", 0));
|
||||
// }
|
||||
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
@ -798,82 +799,6 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
}
|
||||
|
||||
// // 更新用户使用的助手信息
|
||||
// private void updateUserGhzs() {
|
||||
// String version_code = sp.getString("version_code", null);
|
||||
// String version_name = sp.getString("version_name", null);
|
||||
// String channel = sp.getString("channel", null);
|
||||
//
|
||||
// final String versionCode = PackageUtils.getVersionCode(MainActivity.this);
|
||||
// final String versionName = PackageUtils.getVersionName(MainActivity.this);
|
||||
// final String packageChannel = AppController.getInstance().getChannel();
|
||||
// if ((TextUtils.isEmpty(version_code) || TextUtils.isEmpty(version_name) || TextUtils.isEmpty(channel))
|
||||
// || (!version_code.equals(versionCode) || !version_name.equals(versionName) || !channel.equals(packageChannel))) {
|
||||
// TokenUtils.getToken(MainActivity.this, true)
|
||||
// .flatMap(new Func1<String, Observable<ResponseBody>>() {
|
||||
// @Override
|
||||
// public Observable<ResponseBody> call(String token) {
|
||||
// Map<String, String> params = new ArrayMap<>();
|
||||
// params.put("version_code", versionCode);
|
||||
// params.put("version_name", versionName);
|
||||
// params.put("channel", packageChannel);
|
||||
// RequestBody body = RequestBody.create(MediaType.parse("application/json"),
|
||||
// new JSONObject(params).toString());
|
||||
// return RetrofitManager.getApi().postGhzs(token, body);
|
||||
// }
|
||||
// }).subscribeOn(Schedulers.io())
|
||||
// .observeOn(Schedulers.io())
|
||||
// .subscribe(new Response<ResponseBody>() {
|
||||
// @Override
|
||||
// public void onResponse(ResponseBody response) {
|
||||
// SharedPreferences.Editor editor = sp.edit();
|
||||
// editor.putString("version_code", versionCode);
|
||||
// editor.putString("version_name", versionName);
|
||||
// editor.putString("channel", packageChannel);
|
||||
// editor.apply();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// 初始化关注
|
||||
private void initConcern() {
|
||||
String versionName = PackageUtils.getVersionName(MainActivity.this);
|
||||
if ("2.3".equals(versionName) && !sp.getBoolean("isSwitchConcern", false)) {
|
||||
// 针对助手2.3版本关注数据的迁移
|
||||
RetrofitManager.getApi().getConcernData(TokenUtils.getDeviceId(MainActivity.this))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<String>>() {
|
||||
@Override
|
||||
public void onResponse(final List<String> response) {
|
||||
if (response.size() != 0) {
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
|
||||
new JSONArray(response).toString());
|
||||
RetrofitManager.getApi()
|
||||
.putConcern(LoginUtils.getToken(MainActivity.this), body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(new Response<ResponseBody>());
|
||||
}
|
||||
sp.edit().putBoolean("isSwitchConcern", true).apply();
|
||||
getConcernDigest(response);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
RetrofitManager.getApi()
|
||||
.getConcern(LoginUtils.getToken(this))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(new Response<List<String>>() {
|
||||
@Override
|
||||
public void onResponse(List<String> response) {
|
||||
getConcernDigest(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void getConcernDigest(final List<String> arrGameId) {
|
||||
final ArrayList<GameEntity> concernDigest = new ArrayList<>();
|
||||
|
||||
@ -963,6 +888,11 @@ public class MainActivity extends BaseActivity {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(EBPackage busFour) {
|
||||
final String packageName = busFour.getPackageName();
|
||||
if("安装".equals(busFour.getType())) { // 删除下载完成 弹窗
|
||||
NotificationManager nManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nManager.cancel(packageName.hashCode());
|
||||
}
|
||||
|
||||
if ("安装".equals(busFour.getType())) {
|
||||
// 添加进已安装map中
|
||||
PackageManager.addInstalled(packageName);
|
||||
@ -1089,7 +1019,7 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
// 提交默认头像
|
||||
private void postDefaultIcon(final int i) {
|
||||
private void postDefaultIcon(final int i) { // TODO 是否删除
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("icon_key", "icon" + i);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
|
||||
|
||||
Reference in New Issue
Block a user