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
f4988def
Commit
f4988def
authored
Jun 27, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[优化]测试
parent
3bb99921
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
18 deletions
+22
-18
AdState.kt
...rc/main/java/com/dumpster/cleaner/business/ads/AdState.kt
+1
-3
AdsMgr.kt
...src/main/java/com/dumpster/cleaner/business/ads/AdsMgr.kt
+1
-1
LimitUtils.kt
...main/java/com/dumpster/cleaner/business/ads/LimitUtils.kt
+14
-5
AdInterMgr.kt
...ava/com/dumpster/cleaner/business/ads/admob/AdInterMgr.kt
+3
-4
AdOpenMgr.kt
...java/com/dumpster/cleaner/business/ads/admob/AdOpenMgr.kt
+2
-3
SplashActivity.kt
...ain/java/com/dumpster/cleaner/ui/splash/SplashActivity.kt
+1
-2
No files found.
app/src/main/java/com/dumpster/cleaner/business/ads/AdState.kt
View file @
f4988def
...
...
@@ -5,7 +5,6 @@ import com.dumpster.cleaner.business.ads.AdsType.Companion.INSERT
import
com.dumpster.cleaner.business.ads.AdsType.Companion.OPEN
import
com.dumpster.cleaner.business.ads.LimitUtils.interLastShowTime
import
com.dumpster.cleaner.business.ads.LimitUtils.openLastShowTime
import
com.dumpster.cleaner.utils.LogEx
class
AdState
<
T
>()
{
...
...
@@ -94,8 +93,7 @@ class AdState<T>() {
}
fun
adAvailable
()
=
currentAd
!=
null
||
((
System
.
currentTimeMillis
()
-
lastLoadTime
)
/
1000
/
60
).
toInt
()
<
30
fun
needLoad
()
=
currentAd
==
null
||
((
System
.
currentTimeMillis
()
-
lastLoadTime
)
/
1000
/
60
).
toInt
()
>
30
}
app/src/main/java/com/dumpster/cleaner/business/ads/AdsMgr.kt
View file @
f4988def
...
...
@@ -243,7 +243,7 @@ object AdsMgr {
@LayoutRes
layout
:
Int
,
nativeCallBack
:
((
Any
?)
->
Unit
)?
=
null
)
{
if
(!
adsConfigBean
.
isAdShow
)
{
if
(!
adsConfigBean
.
isAdShow
||
!
LimitUtils
.
isShowNative
(
AdsType
.
NATIVE
,
null
)
)
{
nativeView
.
visibility
=
View
.
GONE
nativeCallBack
?.
invoke
(
null
)
return
...
...
app/src/main/java/com/dumpster/cleaner/business/ads/LimitUtils.kt
View file @
f4988def
...
...
@@ -5,6 +5,7 @@ import com.dumpster.cleaner.BuildConfig
import
com.dumpster.cleaner.bean.config.AdConfigBean
import
com.dumpster.cleaner.utils.AppPreferences
import
com.dumpster.cleaner.utils.KotlinExt.toFormatTime4
import
com.dumpster.cleaner.utils.LogEx
/**
...
...
@@ -155,8 +156,10 @@ object LimitUtils {
* 开屏限制
*/
fun
isIntervalOpenLimit
(
adEvent
:
AdEvent
):
Boolean
{
val
flag
=
((
System
.
currentTimeMillis
()
-
openLastShowTime
)
/
1000
).
toInt
()
<
(
AdConfigBean
.
adsConfigBean
.
timeIntervalOpen
)
Log
.
e
(
adEvent
.
TAG
,
"open isIntervalOpenLimit=$flag"
)
val
passTime
=
((
System
.
currentTimeMillis
()
-
openLastShowTime
)
/
1000
).
toInt
()
val
interval
=
AdConfigBean
.
adsConfigBean
.
timeIntervalOpen
val
flag
=
passTime
<
interval
Log
.
e
(
adEvent
.
TAG
,
"open isIntervalOpenLimit=$flag passTime=$passTime interval=$interval"
)
if
(
flag
)
{
adEvent
.
adShowError
(
"ad in timeInterval"
)
}
...
...
@@ -169,7 +172,7 @@ object LimitUtils {
fun
isIntervalInterLimit
(
adEvent
:
AdEvent
):
Boolean
{
val
passTime
=
((
System
.
currentTimeMillis
()
-
interLastShowTime
)
/
1000
).
toInt
()
val
interval
=
AdConfigBean
.
adsConfigBean
.
timeInterval
val
flag
=
passTime
<
(
interval
)
val
flag
=
passTime
<
interval
Log
.
e
(
adEvent
.
TAG
,
"inter isIntervalInterLimit=$flag interLastShowTime=$interLastShowTime passTime=$passTime interval=$interval"
...
...
@@ -219,10 +222,16 @@ object LimitUtils {
AppPreferences
.
getInstance
().
put
(
NUM_NATIVE_DISPLAY
,
0
)
}
val
flag
=
isNativeLimited
val
todayNumber
=
AppPreferences
.
getInstance
().
getInt
(
NUM_NATIVE_DISPLAY
,
0
)
val
max
=
AdConfigBean
.
adsConfigBean
.
numNativeDisplayLimit
LogEx
.
logDebug
(
adEvent
?.
TAG
?:
""
,
"native todayNumber=$todayNumber max=$max "
)
if
(
flag
)
{
val
value
=
"current${getAdEventMsg(adsType)} "
+
"show=${
AppPreferences.getInstance().getInt(NUM_NATIVE_DISPLAY, 0)
} "
+
"${getAdEventMsg(adsType).lowercase()}_"
+
"max_show=${
AdConfigBean.adsConfigBean.numNativeDisplayLimit
}"
"show=${
todayNumber
} "
+
"${getAdEventMsg(adsType).lowercase()}_"
+
"max_show=${
max
}"
adEvent
?.
adLimited
(
value
)
}
return
!
flag
...
...
app/src/main/java/com/dumpster/cleaner/business/ads/admob/AdInterMgr.kt
View file @
f4988def
...
...
@@ -12,7 +12,6 @@ import com.dumpster.cleaner.business.ads.AdState
import
com.dumpster.cleaner.business.ads.AdsShowCallBack
import
com.dumpster.cleaner.business.ads.AdsType
import
com.dumpster.cleaner.business.ads.AdsType.Companion.INSERT
import
com.dumpster.cleaner.business.ads.AdsType.Companion.OPEN
import
com.dumpster.cleaner.business.ads.LimitUtils
import
com.dumpster.cleaner.business.ads.admob.AdmobEvent.AdmobOnPaidEventListener
import
com.dumpster.cleaner.utils.LogEx
...
...
@@ -61,7 +60,7 @@ class AdInterMgr {
}
val
needLoad
=
!
adState
.
adAvailable
()
val
needLoad
=
adState
.
needLoad
()
this
.
showCallBack
=
showCallBack
if
(
adState
.
adDialog
==
null
)
{
...
...
@@ -103,9 +102,9 @@ class AdInterMgr {
val
admobEvent
=
(
adEvent
as
AdmobEvent
)
val
tag
=
adEvent
.
TAG
LogEx
.
logDebug
(
tag
,
"showReadyAd ac=${ac.javaClass.simpleName} currentAd=${adState.currentAd}"
)
LogEx
.
logDebug
(
tag
,
"
inter
showReadyAd ac=${ac.javaClass.simpleName} currentAd=${adState.currentAd}"
)
if
(
ac
.
isFinishing
||
ac
.
isDestroyed
||
adState
.
currentAd
==
null
)
{
LogEx
.
logDebug
(
tag
,
"showReadyAd ac=null isFinishing isDestroyed"
)
LogEx
.
logDebug
(
tag
,
"
inter
showReadyAd ac=null isFinishing isDestroyed"
)
showCallBack
?.
failed
()
adState
.
onAdDisplayFailed
()
return
...
...
app/src/main/java/com/dumpster/cleaner/business/ads/admob/AdOpenMgr.kt
View file @
f4988def
...
...
@@ -8,7 +8,6 @@ import com.dumpster.cleaner.business.ads.AdEvent
import
com.dumpster.cleaner.business.ads.AdState
import
com.dumpster.cleaner.business.ads.AdsShowCallBack
import
com.dumpster.cleaner.business.ads.AdsType
import
com.dumpster.cleaner.business.ads.AdsType.Companion.INSERT
import
com.dumpster.cleaner.business.ads.AdsType.Companion.OPEN
import
com.dumpster.cleaner.business.ads.LimitUtils
import
com.dumpster.cleaner.business.ads.admob.AdmobEvent.AdmobOnPaidEventListener
...
...
@@ -53,7 +52,7 @@ class AdOpenMgr {
}
}
val
needLoad
=
!
adState
.
adAvailable
()
val
needLoad
=
adState
.
needLoad
()
this
.
showCallBack
=
showCallBack
adEvent
.
adPrepareShow
()
...
...
@@ -88,7 +87,7 @@ class AdOpenMgr {
val
admobEvent
=
(
adEvent
as
AdmobEvent
)
if
(
ac
.
isFinishing
||
ac
.
isDestroyed
||
adState
.
currentAd
==
null
)
{
LogEx
.
logDebug
(
TAG
,
"
showReadyAd ac=null isFinishing isDestroyed"
)
LogEx
.
logDebug
(
adEvent
.
TAG
,
"open
showReadyAd ac=null isFinishing isDestroyed"
)
return
}
...
...
app/src/main/java/com/dumpster/cleaner/ui/splash/SplashActivity.kt
View file @
f4988def
...
...
@@ -191,11 +191,10 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
// binding.progressBar.setProgress(100.0)
binding
.
root
.
postDelayed
({
jumpNext
()
},
250
)
}
LogEx
.
logDebug
(
"AdmobEvent"
,
"
inter adShowed=${adShowed}
"
)
LogEx
.
logDebug
(
"AdmobEvent"
,
"
open adShowed=${adShowed} inter
"
)
if
(
adShowed
)
{
action
.
invoke
()
}
else
{
LogEx
.
logDebug
(
"AdmobEvent"
,
"inter open show inter"
)
AdsMgr
.
showInsert
(
this
@SplashActivity
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
next
()
{
action
.
invoke
()
...
...
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