Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
A
appzxhy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
appzxhy
Commits
126e5240
Commit
126e5240
authored
Jun 13, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[商业化]优化广告事件上报链
parent
e18d1f4d
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
128 additions
and
49 deletions
+128
-49
AdState.kt
app/src/main/java/com/base/appzxhy/business/ads/AdState.kt
+14
-1
AdsMgr.kt
app/src/main/java/com/base/appzxhy/business/ads/AdsMgr.kt
+2
-3
AdInterMgr.kt
...in/java/com/base/appzxhy/business/ads/admob/AdInterMgr.kt
+51
-17
AdOpenMgr.kt
...ain/java/com/base/appzxhy/business/ads/admob/AdOpenMgr.kt
+49
-19
AdmobEvent.kt
...in/java/com/base/appzxhy/business/ads/admob/AdmobEvent.kt
+0
-1
MaxInsertMgr.kt
...va/com/base/appzxhy/business/ads/applovin/MaxInsertMgr.kt
+1
-1
MaxOpenMgr.kt
...java/com/base/appzxhy/business/ads/applovin/MaxOpenMgr.kt
+1
-1
GuideCleanActivity.kt
...main/java/com/base/appzxhy/ui/guide/GuideCleanActivity.kt
+8
-4
LanguageActivity.kt
...ain/java/com/base/appzxhy/ui/language/LanguageActivity.kt
+1
-1
SplashActivity.kt
...rc/main/java/com/base/appzxhy/ui/splash/SplashActivity.kt
+1
-1
No files found.
app/src/main/java/com/base/appzxhy/business/ads/AdState.kt
View file @
126e5240
...
@@ -16,6 +16,11 @@ class AdState<T>() {
...
@@ -16,6 +16,11 @@ class AdState<T>() {
*/
*/
var
currentAd
:
T
?
=
null
var
currentAd
:
T
?
=
null
/**
* 当前缓存广告对应的event
*/
var
currentAdEvent
:
AdEvent
?
=
null
/**
/**
* 是否正在缓存加载广告
* 是否正在缓存加载广告
*/
*/
...
@@ -43,6 +48,7 @@ class AdState<T>() {
...
@@ -43,6 +48,7 @@ class AdState<T>() {
*/
*/
fun
onAdDisplayed
()
{
fun
onAdDisplayed
()
{
currentAd
=
null
currentAd
=
null
currentAdEvent
=
null
activityRef
=
null
activityRef
=
null
adDialog
?.
dismiss
()
adDialog
?.
dismiss
()
...
@@ -63,14 +69,18 @@ class AdState<T>() {
...
@@ -63,14 +69,18 @@ class AdState<T>() {
adDialog
=
null
adDialog
=
null
currentAd
=
null
currentAd
=
null
currentAdEvent
=
null
activityRef
=
null
activityRef
=
null
}
}
fun
onAdLoaded
(
ad
:
T
?)
{
fun
onAdLoaded
(
ad
:
T
?
,
adEvent
:
AdEvent
?
)
{
//这里可能提前设置,所有可以不设置,max回调的类型可能不同
//这里可能提前设置,所有可以不设置,max回调的类型可能不同
if
(
ad
!=
null
)
{
if
(
ad
!=
null
)
{
currentAd
=
ad
currentAd
=
ad
}
}
if
(
adEvent
!=
null
)
{
currentAdEvent
=
adEvent
}
loadingAd
=
false
loadingAd
=
false
lastLoadTime
=
System
.
currentTimeMillis
()
lastLoadTime
=
System
.
currentTimeMillis
()
}
}
...
@@ -82,4 +92,7 @@ class AdState<T>() {
...
@@ -82,4 +92,7 @@ class AdState<T>() {
}
}
fun
adAvailable
()
=
currentAd
!=
null
||
((
System
.
currentTimeMillis
()
-
lastLoadTime
)
/
1000
/
60
).
toInt
()
<
30
}
}
app/src/main/java/com/base/appzxhy/business/ads/AdsMgr.kt
View file @
126e5240
...
@@ -183,13 +183,12 @@ object AdsMgr {
...
@@ -183,13 +183,12 @@ object AdsMgr {
val
from
=
activity
::
class
.
java
.
simpleName
val
from
=
activity
::
class
.
java
.
simpleName
if
(
adsConfigBean
.
adSwitch
)
{
if
(
adsConfigBean
.
adSwitch
)
{
val
admobEvent
=
AdmobEvent
(
"openAd"
,
from
)
val
admobEvent
=
AdmobEvent
(
"openAd"
,
from
)
admobEvent
.
isUnLimit
=
isUnLimit
if
(
isAdmobInit
)
{
if
(
isAdmobInit
)
{
adOpenMgr
.
show
(
activity
,
admobEvent
,
showCallBack
)
adOpenMgr
.
show
(
activity
,
isUnLimit
,
admobEvent
,
showCallBack
)
}
else
{
}
else
{
admobInitCallBack
=
{
admobInitCallBack
=
{
}
}
adOpenMgr
.
show
(
activity
,
admobEvent
,
showCallBack
)
adOpenMgr
.
show
(
activity
,
isUnLimit
,
admobEvent
,
showCallBack
)
}
}
}
else
{
}
else
{
if
(
isMaxInit
)
{
if
(
isMaxInit
)
{
...
...
app/src/main/java/com/base/appzxhy/business/ads/admob/AdInterMgr.kt
View file @
126e5240
...
@@ -26,10 +26,13 @@ import java.lang.ref.WeakReference
...
@@ -26,10 +26,13 @@ import java.lang.ref.WeakReference
*/
*/
class
AdInterMgr
{
class
AdInterMgr
{
private
val
TAG
=
"AdInterMgr"
private
val
TAG
=
"AdInterMgr"
private
var
adState
=
AdState
<
InterstitialAd
>()
private
var
adState
=
AdState
<
InterstitialAd
>()
private
var
showCallBack
:
AdsShowCallBack
?
=
null
private
var
showCallBack
:
AdsShowCallBack
?
=
null
//正在加载回调
private
var
loadingCallBack
:
(()
->
Unit
)?
=
null
fun
show
(
fun
show
(
activity
:
Activity
,
activity
:
Activity
,
isUnLimit
:
Boolean
,
isUnLimit
:
Boolean
,
...
@@ -43,39 +46,56 @@ class AdInterMgr {
...
@@ -43,39 +46,56 @@ class AdInterMgr {
return
return
}
}
if
(!
isUnLimit
)
{
val
nowAdEvent
=
adState
.
currentAdEvent
?:
adEvent
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
INSERT
,
adEvent
))
{
nowAdEvent
.
from
=
adEvent
.
from
nowAdEvent
.
isUnLimit
=
isUnLimit
if
(!
nowAdEvent
.
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
INSERT
,
nowAdEvent
))
{
showCallBack
?.
failed
(
2
)
showCallBack
?.
failed
(
2
)
return
return
}
}
if
(
LimitUtils
.
isIntervalLimited
(
a
dEvent
))
{
if
(
LimitUtils
.
isIntervalLimited
(
nowA
dEvent
))
{
showCallBack
?.
failed
(
3
)
showCallBack
?.
failed
(
3
)
return
return
}
}
}
}
adEvent
.
adPrepareShow
()
val
needLoad
=
!
adState
.
adAvailable
()
adState
.
activityRef
=
WeakReference
(
activity
)
adState
.
activityRef
=
WeakReference
(
activity
)
this
.
showCallBack
=
showCallBack
this
.
showCallBack
=
showCallBack
if
(
adState
.
adDialog
==
null
)
{
if
(
adState
.
adDialog
==
null
)
{
adState
.
adDialog
=
activity
.
showAdCountDownDialog
()
adState
.
adDialog
=
activity
.
showAdCountDownDialog
()
}
else
{
}
else
{
adState
.
adDialog
?.
dismiss
()
adState
.
adDialog
?.
dismiss
()
}
}
val
needLoad
=
adState
.
currentAd
==
null
||
!
adAvailable
()
nowAdEvent
.
adPrepareShow
()
LogEx
.
logDebug
(
adEvent
.
TAG
,
"needLoad=$needLoad"
)
if
(
needLoad
)
{
if
(
needLoad
)
{
if
(!
adState
.
loadingAd
)
{
if
(!
adState
.
loadingAd
)
{
loadAd
(
activity
,
adEvent
,
isUnLimit
)
{
LogEx
.
logDebug
(
adEvent
.
TAG
,
"inter adState !loadingAd"
)
showReadyAd
(
adEvent
)
loadAd
(
activity
,
adEvent
)
{
showReadyAd
()
}
}
else
{
LogEx
.
logDebug
(
adEvent
.
TAG
,
"inter adState is loadingAd"
)
loadingCallBack
=
{
showReadyAd
()
}
}
}
}
}
else
{
}
else
{
showReadyAd
(
adEvent
)
LogEx
.
logDebug
(
adEvent
.
TAG
,
"inter ad ready"
)
showReadyAd
()
}
}
}
}
private
fun
showReadyAd
(
adEvent
:
AdEvent
)
{
private
fun
showReadyAd
()
{
val
ac
=
adState
.
activityRef
?.
get
()
val
ac
=
adState
.
activityRef
?.
get
()
if
(
ac
==
null
||
ac
.
isFinishing
||
ac
.
isDestroyed
)
{
if
(
ac
==
null
||
ac
.
isFinishing
||
ac
.
isDestroyed
)
{
...
@@ -83,12 +103,15 @@ class AdInterMgr {
...
@@ -83,12 +103,15 @@ class AdInterMgr {
return
return
}
}
adState
.
currentAd
?.
run
{
adState
.
currentAd
?.
run
{
val
adEvent
=
(
adState
.
currentAdEvent
as
AdmobEvent
?)
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
override
fun
onAdShowedFullScreenContent
()
{
override
fun
onAdShowedFullScreenContent
()
{
super
.
onAdShowedFullScreenContent
()
super
.
onAdShowedFullScreenContent
()
val
ac
=
adState
.
activityRef
?.
get
()
val
ac
=
adState
.
activityRef
?.
get
()
(
adEvent
as
AdmobEvent
)
.
showAd
(
responseInfo
,
ac
)
adEvent
?
.
showAd
(
responseInfo
,
ac
)
adState
.
onAdDisplayed
()
adState
.
onAdDisplayed
()
showCallBack
?.
show
()
showCallBack
?.
show
()
...
@@ -103,7 +126,7 @@ class AdInterMgr {
...
@@ -103,7 +126,7 @@ class AdInterMgr {
showCallBack
?.
adFailed
()
showCallBack
?.
adFailed
()
showCallBack
=
null
showCallBack
=
null
adEvent
.
adShowError
(
adError
)
adEvent
?
.
adShowError
(
adError
)
}
}
override
fun
onAdDismissedFullScreenContent
()
{
override
fun
onAdDismissedFullScreenContent
()
{
...
@@ -118,7 +141,7 @@ class AdInterMgr {
...
@@ -118,7 +141,7 @@ class AdInterMgr {
override
fun
onAdClicked
()
{
override
fun
onAdClicked
()
{
super
.
onAdClicked
()
super
.
onAdClicked
()
(
adEvent
as
AdmobEvent
)
.
clickAd
(
responseInfo
)
adEvent
?
.
clickAd
(
responseInfo
)
//计数
//计数
LimitUtils
.
addClickNum
()
LimitUtils
.
addClickNum
()
}
}
...
@@ -135,10 +158,9 @@ class AdInterMgr {
...
@@ -135,10 +158,9 @@ class AdInterMgr {
fun
loadAd
(
fun
loadAd
(
context
:
Context
,
context
:
Context
,
adEvent
:
AdEvent
,
adEvent
:
AdEvent
,
isUnLimit
:
Boolean
=
false
,
loadCallBack
:
(()
->
Unit
)?
=
null
loadCallBack
:
(()
->
Unit
)?
=
null
)
{
)
{
if
(!
isUnLimit
)
{
if
(!
adEvent
.
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
INSERT
,
adEvent
))
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
INSERT
,
adEvent
))
{
this
.
showCallBack
?.
close
(
4
)
this
.
showCallBack
?.
close
(
4
)
this
.
showCallBack
=
null
this
.
showCallBack
=
null
...
@@ -147,14 +169,27 @@ class AdInterMgr {
...
@@ -147,14 +169,27 @@ class AdInterMgr {
}
}
}
}
//避免无效预加载
if
(
adState
.
loadingAd
&&
loadCallBack
==
null
&&
loadingCallBack
==
null
)
{
//容错机制
adState
.
loadingAd
=
false
return
}
adState
.
loadingAd
=
true
adState
.
currentAdEvent
=
adEvent
adEvent
.
adPulStart
()
adEvent
.
adPulStart
()
InterstitialAd
.
load
(
InterstitialAd
.
load
(
context
,
GlobalConfig
.
ID_ADMOB_INTER
,
AdRequest
.
Builder
().
build
(),
context
,
GlobalConfig
.
ID_ADMOB_INTER
,
AdRequest
.
Builder
().
build
(),
object
:
InterstitialAdLoadCallback
()
{
object
:
InterstitialAdLoadCallback
()
{
override
fun
onAdLoaded
(
ad
:
InterstitialAd
)
{
override
fun
onAdLoaded
(
ad
:
InterstitialAd
)
{
adState
.
onAdLoaded
(
ad
)
adState
.
onAdLoaded
(
ad
,
adEvent
)
loadCallBack
?.
invoke
()
loadCallBack
?.
invoke
()
loadingCallBack
?.
invoke
()
loadingCallBack
=
null
(
adEvent
as
AdmobEvent
).
pullAd
(
ad
.
responseInfo
)
(
adEvent
as
AdmobEvent
).
pullAd
(
ad
.
responseInfo
)
LimitUtils
.
addRequestNum
()
LimitUtils
.
addRequestNum
()
ad
.
onPaidEventListener
=
AdmobOnPaidEventListener
(
adEvent
.
scope
)
ad
.
onPaidEventListener
=
AdmobOnPaidEventListener
(
adEvent
.
scope
)
...
@@ -172,5 +207,4 @@ class AdInterMgr {
...
@@ -172,5 +207,4 @@ class AdInterMgr {
}
}
private
fun
adAvailable
()
=
((
System
.
currentTimeMillis
()
-
adState
.
lastLoadTime
)
/
1000
/
60
).
toInt
()
<
30
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/business/ads/admob/AdOpenMgr.kt
View file @
126e5240
...
@@ -27,43 +27,58 @@ class AdOpenMgr {
...
@@ -27,43 +27,58 @@ class AdOpenMgr {
private
val
adState
=
AdState
<
AppOpenAd
>()
private
val
adState
=
AdState
<
AppOpenAd
>()
private
var
showCallBack
:
AdsShowCallBack
?
=
null
private
var
showCallBack
:
AdsShowCallBack
?
=
null
//正在加载回调
private
var
loadingCallBack
:
(()
->
Unit
)?
=
null
fun
show
(
activity
:
Activity
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?)
{
fun
show
(
activity
:
Activity
,
isUnLimit
:
Boolean
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?
)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
return
return
}
}
if
(!
adEvent
.
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
OPEN
,
adEvent
))
{
val
nowAdEvent
=
adState
.
currentAdEvent
?:
adEvent
nowAdEvent
.
from
=
adEvent
.
from
nowAdEvent
.
isUnLimit
=
isUnLimit
if
(!
nowAdEvent
.
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
OPEN
,
nowAdEvent
))
{
showCallBack
?.
failed
()
showCallBack
?.
failed
()
return
return
}
}
if
(
LimitUtils
.
isIntervalLimited
(
a
dEvent
))
{
if
(
LimitUtils
.
isIntervalLimited
(
nowA
dEvent
))
{
showCallBack
?.
failed
()
showCallBack
?.
failed
()
return
return
}
}
}
}
adEvent
.
adPrepareShow
()
val
needLoad
=
!
adState
.
adAvailable
()
adState
.
activityRef
=
WeakReference
(
activity
)
adState
.
activityRef
=
WeakReference
(
activity
)
this
.
showCallBack
=
showCallBack
this
.
showCallBack
=
showCallBack
// if (adState.adDialog == null) {
// adState.adDialog = activity.showAdPreparingDialog(1)
nowAdEvent
.
adPrepareShow
()
// } else {
// adState.adDialog?.dismiss()
// }
val
needLoad
=
adState
.
currentAd
==
null
||
!
adAvailable
()
if
(
needLoad
)
{
if
(
needLoad
)
{
if
(!
adState
.
loadingAd
)
{
if
(!
adState
.
loadingAd
)
{
LogEx
.
logDebug
(
adEvent
.
TAG
,
"open adState !loadingAd"
)
loadAd
(
activity
,
adEvent
)
{
loadAd
(
activity
,
adEvent
)
{
showReadyAd
(
adEvent
)
showReadyAd
()
}
}
else
{
LogEx
.
logDebug
(
adEvent
.
TAG
,
"open adState is loadingAd"
)
loadingCallBack
=
{
showReadyAd
()
}
}
}
}
}
else
{
}
else
{
showReadyAd
(
adEvent
)
LogEx
.
logDebug
(
adEvent
.
TAG
,
"open ad ready"
)
showReadyAd
()
}
}
}
}
private
fun
showReadyAd
(
adEvent
:
AdEvent
)
{
private
fun
showReadyAd
()
{
val
ac
=
adState
.
activityRef
?.
get
()
val
ac
=
adState
.
activityRef
?.
get
()
if
(
ac
==
null
||
ac
.
isFinishing
||
ac
.
isDestroyed
)
{
if
(
ac
==
null
||
ac
.
isFinishing
||
ac
.
isDestroyed
)
{
...
@@ -72,10 +87,13 @@ class AdOpenMgr {
...
@@ -72,10 +87,13 @@ class AdOpenMgr {
}
}
adState
.
currentAd
?.
run
{
adState
.
currentAd
?.
run
{
val
adEvent
=
adState
.
currentAdEvent
as
AdmobEvent
?
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
override
fun
onAdShowedFullScreenContent
()
{
override
fun
onAdShowedFullScreenContent
()
{
(
adEvent
as
AdmobEvent
)
.
showAd
(
this
@run
.
responseInfo
,
ac
)
adEvent
?
.
showAd
(
this
@run
.
responseInfo
,
ac
)
showCallBack
?.
show
()
showCallBack
?.
show
()
...
@@ -92,7 +110,7 @@ class AdOpenMgr {
...
@@ -92,7 +110,7 @@ class AdOpenMgr {
showCallBack
=
null
showCallBack
=
null
adState
.
onAdDisplayFailed
()
adState
.
onAdDisplayFailed
()
(
adEvent
as
AdmobEvent
)
.
adShowError
(
adError
)
adEvent
?
.
adShowError
(
adError
)
}
}
...
@@ -110,7 +128,7 @@ class AdOpenMgr {
...
@@ -110,7 +128,7 @@ class AdOpenMgr {
}
}
override
fun
onAdClicked
()
{
override
fun
onAdClicked
()
{
(
adEvent
as
AdmobEvent
)
.
clickAd
(
this
@run
.
responseInfo
)
adEvent
?
.
clickAd
(
this
@run
.
responseInfo
)
//计数
//计数
LimitUtils
.
addClickNum
()
LimitUtils
.
addClickNum
()
}
}
...
@@ -135,6 +153,15 @@ class AdOpenMgr {
...
@@ -135,6 +153,15 @@ class AdOpenMgr {
}
}
}
}
//避免无效预加载
if
(
adState
.
loadingAd
&&
loadCallBack
==
null
&&
loadingCallBack
==
null
)
{
//容错机制
adState
.
loadingAd
=
false
return
}
adState
.
loadingAd
=
true
adState
.
currentAdEvent
=
adEvent
adEvent
.
adPulStart
()
adEvent
.
adPulStart
()
AppOpenAd
.
load
(
AppOpenAd
.
load
(
...
@@ -143,8 +170,12 @@ class AdOpenMgr {
...
@@ -143,8 +170,12 @@ class AdOpenMgr {
AdRequest
.
Builder
().
build
(),
AdRequest
.
Builder
().
build
(),
object
:
AppOpenAd
.
AppOpenAdLoadCallback
()
{
object
:
AppOpenAd
.
AppOpenAdLoadCallback
()
{
override
fun
onAdLoaded
(
appOpenAd
:
AppOpenAd
)
{
override
fun
onAdLoaded
(
appOpenAd
:
AppOpenAd
)
{
adState
.
onAdLoaded
(
appOpenAd
)
adState
.
onAdLoaded
(
appOpenAd
,
adEvent
)
loadCallBack
?.
invoke
()
loadCallBack
?.
invoke
()
loadingCallBack
?.
invoke
()
loadingCallBack
=
null
(
adEvent
as
AdmobEvent
).
pullAd
(
appOpenAd
.
responseInfo
)
(
adEvent
as
AdmobEvent
).
pullAd
(
appOpenAd
.
responseInfo
)
appOpenAd
.
onPaidEventListener
=
AdmobOnPaidEventListener
(
appOpenAd
,
adEvent
.
scope
)
appOpenAd
.
onPaidEventListener
=
AdmobOnPaidEventListener
(
appOpenAd
,
adEvent
.
scope
)
LimitUtils
.
addRequestNum
()
LimitUtils
.
addRequestNum
()
...
@@ -160,5 +191,4 @@ class AdOpenMgr {
...
@@ -160,5 +191,4 @@ class AdOpenMgr {
)
)
}
}
private
fun
adAvailable
()
=
((
System
.
currentTimeMillis
()
-
adState
.
lastLoadTime
)
/
1000
/
60
).
toInt
()
<
30
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/business/ads/admob/AdmobEvent.kt
View file @
126e5240
...
@@ -27,7 +27,6 @@ import com.google.firebase.analytics.ktx.analytics
...
@@ -27,7 +27,6 @@ import com.google.firebase.analytics.ktx.analytics
import
com.google.firebase.ktx.Firebase
import
com.google.firebase.ktx.Firebase
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.SupervisorJob
import
kotlinx.coroutines.SupervisorJob
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
org.json.JSONObject
import
org.json.JSONObject
...
...
app/src/main/java/com/base/appzxhy/business/ads/applovin/MaxInsertMgr.kt
View file @
126e5240
...
@@ -145,7 +145,7 @@ class MaxInsertMgr {
...
@@ -145,7 +145,7 @@ class MaxInsertMgr {
override
fun
onAdDisplayFailed
(
p0
:
MaxAd
,
p1
:
MaxError
)
=
Unit
override
fun
onAdDisplayFailed
(
p0
:
MaxAd
,
p1
:
MaxError
)
=
Unit
override
fun
onAdLoaded
(
ad
:
MaxAd
)
{
override
fun
onAdLoaded
(
ad
:
MaxAd
)
{
adState
.
onAdLoaded
(
null
)
adState
.
onAdLoaded
(
null
,
adEvent
)
val
ac
=
adState
.
activityRef
?.
get
()
val
ac
=
adState
.
activityRef
?.
get
()
if
(
ac
!=
null
)
{
if
(
ac
!=
null
)
{
show
(
ac
,
isUnLimit
,
adEvent
,
null
)
show
(
ac
,
isUnLimit
,
adEvent
,
null
)
...
...
app/src/main/java/com/base/appzxhy/business/ads/applovin/MaxOpenMgr.kt
View file @
126e5240
...
@@ -126,7 +126,7 @@ class MaxOpenMgr {
...
@@ -126,7 +126,7 @@ class MaxOpenMgr {
adState
.
currentAd
=
MaxAppOpenAd
(
GlobalConfig
.
ID_MAX_OPEN
,
context
)
adState
.
currentAd
=
MaxAppOpenAd
(
GlobalConfig
.
ID_MAX_OPEN
,
context
)
adState
.
currentAd
?.
setListener
(
object
:
MaxAdListener
{
adState
.
currentAd
?.
setListener
(
object
:
MaxAdListener
{
override
fun
onAdLoaded
(
ad
:
MaxAd
)
{
override
fun
onAdLoaded
(
ad
:
MaxAd
)
{
adState
.
onAdLoaded
(
null
)
adState
.
onAdLoaded
(
null
,
adEvent
)
val
ac
=
adState
.
activityRef
?.
get
()
val
ac
=
adState
.
activityRef
?.
get
()
if
(
ac
!=
null
)
{
if
(
ac
!=
null
)
{
show
(
ac
,
isUnLimit
,
adEvent
,
null
)
show
(
ac
,
isUnLimit
,
adEvent
,
null
)
...
...
app/src/main/java/com/base/appzxhy/ui/guide/GuideCleanActivity.kt
View file @
126e5240
...
@@ -11,12 +11,14 @@ class GuideCleanActivity : BaseActivity<ActivityGuideCleanBinding>(ActivityGuide
...
@@ -11,12 +11,14 @@ class GuideCleanActivity : BaseActivity<ActivityGuideCleanBinding>(ActivityGuide
override
fun
initView
()
{
override
fun
initView
()
{
super
.
initView
()
super
.
initView
()
changeLanguage
(
this
)
val
flag
=
changeLanguage
(
this
)
if
(!
flag
)
{
changeNative
()
}
}
}
override
fun
initListener
()
{
override
fun
initListener
()
{
super
.
initListener
()
super
.
initListener
()
changeNative
()
binding
.
llPhoto
.
setOnClickListener
{
binding
.
llPhoto
.
setOnClickListener
{
binding
.
iv1
.
isSelected
=
!
binding
.
iv1
.
isSelected
binding
.
iv1
.
isSelected
=
!
binding
.
iv1
.
isSelected
changeNative
()
changeNative
()
...
@@ -48,8 +50,10 @@ class GuideCleanActivity : BaseActivity<ActivityGuideCleanBinding>(ActivityGuide
...
@@ -48,8 +50,10 @@ class GuideCleanActivity : BaseActivity<ActivityGuideCleanBinding>(ActivityGuide
private
fun
changeNative
()
{
private
fun
changeNative
()
{
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_native_custom
)
{
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_native_custom
)
{
binding
.
flAd
.
removeAllViews
()
if
(
it
==
null
)
{
binding
.
flAd
.
visibility
=
View
.
VISIBLE
binding
.
flAd
.
removeAllViews
()
binding
.
flAd
.
visibility
=
View
.
VISIBLE
}
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/ui/language/LanguageActivity.kt
View file @
126e5240
...
@@ -71,7 +71,7 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>(ActivityLanguageB
...
@@ -71,7 +71,7 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>(ActivityLanguageB
appLanguageSp
=
selectLanguageBean
.
language
appLanguageSp
=
selectLanguageBean
.
language
appLanguageCountrySp
=
selectLanguageBean
.
country
appLanguageCountrySp
=
selectLanguageBean
.
country
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
AdsMgr
.
showInsert
(
this
,
true
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
next
()
{
override
fun
next
()
{
goToAc
(
GuideCleanActivity
::
class
.
java
)
goToAc
(
GuideCleanActivity
::
class
.
java
)
finish
()
finish
()
...
...
app/src/main/java/com/base/appzxhy/ui/splash/SplashActivity.kt
View file @
126e5240
...
@@ -92,7 +92,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
...
@@ -92,7 +92,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
jumpNext
()
jumpNext
()
}
}
viewModel
.
onTick
=
{
s
,
t
,
p
->
viewModel
.
onTick
=
{
s
,
t
,
p
->
Log
.
e
(
TAG
,
"onTick $s $t"
)
//
Log.e(TAG, "onTick $s $t")
binding
.
progressBar
.
setProgress
(
p
.
toInt
(),
false
)
binding
.
progressBar
.
setProgress
(
p
.
toInt
(),
false
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment