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
00cfa807
Commit
00cfa807
authored
Jun 11, 2025
by
wanglei
Committed by
songjianyu
Jun 12, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修复】 广告问题
parent
ad432fec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
277 additions
and
210 deletions
+277
-210
AdEvent.kt
app/src/main/java/com/easy/clean/business/ads/AdEvent.kt
+2
-0
AdsMgr.kt
app/src/main/java/com/easy/clean/business/ads/AdsMgr.kt
+5
-3
AdBannerMgr.kt
...ain/java/com/easy/clean/business/ads/admob/AdBannerMgr.kt
+1
-1
AdInterMgr.kt
...main/java/com/easy/clean/business/ads/admob/AdInterMgr.kt
+4
-1
AdNativeMgr.kt
...ain/java/com/easy/clean/business/ads/admob/AdNativeMgr.kt
+1
-1
AdOpenMgr.kt
.../main/java/com/easy/clean/business/ads/admob/AdOpenMgr.kt
+20
-14
AdmobEvent.kt
...main/java/com/easy/clean/business/ads/admob/AdmobEvent.kt
+240
-187
SettingsFragment.kt
app/src/main/java/com/easy/clean/ui/set/SettingsFragment.kt
+1
-1
zhanwei1.png
app/src/main/res/drawable-xxhdpi/zhanwei1.png
+0
-0
fragment_settings.xml
app/src/main/res/layout/fragment_settings.xml
+3
-2
No files found.
app/src/main/java/com/easy/clean/business/ads/AdEvent.kt
View file @
00cfa807
...
...
@@ -23,6 +23,8 @@ abstract class AdEvent {
var
adUnit
:
String
=
""
var
from
:
String
=
""
val
reqId
=
UUID
.
randomUUID
().
toString
()
var
isUnLimit
:
Boolean
=
false
fun
adPrepareShow
()
{
val
obj1
=
JSONObject
()
...
...
app/src/main/java/com/easy/clean/business/ads/AdsMgr.kt
View file @
00cfa807
...
...
@@ -8,6 +8,7 @@ import androidx.annotation.LayoutRes
import
com.applovin.sdk.AppLovinMediationProvider
import
com.applovin.sdk.AppLovinSdk
import
com.applovin.sdk.AppLovinSdkInitializationConfiguration
import
com.base.appzxhy.business.ads.admob.AdOpenMgr
import
com.easy.clean.BuildConfig
import
com.easy.clean.GlobalConfig
import
com.easy.clean.MyApplication
...
...
@@ -16,7 +17,6 @@ import com.easy.clean.bean.config.ConfigBean.Companion.configBean
import
com.easy.clean.business.ads.admob.AdBannerMgr
import
com.easy.clean.business.ads.admob.AdInterMgr
import
com.easy.clean.business.ads.admob.AdNativeMgr
import
com.easy.clean.business.ads.admob.AdOpenMgr
import
com.easy.clean.business.ads.admob.AdmobEvent
import
com.easy.clean.business.ads.applovin.AdMaxEvent
import
com.easy.clean.business.ads.applovin.MaxInsertMgr
...
...
@@ -181,12 +181,14 @@ object AdsMgr {
val
from
=
activity
::
class
.
java
.
simpleName
if
(
adsConfigBean
.
adSwitch
)
{
val
admobEvent
=
AdmobEvent
(
"openAd"
,
from
)
admobEvent
.
isUnLimit
=
isUnLimit
if
(
isAdmobInit
)
{
adOpenMgr
.
show
(
activity
,
isUnLimit
,
AdmobEvent
(
"openAd"
,
from
)
,
showCallBack
)
adOpenMgr
.
show
(
activity
,
admobEvent
,
showCallBack
)
}
else
{
admobInitCallBack
=
{
}
adOpenMgr
.
show
(
activity
,
isUnLimit
,
AdmobEvent
(
"openAd"
,
from
)
,
showCallBack
)
adOpenMgr
.
show
(
activity
,
admobEvent
,
showCallBack
)
}
}
else
{
if
(
isMaxInit
)
{
...
...
app/src/main/java/com/easy/clean/business/ads/admob/AdBannerMgr.kt
View file @
00cfa807
...
...
@@ -42,7 +42,7 @@ class AdBannerMgr {
adView
=
AdView
(
parent
.
context
)
parent
.
addView
(
adView
)
adView
?.
onPaidEventListener
=
Admob
Event
.
EventOnPaidEventListener
(
adView
)
adView
?.
onPaidEventListener
=
Admob
OnPaidEventListener
(
adView
,
admobEvent
.
scope
)
listener
=
ViewTreeObserver
.
OnGlobalLayoutListener
{
val
screenPixelDensity
=
parent
.
context
.
resources
.
displayMetrics
.
density
...
...
app/src/main/java/com/easy/clean/business/ads/admob/AdInterMgr.kt
View file @
00cfa807
...
...
@@ -18,6 +18,9 @@ import com.google.android.gms.ads.LoadAdError
import
com.google.android.gms.ads.interstitial.InterstitialAd
import
com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback
import
java.lang.ref.WeakReference
import
kotlin.div
import
kotlin.text.get
import
kotlin.text.toInt
/**
...
...
@@ -150,7 +153,7 @@ class AdInterMgr {
}
(
adEvent
as
AdmobEvent
).
pullAd
(
ad
.
responseInfo
)
LimitUtils
.
addRequestNum
()
ad
.
onPaidEventListener
=
Admob
Event
.
EventOnPaidEventListener
(
ad
)
ad
.
onPaidEventListener
=
Admob
OnPaidEventListener
(
adEvent
.
scope
)
}
override
fun
onAdFailedToLoad
(
loadAdError
:
LoadAdError
)
{
...
...
app/src/main/java/com/easy/clean/business/ads/admob/AdNativeMgr.kt
View file @
00cfa807
...
...
@@ -52,7 +52,7 @@ class AdNativeMgr {
).
forNativeAd
{
nativeAd
->
lastTime
=
System
.
currentTimeMillis
()
nativeAd
.
setOnPaidEventListener
(
Admob
Event
.
EventOnPaidEventListener
(
nativeAd
))
nativeAd
.
setOnPaidEventListener
(
Admob
OnPaidEventListener
(
nativeAd
,
admobEvent
.
scope
))
currentNativeAd
=
nativeAd
admobEvent
.
pullAd
(
nativeAd
.
responseInfo
)
...
...
app/src/main/java/com/easy/clean/business/ads/admob/AdOpenMgr.kt
View file @
00cfa807
package
com.
easy.clean
.business.ads.admob
package
com.
base.appzxhy
.business.ads.admob
import
android.app.Activity
import
android.content.Context
...
...
@@ -9,6 +9,9 @@ import com.easy.clean.business.ads.AdState
import
com.easy.clean.business.ads.AdsShowCallBack
import
com.easy.clean.business.ads.AdsType
import
com.easy.clean.business.ads.LimitUtils
import
com.easy.clean.business.ads.admob.AdmobEvent
import
com.easy.clean.business.ads.admob.AdmobOnPaidEventListener
import
com.easy.clean.utils.LogEx
import
com.google.android.gms.ads.AdError
import
com.google.android.gms.ads.AdRequest
import
com.google.android.gms.ads.FullScreenContentCallback
...
...
@@ -27,11 +30,11 @@ class AdOpenMgr {
private
var
showCallBack
:
AdsShowCallBack
?
=
null
fun
show
(
activity
:
Activity
,
isUnLimit
:
Boolean
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?)
{
fun
show
(
activity
:
Activity
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
return
}
if
(!
isUnLimit
)
{
if
(!
adEvent
.
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
OPEN
,
adEvent
))
{
showCallBack
?.
failed
()
return
...
...
@@ -53,7 +56,9 @@ class AdOpenMgr {
val
needLoad
=
adState
.
currentAd
==
null
||
!
adAvailable
()
if
(
needLoad
)
{
if
(!
adState
.
loadingAd
)
{
loadAd
(
activity
,
adEvent
,
isUnLimit
,
true
)
loadAd
(
activity
,
adEvent
)
{
showReadyAd
(
adEvent
)
}
}
}
else
{
showReadyAd
(
adEvent
)
...
...
@@ -62,10 +67,16 @@ class AdOpenMgr {
private
fun
showReadyAd
(
adEvent
:
AdEvent
)
{
val
ac
=
adState
.
activityRef
?.
get
()
if
(
ac
==
null
||
ac
.
isFinishing
||
ac
.
isDestroyed
)
{
LogEx
.
logDebug
(
TAG
,
"showReadyAd ac=null isFinishing isDestroyed"
)
return
}
adState
.
currentAd
?.
run
{
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
override
fun
onAdShowedFullScreenContent
()
{
val
ac
=
adState
.
activityRef
?.
get
()
(
adEvent
as
AdmobEvent
).
showAd
(
this
@run
.
responseInfo
,
ac
)
showCallBack
?.
show
()
...
...
@@ -114,11 +125,10 @@ class AdOpenMgr {
fun
loadAd
(
context
:
Context
,
adEvent
:
AdEvent
,
isUnLimit
:
Boolean
=
false
,
isShow
:
Boolean
=
false
,
loadCallBack
:
(()
->
Unit
)?
=
null
)
{
if
(!
isUnLimit
)
{
if
(!
adEvent
.
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
OPEN
,
adEvent
))
{
this
.
showCallBack
?.
close
()
this
.
showCallBack
=
null
...
...
@@ -127,7 +137,6 @@ class AdOpenMgr {
}
}
adEvent
.
adPulStart
()
AppOpenAd
.
load
(
...
...
@@ -137,13 +146,10 @@ class AdOpenMgr {
object
:
AppOpenAd
.
AppOpenAdLoadCallback
()
{
override
fun
onAdLoaded
(
appOpenAd
:
AppOpenAd
)
{
adState
.
onAdLoaded
(
appOpenAd
)
if
(
this
@AdOpenMgr
.
showCallBack
!=
null
||
isShow
)
{
showReadyAd
(
adEvent
)
}
loadCallBack
?.
invoke
()
(
adEvent
as
AdmobEvent
).
pullAd
(
appOpenAd
.
responseInfo
)
appOpenAd
.
onPaidEventListener
=
Admob
Event
.
EventOnPaidEventListener
(
appOpenAd
)
appOpenAd
.
onPaidEventListener
=
Admob
OnPaidEventListener
(
appOpenAd
,
adEvent
.
scope
)
LimitUtils
.
addRequestNum
()
}
override
fun
onAdFailedToLoad
(
loadAdError
:
LoadAdError
)
{
...
...
app/src/main/java/com/easy/clean/business/ads/admob/AdmobEvent.kt
View file @
00cfa807
This diff is collapsed.
Click to expand it.
app/src/main/java/com/easy/clean/ui/set/SettingsFragment.kt
View file @
00cfa807
...
...
@@ -40,7 +40,7 @@ class SettingsFragment : BaseFragment<FragmentSettingsBinding>(FragmentSettingsB
binding
.
tvCleanedUp
.
text
=
cleanedSize
.
toFormatSize
()
binding
.
tvVersion
.
text
=
"v${BuildConfig.VERSION_NAME}"
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_native_
mediu
m
)
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_native_
custo
m
)
if
(
BuildConfig
.
DEBUG
)
{
binding
.
tvToken
.
visibility
=
View
.
VISIBLE
...
...
app/src/main/res/drawable-xxhdpi/zhanwei1.png
View replaced file @
ad432fec
View file @
00cfa807
16.4 KB
|
W:
|
H:
12.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
app/src/main/res/layout/fragment_settings.xml
View file @
00cfa807
...
...
@@ -65,15 +65,16 @@
<com.easy.clean.business.ads.NativeParentView
android:id=
"@+id/flAd"
android:layout_width=
"match_parent"
android:layout_height=
"
180dp
"
android:layout_height=
"
wrap_content
"
android:layout_marginTop=
"12dp"
android:layout_marginHorizontal=
"12dp"
app:layout_constraintTop_toBottomOf=
"@id/cl_top"
>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:scaleType=
"fitXY"
android:src=
"@drawable/
img_ad_medium_zhanwei
"
android:src=
"@drawable/
zhanwei1
"
tools:ignore=
"ContentDescription,ImageContrastCheck"
/>
</com.easy.clean.business.ads.NativeParentView>
...
...
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