This commit is contained in:
张玉久
2020-04-02 16:45:16 +08:00
parent 89e72a0fea
commit a12593ea51
4 changed files with 91 additions and 40 deletions

View File

@ -171,14 +171,14 @@ public class DownloadItemUtils {
}
if (gameEntity.getApk().isEmpty()
|| gameEntity.getDownloadOffStatus() != null) {
|| gameEntity.getDownloadOffStatus() != null) {
LinkEntity h5LinkEntity = gameEntity.getH5Link();
String offStatus = gameEntity.getDownloadOffStatus();
holder.gameDes.setVisibility(View.VISIBLE);
holder.gameProgressbar.setVisibility(View.GONE);
holder.gameInfo.setVisibility(View.GONE);
if (h5LinkEntity != null) {
if ("play".equals(h5LinkEntity.getType())) {
holder.gameDownloadBtn.setText("开始玩");
@ -420,7 +420,7 @@ public class DownloadItemUtils {
}
return;
}
if (gameEntity.getApk().size() == 0 && gameEntity.getH5Link() != null) {
downloadBtn.setOnClickListener(v -> {
MtaHelper.onEvent("H5页面", "入口", "列表页_" + gameEntity.getName());
@ -449,7 +449,17 @@ public class DownloadItemUtils {
clickCallback.onCallback();
}
PermissionHelper.checkStoragePermissionBeforeAction(context, () -> {
DownloadDialog.getInstance(context).showPopupWindow(v, gameEntity, entrance, location, traceEvent);
String str = downloadBtn.getText().toString();
if (str.equals(context.getString(R.string.attempt))) {
String msg = gameEntity.getVersionNumber().equals("无版号-有内购") ? context.getString(R.string.attempt_tips_1) :
context.getString(R.string.attempt_tips_2);
DialogUtils.showAlertDialog(context, "温馨提示:", msg, "继续下载", "取消", () -> {
DownloadDialog.getInstance(context).showPopupWindow(v, gameEntity, entrance, location, traceEvent);
}, () -> {
});
} else {
DownloadDialog.getInstance(context).showPopupWindow(v, gameEntity, entrance, location, traceEvent);
}
});
});
}
@ -485,6 +495,19 @@ public class DownloadItemUtils {
});
DataLogUtils.uploadGameLog(context, gameEntity.getId(), gameEntity.getName(), entrance);
} else if (str.equals(context.getString(R.string.attempt))) {
String msg = gameEntity.getVersionNumber().equals("无版号-有内购") ? context.getString(R.string.attempt_tips_1) :
context.getString(R.string.attempt_tips_2);
DialogUtils.showAlertDialog(context, "温馨提示:", msg, "继续下载", "取消", () -> {
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, () -> {
DialogUtils.checkDownload(context, apk.getSize(),
isSubscribe -> download(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
});
DataLogUtils.uploadGameLog(context, gameEntity.getId(), gameEntity.getName(), entrance);
}, () -> {
});
} else if (str.equals(context.getString(R.string.pluggable))) {
if (entrance.contains("我的游戏")) {
MtaHelper.onEvent("我的游戏_启动", "插件化", gameEntity.getName());
@ -584,12 +607,12 @@ public class DownloadItemUtils {
//更新
private static void update(Context context, GameEntity gameEntity, String entrance, String location, boolean isSubscribe, @Nullable ExposureEvent traceEvent) {
ApkEntity apkEntity = gameEntity.getApk().get(0);
ExposureUtils.DownloadType downloadType = ExposureUtils.getUpdateType(apkEntity);
DataUtils.onGameUpdateEvent(context, gameEntity.getName(), apkEntity.getPlatform(), "下载开始");
ExposureEvent downloadExposureEvent = ExposureUtils.logADownloadExposureEvent(gameEntity, apkEntity
.getPlatform(), traceEvent, downloadType);
.getPlatform(), traceEvent, downloadType);
DownloadManager.createDownload(context, gameEntity, "更新", entrance, location, isSubscribe, downloadExposureEvent);
}