插件化安装按钮显示背景修改,下载添加是否是插件字段
This commit is contained in:
@ -53,13 +53,10 @@ import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.TokenUtils;
|
||||
import com.gh.common.util.TrafficUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.download.DataChanger;
|
||||
import com.gh.download.DataWatcher;
|
||||
import com.gh.download.DownloadDao;
|
||||
import com.gh.download.DownloadEntity;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.DownloadStatus;
|
||||
import com.gh.download.DownloadTask;
|
||||
import com.gh.gamecenter.db.info.ConcernInfo;
|
||||
import com.gh.gamecenter.db.info.GameInfo;
|
||||
import com.gh.gamecenter.db.info.SuspectedGameInfo;
|
||||
@ -147,8 +144,6 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
private TextView app_btn_cancel;
|
||||
private AppEntity appEntity;
|
||||
|
||||
public static MainActivity mainActivity = null;
|
||||
|
||||
// 黄壮华 添加观察者 修改2015/8/15
|
||||
private DataWatcher dataWatcher = new DataWatcher() {
|
||||
@Override
|
||||
@ -270,18 +265,14 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
if (!downloadEntity.isPluggable()) {
|
||||
if (sp.getBoolean("autoinstall", true)) {
|
||||
if (FileUtils.isEmptyFile(downloadEntity.getPath())) {
|
||||
toast("解析包错误");
|
||||
toast("解析包出错(可能被误删了),请重新下载");
|
||||
DownloadManager.getInstance(MainActivity.this).cancel(downloadEntity.getUrl());
|
||||
} else {
|
||||
PackageManager manager = new PackageManager(
|
||||
getApplicationContext());
|
||||
if (manager.launchSetup(downloadEntity.getPath())) {
|
||||
if (PackageUtils.isCanLaunchSetup(getApplicationContext(), downloadEntity.getPath())) {
|
||||
startActivity(PackageUtils.getInstallIntent(downloadEntity.getPath()));
|
||||
} else {
|
||||
// 记录自动弹出卸载框
|
||||
// 弹出卸载提示框
|
||||
EventBus.getDefault().post(new EBShowDialog("delete",
|
||||
downloadEntity.getPath()));
|
||||
EventBus.getDefault().post(new EBShowDialog("plugin", downloadEntity.getPath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -383,8 +374,6 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
// 初始化gameMap
|
||||
DownloadManager.getInstance(this).initGameMap();
|
||||
|
||||
mainActivity = this;
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
currentTab = savedInstanceState.getInt("currentTab");
|
||||
} else {
|
||||
@ -817,7 +806,6 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
if (list == null || list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
PackageManager mPackageManager = new PackageManager(this);
|
||||
List<ConcernInfo> infos = concernManager.getInstalledGame();
|
||||
HashMap<String, Boolean> map;
|
||||
GameEntity gameEntity;
|
||||
@ -829,7 +817,7 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
&& gameEntity.getApk() != null) {
|
||||
map = info.getPackageNames();
|
||||
for (String key : map.keySet()) {
|
||||
if (map.get(key) && !mPackageManager.isSignature(key)) {
|
||||
if (map.get(key) && !PackageUtils.isSignature(this, key)) {
|
||||
for (ApkEntity apkEntity : gameEntity.getApk()) {
|
||||
if (apkEntity.getPackageName().equals(key)) {
|
||||
GameUpdateEntity gameUpdateEntity = new GameUpdateEntity();
|
||||
@ -1504,9 +1492,12 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
DataUtils.onEvent(this, "插件化", mDownloadEntity.getName(), kv6);
|
||||
}
|
||||
|
||||
// 删除数据库和文件
|
||||
DownloadManager.getInstance(getApplicationContext()).cancel(
|
||||
mDownloadEntity.getUrl(), sp.getBoolean("autodelete", true));
|
||||
if (!mDownloadEntity.isPlugin() // 不是插件游戏,自己删除数据库数据和安装包
|
||||
|| PackageUtils.isSignature(this, packageName)) {// 是插件游戏,判断签名是否相同,是才删除数据库数据和安装包
|
||||
DownloadManager.getInstance(getApplicationContext()).cancel(
|
||||
mDownloadEntity.getUrl(), sp.getBoolean("autodelete", true));
|
||||
}
|
||||
|
||||
} else if ("卸载".equals(busFour.getType())) {
|
||||
Map<String, Object> kv6 = new HashMap<>();
|
||||
kv6.put("安装或卸载", "卸载完成");
|
||||
|
||||
Reference in New Issue
Block a user