Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
SuperEasyClean
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
songjianyu
SuperEasyClean
Commits
49bc8ed4
Commit
49bc8ed4
authored
Jun 06, 2025
by
wanglei
Committed by
songjianyu
Jun 09, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[修改]将开屏和插页共用上次展示时间字段,避免开屏和插页连弹
parent
ab87117d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
12 deletions
+22
-12
AdConfigBean.kt
...rc/main/java/com/base/appzxhy/bean/config/AdConfigBean.kt
+1
-1
AdState.kt
app/src/main/java/com/base/appzxhy/business/ads/AdState.kt
+5
-3
LimitUtils.kt
...src/main/java/com/base/appzxhy/business/ads/LimitUtils.kt
+12
-4
AdInterMgr.kt
...in/java/com/base/appzxhy/business/ads/admob/AdInterMgr.kt
+1
-1
AdOpenMgr.kt
...ain/java/com/base/appzxhy/business/ads/admob/AdOpenMgr.kt
+1
-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
No files found.
app/src/main/java/com/base/appzxhy/bean/config/AdConfigBean.kt
View file @
49bc8ed4
...
@@ -11,7 +11,7 @@ class AdConfigBean(
...
@@ -11,7 +11,7 @@ class AdConfigBean(
var
numDisplayLimit
:
Int
=
-
1
,
//展示次数限制
var
numDisplayLimit
:
Int
=
-
1
,
//展示次数限制
var
numRequestLimit
:
Int
=
-
1
,
//请求次数限制
var
numRequestLimit
:
Int
=
-
1
,
//请求次数限制
var
numClickLimit
:
Int
=
-
1
,
//点击次数限制
var
numClickLimit
:
Int
=
-
1
,
//点击次数限制
var
timeInterval
:
Int
=
1
,
//广告间隔
var
timeInterval
:
Int
=
1
0
,
//广告间隔秒
var
openAdLoading
:
Int
=
15
,
//开屏广告拉取时间
var
openAdLoading
:
Int
=
15
,
//开屏广告拉取时间
var
fullNativeShow
:
Boolean
=
true
,
//显示全屏原生
var
fullNativeShow
:
Boolean
=
true
,
//显示全屏原生
...
...
app/src/main/java/com/base/appzxhy/business/ads/AdState.kt
View file @
49bc8ed4
...
@@ -2,6 +2,8 @@ package com.base.appzxhy.business.ads
...
@@ -2,6 +2,8 @@ package com.base.appzxhy.business.ads
import
android.app.Activity
import
android.app.Activity
import
android.app.Dialog
import
android.app.Dialog
import
com.base.appzxhy.business.ads.LimitUtils.openInterLastShowTime
import
com.base.appzxhy.utils.AppPreferences
import
java.lang.ref.WeakReference
import
java.lang.ref.WeakReference
...
@@ -34,7 +36,7 @@ class AdState<T>() {
...
@@ -34,7 +36,7 @@ class AdState<T>() {
/**
/**
* 上次展示时间
* 上次展示时间
*/
*/
var
lastShowTime
:
Long
=
0
//
var lastShowTime: Long = 0
/**
/**
...
@@ -47,13 +49,13 @@ class AdState<T>() {
...
@@ -47,13 +49,13 @@ class AdState<T>() {
adDialog
?.
dismiss
()
adDialog
?.
dismiss
()
adDialog
=
null
adDialog
=
null
l
astShowTime
=
System
.
currentTimeMillis
()
openInterL
astShowTime
=
System
.
currentTimeMillis
()
}
}
fun
onAdHidden
()
{
fun
onAdHidden
()
{
//重置下上次展示的时间,避免看广告的时间算入间隔
//重置下上次展示的时间,避免看广告的时间算入间隔
l
astShowTime
=
System
.
currentTimeMillis
()
openInterL
astShowTime
=
System
.
currentTimeMillis
()
}
}
...
...
app/src/main/java/com/base/appzxhy/business/ads/LimitUtils.kt
View file @
49bc8ed4
...
@@ -145,14 +145,22 @@ object LimitUtils {
...
@@ -145,14 +145,22 @@ object LimitUtils {
/**
/**
* 开屏和插页广告的显示间隔限制
* 开屏和插页广告的显示间隔限制
*
* @param lastTime 上一次显示的时间
*/
*/
fun
isIntervalLimited
(
lastTime
:
Long
,
adEvent
:
AdEvent
):
Boolean
{
fun
isIntervalLimited
(
adEvent
:
AdEvent
):
Boolean
{
val
flag
=
((
System
.
currentTimeMillis
()
-
last
Time
)
/
1000
).
toInt
()
<
(
AdConfigBean
.
adsConfigBean
.
timeInterval
)
val
flag
=
((
System
.
currentTimeMillis
()
-
openInterLastShow
Time
)
/
1000
).
toInt
()
<
(
AdConfigBean
.
adsConfigBean
.
timeInterval
)
if
(
flag
)
{
if
(
flag
)
{
adEvent
.
adShowError
(
"ad in timeInterval"
)
adEvent
.
adShowError
(
"ad in timeInterval"
)
}
}
return
flag
return
flag
}
}
//开屏和插页上一次展示时间共用,避免开屏插页连弹
var
openInterLastShowTime
=
0L
get
()
{
return
AppPreferences
.
getInstance
().
getLong
(
"openInterLastShowTime"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"openInterLastShowTime"
,
value
,
true
)
}
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/business/ads/admob/AdInterMgr.kt
View file @
49bc8ed4
...
@@ -45,7 +45,7 @@ class AdInterMgr {
...
@@ -45,7 +45,7 @@ class AdInterMgr {
showCallBack
?.
failed
(
2
)
showCallBack
?.
failed
(
2
)
return
return
}
}
if
(
LimitUtils
.
isIntervalLimited
(
adState
.
lastShowTime
,
adEvent
))
{
if
(
LimitUtils
.
isIntervalLimited
(
adEvent
))
{
showCallBack
?.
failed
(
3
)
showCallBack
?.
failed
(
3
)
return
return
}
}
...
...
app/src/main/java/com/base/appzxhy/business/ads/admob/AdOpenMgr.kt
View file @
49bc8ed4
...
@@ -36,7 +36,7 @@ class AdOpenMgr {
...
@@ -36,7 +36,7 @@ class AdOpenMgr {
showCallBack
?.
failed
()
showCallBack
?.
failed
()
return
return
}
}
if
(
LimitUtils
.
isIntervalLimited
(
ad
State
.
lastShowTime
,
ad
Event
))
{
if
(
LimitUtils
.
isIntervalLimited
(
adEvent
))
{
showCallBack
?.
failed
()
showCallBack
?.
failed
()
return
return
}
}
...
...
app/src/main/java/com/base/appzxhy/business/ads/applovin/MaxInsertMgr.kt
View file @
49bc8ed4
...
@@ -50,7 +50,7 @@ class MaxInsertMgr {
...
@@ -50,7 +50,7 @@ class MaxInsertMgr {
showCallBack
?.
failed
(
3
)
showCallBack
?.
failed
(
3
)
return
return
}
}
if
(
LimitUtils
.
isIntervalLimited
(
ad
State
.
lastShowTime
,
ad
Event
))
{
if
(
LimitUtils
.
isIntervalLimited
(
adEvent
))
{
showCallBack
?.
failed
(
4
)
showCallBack
?.
failed
(
4
)
return
return
}
}
...
...
app/src/main/java/com/base/appzxhy/business/ads/applovin/MaxOpenMgr.kt
View file @
49bc8ed4
...
@@ -40,7 +40,7 @@ class MaxOpenMgr {
...
@@ -40,7 +40,7 @@ class MaxOpenMgr {
showCallBack
?.
failed
()
showCallBack
?.
failed
()
return
return
}
}
if
(
LimitUtils
.
isIntervalLimited
(
ad
State
.
lastShowTime
,
ad
Event
))
{
if
(
LimitUtils
.
isIntervalLimited
(
adEvent
))
{
showCallBack
?.
failed
()
showCallBack
?.
failed
()
return
return
}
}
...
...
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