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

@ -356,19 +356,15 @@ public class BindingAdapters {
break;
case NORMAL:
case PLUGIN:
if (gameEntity.getApk().size() == 1) {
ApkEntity apk = gameEntity.getApk().get(0);
DownloadDialogHelper.findAvailableDialogAndShow(
v.getContext(),
gameEntity,
apk,
() -> {
DialogUtils.checkDownload(v.getContext(), apk.getSize(),
isSubscribe -> download(progressBar, gameEntity, traceEvent, isSubscribe, entrance, location));
});
if (gameEntity.getVersionNumber().contains("无版号")) {
String msg = gameEntity.getVersionNumber().equals("无版号-有内购") ? v.getContext().getString(R.string.attempt_tips_1) :
v.getContext().getString(R.string.attempt_tips_2);
DialogUtils.showAlertDialog(v.getContext(), "温馨提示:", msg, "继续下载", "取消", () -> {
download(progressBar, gameEntity, traceEvent, entrance, location, v);
}, () -> {
});
} else {
DownloadDialog.getInstance(v.getContext()).showPopupWindow(v, gameEntity,
entrance, location + gameEntity.getName(), traceEvent);
download(progressBar, gameEntity, traceEvent, entrance, location, v);
}
break;
case LAUNCH_OR_OPEN:
@ -455,7 +451,7 @@ public class BindingAdapters {
}
progressBar.setDownloadType(DownloadProgressBar.DownloadType.NONE);
}
} else {
String status = GameUtils.getDownloadBtnText(progressBar.getContext(), gameEntity, PluginLocation.only_game);
switch (status) {
@ -511,6 +507,23 @@ public class BindingAdapters {
}
}
private static void download(DownloadProgressBar progressBar, GameEntity gameEntity, ExposureEvent traceEvent, @Nullable String entrance, @Nullable String location, View v) {
if (gameEntity.getApk().size() == 1) {
ApkEntity apk = gameEntity.getApk().get(0);
DownloadDialogHelper.findAvailableDialogAndShow(
v.getContext(),
gameEntity,
apk,
() -> {
DialogUtils.checkDownload(v.getContext(), apk.getSize(),
isSubscribe -> download(progressBar, gameEntity, traceEvent, isSubscribe, entrance, location));
});
} else {
DownloadDialog.getInstance(v.getContext()).showPopupWindow(v, gameEntity,
entrance, location + gameEntity.getName(), traceEvent);
}
}
private static void updateReservation(DownloadProgressBar progressBar, GameEntity gameEntity) {
// 显示预约
@ -546,10 +559,10 @@ public class BindingAdapters {
String msg = FileUtils.isCanDownload(progressBar.getContext(), apkEntity.getSize());
if (TextUtils.isEmpty(msg)) {
DataUtils.onGameDownloadEvent(progressBar.getContext(), gameEntity.getName(), apkEntity.getPlatform(), entrance, "下载开始", method);
ExposureUtils.DownloadType downloadType = ExposureUtils.getDownloadType(apkEntity, method);
ExposureEvent downloadExposureEvent = ExposureUtils.logADownloadExposureEvent(gameEntity, apkEntity.getPlatform(), traceEvent, downloadType);
DownloadManager.createDownload(progressBar.getContext(),
apkEntity,
gameEntity,