diff --git a/app/src/main/java/com/gh/common/databind/BindingAdapters.java b/app/src/main/java/com/gh/common/databind/BindingAdapters.java index 0192c90687..e506c826ec 100644 --- a/app/src/main/java/com/gh/common/databind/BindingAdapters.java +++ b/app/src/main/java/com/gh/common/databind/BindingAdapters.java @@ -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, diff --git a/app/src/main/java/com/gh/common/util/DownloadItemUtils.java b/app/src/main/java/com/gh/common/util/DownloadItemUtils.java index e9c569586e..1ba9628b1c 100644 --- a/app/src/main/java/com/gh/common/util/DownloadItemUtils.java +++ b/app/src/main/java/com/gh/common/util/DownloadItemUtils.java @@ -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); } diff --git a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/DetailViewHolder.java b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/DetailViewHolder.java index 696ccbfd6d..1759c8f23c 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/DetailViewHolder.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/DetailViewHolder.java @@ -169,19 +169,15 @@ public class DetailViewHolder { DataLogUtils.uploadGameLog(mViewHolder.context, mGameEntity.getId(), mGameEntity.getName(), mEntrance); case PLUGIN: PermissionHelper.checkStoragePermissionBeforeAction(mViewHolder.context, () -> { - if (mGameEntity.getApk().size() == 1) { - ApkEntity apk = mGameEntity.getApk().get(0); - DownloadDialogHelper.findAvailableDialogAndShow(mViewHolder.context, mGameEntity, apk, - () -> { - DialogUtils.checkDownload(mViewHolder.context, apk.getSize(), this::download); - }); + if (mGameEntity.getVersionNumber().contains("无版号")) { + String msg = mGameEntity.getVersionNumber().equals("无版号-有内购") ? mViewHolder.context.getString(R.string.attempt_tips_1) : + mViewHolder.context.getString(R.string.attempt_tips_2); + DialogUtils.showAlertDialog(mViewHolder.context, "温馨提示:", msg, "继续下载", "取消", () -> { + download(v, autoDownloadPlatform); + }, () -> { + }); } else { - DownloadDialog.getInstance(mViewHolder.context).showPopupWindowAutoDownload(v, - mGameEntity, - autoDownloadPlatform, - StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"), - mName + ":" + mTitle, - mTraceEvent); + download(v, autoDownloadPlatform); } }); break; @@ -246,12 +242,29 @@ public class DetailViewHolder { break; } } - + + private void download(View v, String autoDownloadPlatform) { + if (mGameEntity.getApk().size() == 1) { + ApkEntity apk = mGameEntity.getApk().get(0); + DownloadDialogHelper.findAvailableDialogAndShow(mViewHolder.context, mGameEntity, apk, + () -> { + DialogUtils.checkDownload(mViewHolder.context, apk.getSize(), this::download); + }); + } else { + DownloadDialog.getInstance(mViewHolder.context).showPopupWindowAutoDownload(v, + mGameEntity, + autoDownloadPlatform, + StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"), + mName + ":" + mTitle, + mTraceEvent); + } + } + private void showOffServiceDialog(GameEntity.Dialog dialog) { GameOffServiceDialogFragment dialogFragment = GameOffServiceDialogFragment.getInstance(dialog); - dialogFragment.show(((FragmentActivity)mViewHolder.context).getSupportFragmentManager(), "off_service_dialog"); + dialogFragment.show(((FragmentActivity) mViewHolder.context).getSupportFragmentManager(), "off_service_dialog"); } - + private void download(boolean isSubscribe) { String str = mViewHolder.mDownloadPb.getText(); String method; @@ -270,10 +283,10 @@ public class DetailViewHolder { StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"), "下载开始", method); - + ExposureUtils.DownloadType downloadType = ExposureUtils.getDownloadType(apkEntity, method); ExposureEvent downloadExposureEvent = ExposureUtils.logADownloadExposureEvent(mGameEntity, apkEntity.getPlatform(), mTraceEvent, downloadType); - + DownloadManager.createDownload(mViewHolder.context, apkEntity, mGameEntity, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 435b97b6cd..175f839978 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -667,4 +667,6 @@ 将已安装游戏标记为玩过的游戏 https://v.douyin.com/C9UHr6/ 你有%1$d]]>款预约的游戏上线啦 + 该游戏暂时仅提供试玩版本。试玩版资源来自第三方网站,可能存在bug或兼容性问题。敬请留意后续相关消息。 + 该游戏暂时仅提供试玩版本。试玩版可能存在bug或兼容性问题。敬请留意后续相关消息。