Commit 0a6d5908 authored by wanglei's avatar wanglei

...模块化

parent d630076a
......@@ -13,8 +13,9 @@ import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.didi.drouter.api.DRouter
import com.koko.batteryinfo.databinding.ActivityBatteryInfoBinding
import com.koko.router.ad.InterAdService
import com.koko.router.ad.NativeBatteryType
import com.koko.router.ad.NativeService
import com.koko.router.ad.NativeAdService
import java.math.BigDecimal
import java.math.RoundingMode
......@@ -34,18 +35,20 @@ class BatteryInfoActivity : BaseActivity<ActivityBatteryInfoBinding>() {
showNative()
// if (AdmobHelper.isShowOpenDocumentInter()) {
// AdmobInterstitialUtils.showInterstitialAd(this) {
// startProgressAnimation(binding.tvBattery.text.toString().toInt())
// }
// } else {
// startProgressAnimation(binding.tvBattery.text.toString().toInt())
// }
showInter()
}
private fun showInter() {
val interAdService = DRouter.build(InterAdService::class.java).getService()
interAdService.showInterAd(this) {
startProgressAnimation(binding.tvBattery.text.toString().toInt())
}
}
private fun showNative() {
val nativeService = DRouter.build(NativeService::class.java).getService()
val nativeService = DRouter.build(NativeAdService::class.java).getService()
nativeService.showNative(this, binding.flAd, NativeBatteryType)
}
......
package com.koko.router.ad
import android.app.Activity
const val INTER_BATTERY_INFO = "INTER_BATTERY_INFO"
interface InterAdService {
fun showInterAd(activity: Activity, interWhere: String = "", callBack: () -> Unit)
}
\ No newline at end of file
......@@ -5,7 +5,7 @@ import android.widget.FrameLayout
const val NativeBatteryType: String = "NativeBatteryType"
interface NativeService {
interface NativeAdService {
fun showNative(activity: Activity, flAd: FrameLayout, nativeType: String)
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ import com.applovin.sdk.AppLovinSdkInitializationConfiguration
import com.base.appzxhy.BuildConfig
import com.base.appzxhy.GlobalConfig
import com.base.appzxhy.ads.admob.AdBannerMgr
import com.base.appzxhy.ads.admob.AdInsertMgr
import com.base.appzxhy.ads.admob.AdInterMgr
import com.base.appzxhy.ads.admob.AdNativeMgr
import com.base.appzxhy.ads.admob.AdOpenMgr
import com.base.appzxhy.ads.admob.AdmobEvent
......@@ -42,7 +42,7 @@ object AdsMgr {
AdOpenMgr()
}
private val adInsertMgr by lazy {
AdInsertMgr()
AdInterMgr()
}
private val adNativeMgr by lazy {
......
......@@ -20,7 +20,7 @@ import java.lang.ref.WeakReference
/**
*插屏广告加载显示管理类
*/
class AdInsertMgr {
class AdInterMgr {
private var adState = adState<InterstitialAd>()
private var showCallBack: AdsShowCallBack? = null
......
package com.base.appzxhy.drouterimp
import android.app.Activity
import com.base.appzxhy.ads.AdsMgr
import com.base.appzxhy.ads.AdsShowCallBack
import com.didi.drouter.annotation.Service
import com.koko.router.ad.InterAdService
@Service(function = [InterAdService::class])
class InterAdServiceImp : InterAdService {
override fun showInterAd(activity: Activity, interWhere: String, callBack: () -> Unit) {
val isUnLimit = false
AdsMgr.showInsert(activity, isUnLimit, object : AdsShowCallBack() {
override fun close(where: Int) {
callBack.invoke()
}
override fun failed(where: Int) {
callBack.invoke()
}
override fun googleFailed(where: Int) {
callBack.invoke()
}
})
}
}
\ No newline at end of file
......@@ -7,10 +7,10 @@ import com.base.appzxhy.ads.AdsMgr
import com.base.appzxhy.utils.LogEx
import com.didi.drouter.annotation.Service
import com.koko.router.ad.NativeBatteryType
import com.koko.router.ad.NativeService
import com.koko.router.ad.NativeAdService
@Service(function = [NativeService::class])
class NativeServiceImp : NativeService {
@Service(function = [NativeAdService::class])
class NativeAdServiceImp : NativeAdService {
private val TAG = "NativeServiceImp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment