Commit 95c2af77 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent c1b64f4d
......@@ -44,15 +44,4 @@ class AdManager {
carrierType,
)
}
/**
* 开屏页使用-预加载广告
*/
fun splashPreLoadAll(activity: Activity) {
SplashManager.preLoadAd(activity)
if (!UserManager.getInstance().vipFlag) {
this.preLoadAd(activity)
}
}
}
\ No newline at end of file
......@@ -28,9 +28,6 @@ object BannerManager {
fun loadAd(act: Activity?, view: FrameLayout?) {
weakActivity = WeakReference<Activity>(act)
weakFrameLayout = WeakReference<FrameLayout>(view)
// if (UserManager.getInstance().vipFlag) {
// return
// }
LogUtil.d(TAG, "gromore banner广告-> 1、进入加载")
/** 这里是简单的banner请求adSlot设置,如果需要更多的设置,可参考AdUtils.kt中bannerAdSlot函数部分。 */
......
......@@ -183,7 +183,7 @@ class DrawExpressManager {
// 若上一个广告还在加载中则返回
if (isLoadSuccess == 1) {
this.mExpressAdCallback = callback
LogUtil.e(TAG, "gromore draw信息流--> 3.9、广告加载中 LoadSuccess = $isLoadSuccess")
LogUtil.d(TAG, "gromore draw信息流--> 3.9、广告加载中 LoadSuccess = $isLoadSuccess")
return
}
......@@ -255,11 +255,12 @@ class DrawExpressManager {
}
override fun onRenderFail(p0: View?, p1: String?, p2: Int) {
Log.i(TAG, "onRenderFail")
LogUtil.e(TAG, "gromore信息流--> 5、展示广告时失败了,onRenderFail msg=${p1} code=${p2} ")
}
override fun onAdClick() {
Log.i(TAG, "onAdClick")
LogUtil.d(TAG, "onAdClick")
}
override fun onAdShow() {
......
......@@ -167,7 +167,7 @@ class ExpressManager {
// 若上一个广告还在加载中则返回
if (isLoadSuccess == 1) {
this.mExpressAdCallback = callback
LogUtil.e(TAG, "gromore信息流--> 3.9、广告加载中 LoadSuccess = $isLoadSuccess")
LogUtil.d(TAG, "gromore信息流--> 3.9、广告加载中 LoadSuccess = $isLoadSuccess")
return
}
......@@ -233,7 +233,7 @@ class ExpressManager {
override fun onRenderFail(p0: View?, p1: String?, p2: Int) {
isLoadSuccess = 0
Log.i(TAG, "onRenderFail")
LogUtil.e(TAG, "gromore信息流--> 5、展示广告时失败了,onRenderFail msg=${p1} code=${p2} ")
}
override fun onAdClick() {
......
......@@ -71,7 +71,7 @@ class SplashActivity : BaseActivity() {
private fun initData() {
val firstSplash = get().getBoolean(Constant.FIRST_SPLASH, true)
if (!firstSplash) {
AdManager.instance.splashPreLoadAll(this)
SplashManager.preLoadAd(this@SplashActivity)
}
mProgressBar!!.startOneAnim()
try {
......@@ -92,7 +92,7 @@ class SplashActivity : BaseActivity() {
// 第一次安装时,延迟加载开屏广告,因为广告sdk还未初始化完成
val firstSplash = get().getBoolean(Constant.FIRST_SPLASH, true)
if (firstSplash && millisUntilFinished == (AD_TIME_OUT - 2000).toLong()) {
AdManager.instance.splashPreLoadAll(this@SplashActivity)
SplashManager.preLoadAd(this@SplashActivity)
get().put(Constant.FIRST_SPLASH, false)
}
......
......@@ -13,6 +13,7 @@ import com.google.android.material.tabs.TabLayoutMediator
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.ad.banner.BannerManager
import com.mints.helivideo.common.AppConfig
import com.mints.helivideo.common.Constant
......@@ -67,6 +68,10 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
initListener()
loadData()
if (!UserManager.getInstance().vipFlag) {
AdManager.instance.preLoadAd(requireActivity())
}
Handler(Looper.getMainLooper()).postDelayed({
goToMainActivity()
}, 300)
......@@ -95,7 +100,9 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
if (AntiShake.check(banner?.id)) return
BannerManager.loadAd(requireActivity(), fl_main_banner)
if (!UserManager.getInstance().vipFlag) {
BannerManager.loadAd(requireActivity(), fl_main_banner)
}
if (AppConfig.exitLoginMainRefresh) {
AppConfig.exitLoginMainRefresh = false
......
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