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
1dad641d
Commit
1dad641d
authored
Jun 23, 2025
by
songjianyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加原生广告数量限制
parent
85314e0e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
15 deletions
+28
-15
LimitUtils.kt
app/src/main/java/com/easy/clean/business/ads/LimitUtils.kt
+1
-1
AdNativeMgr.kt
...ain/java/com/easy/clean/business/ads/admob/AdNativeMgr.kt
+25
-14
dialog_ad_countdown.xml
app/src/main/res/layout/dialog_ad_countdown.xml
+2
-0
No files found.
app/src/main/java/com/easy/clean/business/ads/LimitUtils.kt
View file @
1dad641d
...
@@ -56,7 +56,7 @@ object LimitUtils {
...
@@ -56,7 +56,7 @@ object LimitUtils {
.
getInt
(
NUM_DISPLAY
,
0
)
>=
maxCount
.
getInt
(
NUM_DISPLAY
,
0
)
>=
maxCount
}
}
/**
/**
* 广告展示是否到达限制
*
原生
广告展示是否到达限制
*/
*/
private
inline
val
isDisplayNativeLimited
:
Boolean
private
inline
val
isDisplayNativeLimited
:
Boolean
get
()
{
get
()
{
...
...
app/src/main/java/com/easy/clean/business/ads/admob/AdNativeMgr.kt
View file @
1dad641d
...
@@ -106,29 +106,40 @@ class AdNativeMgr {
...
@@ -106,29 +106,40 @@ class AdNativeMgr {
cacheItems
.
clear
()
cacheItems
.
clear
()
}
}
parent
.
isAdShowed
=
true
val
nativeAd
=
cacheItems
.
peek
()
val
nativeAd
=
cacheItems
.
peek
()
var
showAction
:
(
ad
:
NativeAd
)
->
Unit
=
{
ad
->
parent
.
isAdShowed
=
true
nativeCallBack
?.
invoke
(
ad
)
parent
.
setNativeAd
(
ad
,
layout
)
admobEvent
.
showAd
(
ad
.
responseInfo
)
//添加原生数量
LimitUtils
.
addNumNative
()
loadAd
(
MyApplication
.
appContext
,
AdmobEvent
(
"nativeAd"
,
"preload"
),
null
)
}
if
(
nativeAd
==
null
)
{
if
(
nativeAd
==
null
)
{
loadAd
(
parent
.
context
,
admobEvent
)
{
ad
->
loadAd
(
parent
.
context
,
admobEvent
)
{
ad
->
Log
.
e
(
TAG
,
"load show"
)
// Log.e(TAG, "load show")
nativeCallBack
?.
invoke
(
ad
)
// nativeCallBack?.invoke(ad)
parent
.
setNativeAd
(
ad
,
layout
)
// parent.setNativeAd(ad, layout)
admobEvent
.
showAd
(
ad
.
responseInfo
)
// admobEvent.showAd(ad.responseInfo)
//
loadAd
(
MyApplication
.
appContext
,
AdmobEvent
(
"nativeAd"
,
"preload"
),
null
)
// loadAd(MyApplication.appContext, AdmobEvent("nativeAd", "preload"), null)
showAction
.
invoke
(
ad
)
}
}
}
else
{
}
else
{
val
flag
=
cacheItems
.
remove
(
nativeAd
)
val
flag
=
cacheItems
.
remove
(
nativeAd
)
Log
.
e
(
TAG
,
"ready show remove=$flag size=${cacheItems.size}"
)
Log
.
e
(
TAG
,
"ready show remove=$flag size=${cacheItems.size}"
)
//
nativeCallBack
?.
invoke
(
nativeAd
)
// nativeCallBack?.invoke(nativeAd)
parent
.
setNativeAd
(
nativeAd
,
layout
)
// parent.setNativeAd(nativeAd, layout)
admobEvent
.
showAd
(
nativeAd
.
responseInfo
)
// admobEvent.showAd(nativeAd.responseInfo)
//
loadAd
(
MyApplication
.
appContext
,
AdmobEvent
(
"nativeAd"
,
"preload"
),
null
)
// loadAd(MyApplication.appContext, AdmobEvent("nativeAd", "preload"), null)
showAction
.
invoke
(
nativeAd
)
}
}
}
}
...
...
app/src/main/res/layout/dialog_ad_countdown.xml
View file @
1dad641d
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"30dp"
android:layout_marginTop=
"30dp"
android:layout_marginBottom=
"30dp"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<!-- <ImageView-->
<!-- <ImageView-->
...
@@ -50,6 +51,7 @@
...
@@ -50,6 +51,7 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_gravity=
"center_horizontal"
android:visibility=
"gone"
android:layout_marginTop=
"16dp"
android:layout_marginTop=
"16dp"
android:layout_marginBottom=
"24dp"
android:layout_marginBottom=
"24dp"
android:text=
"Ads are about to be shown"
android:text=
"Ads are about to be shown"
...
...
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