隔3插屏广告 再隔5激励广告

This commit is contained in:
renhaoting 2025-12-23 19:28:43 +08:00
parent 64242f4905
commit 150c1a7107
3 changed files with 16 additions and 9 deletions

View File

@ -1,7 +1,7 @@
package com.gamedog.vididin.main
import android.util.TimeUtils
import androidx.lifecycle.viewModelScope
import com.ama.core.architecture.appBase.vm.AppViewModel
import com.vididin.real.money.game.R

View File

@ -168,12 +168,14 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
private fun handleEventOneVideoWatched() {
mWatchedVideoTotal ++
if (mWatchedVideoTotal % VIDEO_NUM_GAP_FOR_AD == 0) {
showInterstitialAd {
// TODO - need do anything for ad show
}
}
val loopCount = VIDEO_NUM_GAP_FOR_AD_NORMAL + VIDEO_NUM_GAP_FOR_AD_REWARD
val positionInCycle = mWatchedVideoTotal % loopCount
if (positionInCycle == 0) {
showRewardAd()
} else if (positionInCycle == VIDEO_NUM_GAP_FOR_AD_NORMAL) {
showInterstitialAd {}
}
}
private fun handleWatchTimeTick() {
@ -280,13 +282,18 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
}
}
private fun showRewardAd() {
WatchAdDialog(requireActivity(), VidiConst.WATCH_AD_FOR_DAILY_WATCH_AD, null).show()
}
private fun setHomeTabStyle(f: Fragment?) {
isBackgroundBright = f.asSafe<OnFragmentBackgroundListener>()?.isBackgroundBright ?: return
activity.asSafe<OnTabStyleListener>()?.onTabIsDarkFont(isBackgroundBright)
}
companion object {
const val VIDEO_NUM_GAP_FOR_AD = 3
const val VIDEO_NUM_GAP_FOR_AD_NORMAL = 3
const val VIDEO_NUM_GAP_FOR_AD_REWARD = 5
internal fun newInstance() = HomeFragment()
}

View File

@ -23,10 +23,10 @@
android:id="@+id/magic_indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="30dp"
android:paddingTop="12dp"
app:layout_constraintBottom_toTopOf="@+id/ad_container" />
<net.lucode.hackware.magicindicator.MagicIndicator
<FrameLayout
android:id="@+id/ad_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"