模拟器游戏下载记录使用本地数据库保存

This commit is contained in:
张玉久
2020-10-14 19:53:24 +08:00
parent b2100fe0e5
commit 93126517b6
13 changed files with 138 additions and 39 deletions

View File

@ -576,10 +576,16 @@ public class DownloadItemUtils {
});
}
} else if (str.equals(context.getString(R.string.install))) {
EmulatorGameEntity emulatorGameEntity = EmulatorGameManager.findGameByName(gameEntity.getName());
boolean isInstalled = PackageUtils.isInstalled(context, apk.getPackageName());
if (emulatorGameEntity != null && EmulatorGameManager.isEmulatorGame(apk.getFormat()) && !isInstalled) {
EmulatorDownloadManager.getInstance().showDownloadDialog(context, gameEntity);
return;
}
install(context, gameEntity, position, adapter);
} else if (str.equals(context.getString(R.string.launch))) {
//启动模拟器游戏
if (EmulatorGameManager.formats.contains(gameEntity.getApk().get(0).getFormat())) {
if (EmulatorGameManager.isEmulatorGame(gameEntity.getApk().get(0).getFormat())) {
EmulatorGameEntity emulatorGameEntity = EmulatorGameManager.findGameByName(gameEntity.getName());
if (emulatorGameEntity != null) {
File file = new File(emulatorGameEntity.getFilePath());
@ -587,9 +593,7 @@ public class DownloadItemUtils {
download(context, gameEntity, downloadBtn, entrance, location, false, traceEvent);
return;
}
EmulatorDownloadManager.getInstance().showDownloadDialog(context, gameEntity, () -> {
ToastUtils.INSTANCE.showToast("启动模拟器游戏-" + emulatorGameEntity.getGameName());
});
ToastUtils.INSTANCE.showToast("启动模拟器游戏-" + emulatorGameEntity.getGameName());
}
return;
}