安装完游戏自动关注游戏
This commit is contained in:
@ -58,6 +58,7 @@ import com.gh.gamecenter.db.info.GameInfo;
|
||||
import com.gh.gamecenter.db.info.SuspectedGameInfo;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.AppEntity;
|
||||
import com.gh.gamecenter.entity.GameDigestEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus;
|
||||
@ -262,7 +263,7 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
} else {
|
||||
toast(downloadEntity.getName() + " - 下载完成");
|
||||
}
|
||||
if (downloadEntity.isPluggable()) {
|
||||
if (!downloadEntity.isPluggable()) {
|
||||
if (sp.getBoolean("autoinstall", true)) {
|
||||
if (FileUtils.isEmptyFile(downloadEntity.getPath())) {
|
||||
toast("解析包错误");
|
||||
@ -408,15 +409,15 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
|
||||
sp = getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
|
||||
|
||||
if (!sp.getBoolean("isNewsFirstLaunch", true)
|
||||
if (!sp.getBoolean("isNewFirstLaunch", true)
|
||||
&& sp.getBoolean("autoupdate", true)) {
|
||||
checkUpdate();
|
||||
}
|
||||
|
||||
if (sp.getBoolean("isNewsFirstLaunch", true)) {
|
||||
if (sp.getBoolean("isNewFirstLaunch", true)) {
|
||||
getPluginUpdate();
|
||||
getDisclaimer(true);
|
||||
sp.edit().putBoolean("isNewsFirstLaunch", false).apply();
|
||||
sp.edit().putBoolean("isNewFirstLaunch", false).apply();
|
||||
} else {
|
||||
getDisclaimer(false);
|
||||
handler.postDelayed(runnable, 500);
|
||||
@ -1350,12 +1351,45 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
if ("安装".equals(busFour.getType())) {
|
||||
// 安装后关注游戏
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
|
||||
Config.HOST + "v1d45/support/package/" + packageName + "/game/digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
Gson gson = new Gson();
|
||||
GameDigestEntity gameDigestEntity = gson.fromJson(
|
||||
response.toString(), GameDigestEntity.class);
|
||||
concernGame(gameDigestEntity.getId());
|
||||
}
|
||||
}, null);
|
||||
AppController.addToRequestQueue(request, MainActivity.class);
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("type", busFour.getType());
|
||||
map.put("packageName", busFour.getPackageName());
|
||||
DataCollectionManager.onEvent(this, "inorunstall", map);
|
||||
}
|
||||
|
||||
private void concernGame(String id) {
|
||||
final ConcernManager concernManager = new ConcernManager(getApplicationContext());
|
||||
if (!concernManager.isConcern(id)) {
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
|
||||
Config.HOST + "v2d0/game/" + id + "/digest",
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
Gson gson = new Gson();
|
||||
GameEntity gameEntity = gson.fromJson(response.toString(), GameEntity.class);
|
||||
concernManager.addByEntity(gameEntity);
|
||||
}
|
||||
}, null);
|
||||
AppController.addToRequestQueue(request, MainActivity.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
// 上传数据
|
||||
|
||||
Reference in New Issue
Block a user