bug修改 - 每刷3个视频不是会弹出激励广告嘛,激励广告弹出来如果点击关闭按钮,也需要加上插屏

This commit is contained in:
renhaoting 2025-12-26 18:06:02 +08:00
parent eb581c16ae
commit c7f430d58c
2 changed files with 13 additions and 4 deletions

View File

@ -12,6 +12,8 @@ class WatchAdDialog(context: Activity, private val mWatchAdType: Int, private va
private val mTaskDataJson: String? = "")
: BindingDialog<DialogWatchVideoBinding>(context, DialogWatchVideoBinding::inflate) {
private var mOnClosed: (() -> Unit)? = null
init {
build()
}
@ -27,6 +29,7 @@ class WatchAdDialog(context: Activity, private val mWatchAdType: Int, private va
setOnClickBatch(flAction, ivClose) {
when (this) {
ivClose -> {
mOnClosed?.invoke()
dismiss()
}
flAction -> {
@ -51,6 +54,9 @@ class WatchAdDialog(context: Activity, private val mWatchAdType: Int, private va
}
fun setOnCloseListener(onClose: ()->Unit) {
mOnClosed = onClose
}
}

View File

@ -29,7 +29,6 @@ import com.ama.core.common.util.asSafe
import com.ama.core.common.widget.PopMenuIconView
import com.gamedog.vididin.VidiConst
import com.gamedog.vididin.VididinEvents
import com.gamedog.vididin.beans.RECORD_GOLD_PLUS_NEWBIE_GIFT
import com.gamedog.vididin.beans.RECORD_GOLD_PLUS_WATCH_VIDEO_BY_TIME_DURATION
import com.gamedog.vididin.beans.RecordGold
import com.gamedog.vididin.core.login.login.AccountManager
@ -175,7 +174,7 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
val positionInCycle = mWatchedVideoTotal % loopCount
if (positionInCycle == 0) {
showRewardAd()
handleShouldShowAdDialog()
} else if (positionInCycle == VIDEO_NUM_GAP_FOR_AD_NORMAL) {
showInterstitialAd {}
}
@ -286,8 +285,12 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
}
}
private fun showRewardAd() {
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_WATCH_AD, null).show()
private fun handleShouldShowAdDialog() {
val adDialog = WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_WATCH_AD, null)
adDialog.setOnCloseListener {
showInterstitialAd {}
}
adDialog.show()
}
private fun setHomeTabStyle(f: Fragment?) {