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
bf1c775b
Commit
bf1c775b
authored
Jun 18, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[商业化]上报链
parent
b3860549
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
47 additions
and
34 deletions
+47
-34
AdEvent.kt
app/src/main/java/com/base/appzxhy/business/ads/AdEvent.kt
+4
-4
AdsMgr.kt
app/src/main/java/com/base/appzxhy/business/ads/AdsMgr.kt
+4
-4
AdsShowCallBack.kt
...ain/java/com/base/appzxhy/business/ads/AdsShowCallBack.kt
+13
-3
LimitUtils.kt
...src/main/java/com/base/appzxhy/business/ads/LimitUtils.kt
+2
-2
AdInterMgr.kt
...in/java/com/base/appzxhy/business/ads/admob/AdInterMgr.kt
+16
-11
AdOpenMgr.kt
...ain/java/com/base/appzxhy/business/ads/admob/AdOpenMgr.kt
+2
-5
AdmobEvent.kt
...in/java/com/base/appzxhy/business/ads/admob/AdmobEvent.kt
+4
-4
SplashActivity.kt
...rc/main/java/com/base/appzxhy/ui/splash/SplashActivity.kt
+1
-0
activity_screenshot_clean.xml
app/src/main/res/layout/activity_screenshot_clean.xml
+1
-1
No files found.
app/src/main/java/com/base/appzxhy/business/ads/AdEvent.kt
View file @
bf1c775b
...
...
@@ -26,25 +26,25 @@ abstract class AdEvent {
var
adUnit
:
String
=
""
var
from
:
String
=
""
va
l
reqId
=
UUID
.
randomUUID
().
toString
()
va
r
reqId
=
UUID
.
randomUUID
().
toString
()
var
isUnLimit
:
Boolean
=
false
fun
adPrepareShow
()
{
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
adUnit
)
obj1
.
put
(
"req_id"
,
reqId
)
obj1
.
put
(
"from"
,
from
)
obj1
.
put
(
"req_id"
,
reqId
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
LogEx
.
logDebug
(
TAG
,
"ad_prepare_show_$adUnit $obj1"
)
}
fun
adPulStart
()
{
val
obj
=
JSONObject
()
obj
.
put
(
"req_id"
,
reqId
)
obj
.
put
(
"ad_unit"
,
adUnit
)
obj
.
put
(
"ad_type"
,
adUnit
)
obj
.
put
(
"from"
,
from
)
obj
.
put
(
"req_id"
,
reqId
)
obj
.
put
(
"ad_type"
,
adUnit
)
EventUtils
.
event
(
"ad_pull_start"
,
ext
=
obj
)
LogEx
.
logDebug
(
TAG
,
"ad_pull_start_$adUnit $obj"
)
}
...
...
app/src/main/java/com/base/appzxhy/business/ads/AdsMgr.kt
View file @
bf1c775b
...
...
@@ -182,13 +182,13 @@ object AdsMgr {
val
from
=
activity
::
class
.
java
.
simpleName
if
(
adsConfigBean
.
adSwitch
)
{
val
admobEvent
=
AdmobEvent
(
"openAd"
,
from
)
val
admobEvent
=
AdmobEvent
(
"openAd"
,
from
)
.
apply
{
this
.
isUnLimit
=
isUnLimit
}
if
(
isAdmobInit
)
{
adOpenMgr
.
show
(
activity
,
isUnLimit
,
admobEvent
,
showCallBack
)
adOpenMgr
.
show
(
activity
,
admobEvent
,
showCallBack
)
}
else
{
admobInitCallBack
=
{
}
adOpenMgr
.
show
(
activity
,
isUnLimit
,
admobEvent
,
showCallBack
)
adOpenMgr
.
show
(
activity
,
admobEvent
,
showCallBack
)
}
}
else
{
if
(
isMaxInit
)
{
...
...
@@ -229,7 +229,7 @@ object AdsMgr {
LogEx
.
logDebug
(
"showAd"
,
"adSwitch=${adsConfigBean.adSwitch}"
)
val
from
=
activity
::
class
.
java
.
simpleName
if
(
adsConfigBean
.
adSwitch
)
{
adInterMgr
.
show
(
activity
,
isUnLimit
,
AdmobEvent
(
"interAd"
,
from
)
,
showCallBack
)
adInterMgr
.
show
(
activity
,
AdmobEvent
(
"interAd"
,
from
).
apply
{
this
.
isUnLimit
=
isUnLimit
}
,
showCallBack
)
}
else
{
maxInsertMgr
.
show
(
activity
,
isUnLimit
,
AdMaxEvent
(
"interAd"
,
from
),
showCallBack
)
}
...
...
app/src/main/java/com/base/appzxhy/business/ads/AdsShowCallBack.kt
View file @
bf1c775b
...
...
@@ -3,6 +3,7 @@ package com.base.appzxhy.business.ads
abstract
class
AdsShowCallBack
{
var
adShowed
:
Boolean
=
false
var
nextCalled
:
Boolean
=
false
open
fun
show
()
{
adShowed
=
true
...
...
@@ -10,18 +11,27 @@ abstract class AdsShowCallBack {
open
fun
failed
(
where
:
Int
=
0
)
{
adShowed
=
false
if
(!
nextCalled
)
{
nextCalled
=
true
next
()
}
}
open
fun
adFailed
(
where
:
Int
=
0
)
{
adShowed
=
false
if
(!
nextCalled
)
{
nextCalled
=
true
next
()
}
}
open
fun
close
(
where
:
Int
=
0
)
{
adShowed
=
false
if
(!
nextCalled
)
{
nextCalled
=
true
next
()
}
}
abstract
fun
next
()
...
...
app/src/main/java/com/base/appzxhy/business/ads/LimitUtils.kt
View file @
bf1c775b
...
...
@@ -146,10 +146,10 @@ object LimitUtils {
/**
* 开屏和插页广告的显示间隔限制
*/
fun
isIntervalLimited
(
adEvent
:
AdEvent
):
Boolean
{
fun
isIntervalLimited
(
adEvent
:
AdEvent
?
):
Boolean
{
val
flag
=
((
System
.
currentTimeMillis
()
-
openInterLastShowTime
)
/
1000
).
toInt
()
<
(
AdConfigBean
.
adsConfigBean
.
timeInterval
)
if
(
flag
)
{
adEvent
.
adShowError
(
"ad in timeInterval"
)
adEvent
?
.
adShowError
(
"ad in timeInterval"
)
}
return
flag
}
...
...
app/src/main/java/com/base/appzxhy/business/ads/admob/AdInterMgr.kt
View file @
bf1c775b
...
...
@@ -36,20 +36,17 @@ class AdInterMgr {
fun
show
(
activity
:
Activity
,
isUnLimit
:
Boolean
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?
=
null
)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
showCallBack
?.
failed
(
0
)
adState
.
onAdDisplayFailed
()
return
}
val
nowAdEvent
=
ad
State
.
currentAdEvent
?:
ad
Event
nowAdEvent
.
from
=
adEvent
.
from
nowAdEvent
.
isUnLimit
=
isUnLimit
val
nowAdEvent
=
adEvent
//currentAdEvent!=null 有缓存广告,关联reqId
adState
.
currentAdEvent
?.
let
{
nowAdEvent
.
reqId
=
it
.
reqId
}
if
(!
nowAdEvent
.
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
INSERT
,
nowAdEvent
))
{
...
...
@@ -73,13 +70,14 @@ class AdInterMgr {
adState
.
adDialog
?.
dismiss
()
}
nowAdEvent
.
adPrepareShow
()
LogEx
.
logDebug
(
adEvent
.
TAG
,
"needLoad=$needLoad"
)
if
(
needLoad
)
{
if
(!
adState
.
loadingAd
)
{
LogEx
.
logDebug
(
adEvent
.
TAG
,
"inter adState !loadingAd"
)
loadAd
(
activity
,
a
dEvent
)
{
loadAd
(
activity
,
nowA
dEvent
)
{
showReadyAd
()
}
}
else
{
...
...
@@ -99,10 +97,14 @@ class AdInterMgr {
private
fun
showReadyAd
()
{
val
ac
=
adState
.
activityRef
?.
get
()
LogEx
.
logDebug
(
"AdmobEvent"
,
"inter showReadyAd ac=$ac currentAd=${adState.currentAd}"
)
if
(
ac
==
null
||
ac
.
isFinishing
||
ac
.
isDestroyed
)
{
LogEx
.
logDebug
(
TAG
,
"showReadyAd ac=null isFinishing isDestroyed"
)
showCallBack
?.
failed
()
adState
.
onAdDisplayFailed
()
return
}
adState
.
currentAd
?.
run
{
val
adEvent
=
(
adState
.
currentAdEvent
as
AdmobEvent
?)
...
...
@@ -149,11 +151,11 @@ class AdInterMgr {
}
val
activity
=
adState
.
activityRef
?.
get
()
activity
?.
let
{
if
(
AdConfigBean
.
adsConfigBean
.
showCountdown
){
if
(
AdConfigBean
.
adsConfigBean
.
showCountdown
)
{
createUICountdownTimer
(
adState
.
adDialog
)
{
show
(
it
)
}
}
else
{
}
else
{
show
(
it
)
}
}
...
...
@@ -182,7 +184,6 @@ class AdInterMgr {
}
adState
.
loadingAd
=
true
adState
.
currentAdEvent
=
adEvent
adEvent
.
adPulStart
()
InterstitialAd
.
load
(
...
...
@@ -202,9 +203,13 @@ class AdInterMgr {
override
fun
onAdFailedToLoad
(
loadAdError
:
LoadAdError
)
{
adState
.
onAdLoadFailed
()
(
adEvent
as
AdmobEvent
).
pullAd
(
loadAdError
.
responseInfo
,
loadAdError
)
if
(
loadCallBack
!=
null
)
{
adState
.
onAdDisplayFailed
()
}
showCallBack
?.
adFailed
()
showCallBack
=
null
(
adEvent
as
AdmobEvent
).
pullAd
(
loadAdError
.
responseInfo
,
loadAdError
)
}
}
)
...
...
app/src/main/java/com/base/appzxhy/business/ads/admob/AdOpenMgr.kt
View file @
bf1c775b
...
...
@@ -32,7 +32,6 @@ class AdOpenMgr {
fun
show
(
activity
:
Activity
,
isUnLimit
:
Boolean
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?
)
{
...
...
@@ -40,9 +39,8 @@ class AdOpenMgr {
return
}
val
nowAdEvent
=
adState
.
currentAdEvent
?:
adEvent
nowAdEvent
.
from
=
adEvent
.
from
nowAdEvent
.
isUnLimit
=
isUnLimit
val
nowAdEvent
=
adEvent
adState
.
currentAdEvent
?.
let
{
nowAdEvent
.
reqId
=
it
.
reqId
}
if
(!
nowAdEvent
.
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
OPEN
,
nowAdEvent
))
{
...
...
@@ -161,7 +159,6 @@ class AdOpenMgr {
}
adState
.
loadingAd
=
true
adState
.
currentAdEvent
=
adEvent
adEvent
.
adPulStart
()
AppOpenAd
.
load
(
...
...
app/src/main/java/com/base/appzxhy/business/ads/admob/AdmobEvent.kt
View file @
bf1c775b
...
...
@@ -51,6 +51,8 @@ class AdmobEvent : AdEvent {
)
=
scope
.
launch
{
var
key
=
"ad_pull"
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
adUnit
)
obj
.
put
(
"from"
,
from
)
obj
.
put
(
"req_id"
,
reqId
)
if
(
responseInfo
!=
null
)
{
val
response
=
responseInfo
.
adapterResponses
.
getOrNull
(
0
)
...
...
@@ -67,8 +69,6 @@ class AdmobEvent : AdEvent {
obj
.
put
(
"session_id"
,
responseInfo
.
responseId
)
}
obj
.
put
(
"networkname"
,
responseInfo
?.
mediationAdapterClassName
)
obj
.
put
(
"ad_unit"
,
adUnit
)
obj
.
put
(
"from"
,
from
)
if
(
error
==
null
)
{
obj
.
put
(
"status"
,
"1"
)
}
else
{
...
...
@@ -107,9 +107,10 @@ class AdmobEvent : AdEvent {
fun
showAd
(
responseInfo
:
ResponseInfo
?,
activity
:
Activity
?
=
null
)
=
scope
.
launch
{
val
response
=
responseInfo
?.
adapterResponses
?.
getOrNull
(
0
)
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
adUnit
)
obj
.
put
(
"from"
,
activity
?.
javaClass
?.
simpleName
)
obj
.
put
(
"req_id"
,
reqId
)
obj
.
put
(
"source"
,
response
?.
adSourceName
)
obj
.
put
(
"ad_unit"
,
adUnit
)
obj
.
put
(
"networkname"
,
responseInfo
?.
mediationAdapterClassName
)
val
credentials
=
mapOf
(
"placementid"
to
response
?.
credentials
?.
get
(
"placementid"
),
...
...
@@ -118,7 +119,6 @@ class AdmobEvent : AdEvent {
)
obj
.
put
(
"credentials"
,
credentials
.
toString
())
obj
.
put
(
"session_id"
,
responseInfo
?.
responseId
)
obj
.
put
(
"from"
,
activity
?.
javaClass
?.
simpleName
)
if
(
adUnit
!=
"nativeAd"
)
{
EventUtils
.
event
(
"ad_show"
,
ext
=
obj
)
}
else
{
...
...
app/src/main/java/com/base/appzxhy/ui/splash/SplashActivity.kt
View file @
bf1c775b
...
...
@@ -200,6 +200,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
if
(
this
.
adShowed
)
{
action
.
invoke
()
}
else
{
LogEx
.
logDebug
(
"AdmobEvent"
,
"inter open show inter"
)
AdsMgr
.
showInsert
(
this
@SplashActivity
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
next
()
{
action
.
invoke
()
...
...
app/src/main/res/layout/activity_screenshot_clean.xml
View file @
bf1c775b
...
...
@@ -77,7 +77,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:layout_marginBottom=
"
67dp
"
android:layout_marginBottom=
"
@dimen/dp_38
"
android:text=
"@string/screenshots_totally"
android:textColor=
"@color/white"
android:textSize=
"16sp"
...
...
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