隔3插屏广告 再隔5激励广告
This commit is contained in:
parent
64242f4905
commit
150c1a7107
|
|
@ -1,7 +1,7 @@
|
||||||
package com.gamedog.vididin.main
|
package com.gamedog.vididin.main
|
||||||
|
|
||||||
|
|
||||||
import android.util.TimeUtils
|
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.ama.core.architecture.appBase.vm.AppViewModel
|
import com.ama.core.architecture.appBase.vm.AppViewModel
|
||||||
import com.vididin.real.money.game.R
|
import com.vididin.real.money.game.R
|
||||||
|
|
|
||||||
|
|
@ -168,12 +168,14 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
|
||||||
private fun handleEventOneVideoWatched() {
|
private fun handleEventOneVideoWatched() {
|
||||||
mWatchedVideoTotal ++
|
mWatchedVideoTotal ++
|
||||||
|
|
||||||
if (mWatchedVideoTotal % VIDEO_NUM_GAP_FOR_AD == 0) {
|
val loopCount = VIDEO_NUM_GAP_FOR_AD_NORMAL + VIDEO_NUM_GAP_FOR_AD_REWARD
|
||||||
showInterstitialAd {
|
val positionInCycle = mWatchedVideoTotal % loopCount
|
||||||
// TODO - need do anything for ad show
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (positionInCycle == 0) {
|
||||||
|
showRewardAd()
|
||||||
|
} else if (positionInCycle == VIDEO_NUM_GAP_FOR_AD_NORMAL) {
|
||||||
|
showInterstitialAd {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleWatchTimeTick() {
|
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?) {
|
private fun setHomeTabStyle(f: Fragment?) {
|
||||||
isBackgroundBright = f.asSafe<OnFragmentBackgroundListener>()?.isBackgroundBright ?: return
|
isBackgroundBright = f.asSafe<OnFragmentBackgroundListener>()?.isBackgroundBright ?: return
|
||||||
activity.asSafe<OnTabStyleListener>()?.onTabIsDarkFont(isBackgroundBright)
|
activity.asSafe<OnTabStyleListener>()?.onTabIsDarkFont(isBackgroundBright)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
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()
|
internal fun newInstance() = HomeFragment()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@
|
||||||
android:id="@+id/magic_indicator"
|
android:id="@+id/magic_indicator"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="30dp"
|
android:paddingTop="12dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/ad_container" />
|
app:layout_constraintBottom_toTopOf="@+id/ad_container" />
|
||||||
|
|
||||||
<net.lucode.hackware.magicindicator.MagicIndicator
|
<FrameLayout
|
||||||
android:id="@+id/ad_container"
|
android:id="@+id/ad_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue