Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
F
File Recovery RecycleBin
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
File Recovery RecycleBin
Commits
b63b9639
Commit
b63b9639
authored
Jul 16, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开屏广告
parent
df319c9f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
153 additions
and
14 deletions
+153
-14
SplashActivity.kt
...om/base/filerecoveryrecyclebin/activity/SplashActivity.kt
+28
-13
AdMaxEvent.kt
...ava/com/base/filerecoveryrecyclebin/ads/max/AdMaxEvent.kt
+0
-1
AdMaxOpenUtils.kt
...com/base/filerecoveryrecyclebin/ads/max/AdMaxOpenUtils.kt
+125
-0
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/activity/SplashActivity.kt
View file @
b63b9639
...
@@ -19,6 +19,7 @@ import com.base.filerecoveryrecyclebin.activity.screenshot.ScreenShotActivity
...
@@ -19,6 +19,7 @@ import com.base.filerecoveryrecyclebin.activity.screenshot.ScreenShotActivity
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobNativeUtils
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobNativeUtils
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobOpenUtils
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobOpenUtils
import
com.base.filerecoveryrecyclebin.ads.max.AdMaxOpenUtils
import
com.base.filerecoveryrecyclebin.bean.ConstObject
import
com.base.filerecoveryrecyclebin.bean.ConstObject
import
com.base.filerecoveryrecyclebin.bean.ConstObject.ID_JUNK_CLEAN_PUSH
import
com.base.filerecoveryrecyclebin.bean.ConstObject.ID_JUNK_CLEAN_PUSH
import
com.base.filerecoveryrecyclebin.bean.ConstObject.ID_PRIVACY_SPACE
import
com.base.filerecoveryrecyclebin.bean.ConstObject.ID_PRIVACY_SPACE
...
@@ -71,8 +72,10 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
...
@@ -71,8 +72,10 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
actionId
=
intent
?.
extras
?.
getInt
(
"actionId"
)
?:
-
1
actionId
=
intent
?.
extras
?.
getInt
(
"actionId"
)
?:
-
1
closeNotification
()
closeNotification
()
AdmobNativeUtils
.
loadNativeAd
()
if
(
ConfigHelper
.
admobTrueMaxFlase
)
{
AdmobInterstitialUtils
.
loadInterstitialAd
(
this
)
AdmobNativeUtils
.
loadNativeAd
()
AdmobInterstitialUtils
.
loadInterstitialAd
(
this
)
}
progressCollect
()
progressCollect
()
...
@@ -194,7 +197,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
...
@@ -194,7 +197,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
private
var
processTime
=
0L
private
var
processTime
=
0L
private
var
outTimeAdStart
=
false
private
var
outTimeAdStart
=
false
private
fun
startProgress
()
=
lifecycleScope
.
launch
{
private
fun
startProgress
()
=
lifecycleScope
.
launch
{
LogEx
.
logDebug
(
TAG
,
"startProgress"
)
LogEx
.
logDebug
(
TAG
,
"startProgress"
)
while
(
isActive
)
{
while
(
isActive
)
{
val
value
=
binding
.
pb
.
progress
+
2
val
value
=
binding
.
pb
.
progress
+
2
binding
.
pb
.
setProgress
(
value
,
true
)
binding
.
pb
.
setProgress
(
value
,
true
)
...
@@ -214,21 +217,33 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
...
@@ -214,21 +217,33 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
private
fun
outTimeAd
()
{
private
fun
outTimeAd
()
{
LogEx
.
logDebug
(
TAG
,
"outTimeAd"
)
LogEx
.
logDebug
(
TAG
,
"outTimeAd"
)
AdmobOpenUtils
.
loadAppOpenAd
{
if
(
ConfigHelper
.
admobTrueMaxFlase
)
{
LogEx
.
logDebug
(
TAG
,
"load where=$it"
)
AdmobOpenUtils
.
loadAppOpenAd
{
job
?.
cancel
()
LogEx
.
logDebug
(
TAG
,
"load where=$it"
)
AdmobOpenUtils
.
showAppOpenAd
(
this
@SplashActivity
)
{
job
?.
cancel
()
LogEx
.
logDebug
(
TAG
,
"adCallBack=$it"
)
AdmobOpenUtils
.
showAppOpenAd
(
this
@SplashActivity
)
{
binding
.
pb
.
progress
=
100
LogEx
.
logDebug
(
TAG
,
"adCallBack=$it"
)
jumpNext
()
binding
.
pb
.
progress
=
100
jumpNext
()
}
}
}
}
else
{
AdMaxOpenUtils
.
showAppOpenAd
(
this
@SplashActivity
,
loaded
=
{
job
?.
cancel
()
},
onHidden
=
{
binding
.
pb
.
progress
=
100
jumpNext
()
})
}
}
}
}
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
LogEx
.
logDebug
(
TAG
,
"onResume"
)
LogEx
.
logDebug
(
TAG
,
"onResume"
)
if
(
ifAgreePrivacy
&&
job
?.
isActive
==
false
)
{
if
(
ifAgreePrivacy
&&
job
?.
isActive
==
false
)
{
job
=
startProgress
()
job
=
startProgress
()
}
}
...
@@ -237,7 +252,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
...
@@ -237,7 +252,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
override
fun
onPause
()
{
override
fun
onPause
()
{
super
.
onPause
()
super
.
onPause
()
job
?.
cancel
()
job
?.
cancel
()
LogEx
.
logDebug
(
TAG
,
"onPause"
)
LogEx
.
logDebug
(
TAG
,
"onPause"
)
}
}
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/ads/max/AdMaxEvent.kt
View file @
b63b9639
...
@@ -3,7 +3,6 @@ package com.base.filerecoveryrecyclebin.ads.max
...
@@ -3,7 +3,6 @@ package com.base.filerecoveryrecyclebin.ads.max
import
android.app.Activity
import
android.app.Activity
import
com.applovin.mediation.MaxAd
import
com.applovin.mediation.MaxAd
import
com.base.filerecoveryrecyclebin.utils.EventUtils
import
com.base.filerecoveryrecyclebin.utils.EventUtils
import
com.google.android.gms.ads.ResponseInfo
import
org.json.JSONObject
import
org.json.JSONObject
object
AdMaxEvent
{
object
AdMaxEvent
{
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/ads/max/AdMaxOpenUtils.kt
0 → 100644
View file @
b63b9639
package
com.base.filerecoveryrecyclebin.ads.max
import
android.app.Activity
import
android.content.Context
import
com.adjust.sdk.Adjust
import
com.adjust.sdk.AdjustAdRevenue
import
com.adjust.sdk.AdjustConfig
import
com.applovin.mediation.MaxAd
import
com.applovin.mediation.MaxAdListener
import
com.applovin.mediation.MaxError
import
com.applovin.mediation.ads.MaxAppOpenAd
import
com.base.filerecoveryrecyclebin.ads.AdDisplayUtils
import
com.base.filerecoveryrecyclebin.ads.AdmobCommonUtils
import
com.base.filerecoveryrecyclebin.help.ConfigHelper
import
com.base.filerecoveryrecyclebin.utils.EventUtils
import
com.base.filerecoveryrecyclebin.utils.LogEx
import
org.json.JSONObject
object
AdMaxOpenUtils
{
private
val
TAG
=
"AdMaxOpenUtils"
private
var
appOpenAd
:
MaxAppOpenAd
?
=
null
private
var
openLoadTime
=
Long
.
MAX_VALUE
private
var
onHidden
:
(()
->
Unit
)?
=
null
private
var
loadingListener
:
(()
->
Unit
)?
=
null
private
fun
setListener
(
context
:
Context
)
{
if
(
appOpenAd
==
null
)
{
appOpenAd
=
MaxAppOpenAd
(
ConfigHelper
.
openAdMaxId
,
context
)
appOpenAd
?.
setListener
(
object
:
MaxAdListener
{
override
fun
onAdLoaded
(
p0
:
MaxAd
)
{
openLoadTime
=
System
.
currentTimeMillis
()
loadingListener
?.
invoke
()
}
override
fun
onAdDisplayed
(
p0
:
MaxAd
)
{
}
override
fun
onAdHidden
(
p0
:
MaxAd
)
{
onHidden
?.
invoke
()
appOpenAd
?.
loadAd
()
}
override
fun
onAdClicked
(
p0
:
MaxAd
)
{
// AdMaxEvent.clickAd(appOpenAd, "openAd")
AdmobCommonUtils
.
isMultiClick
(
appOpenAd
)
}
override
fun
onAdLoadFailed
(
p0
:
String
,
p1
:
MaxError
)
{
appOpenAd
?.
loadAd
()
}
override
fun
onAdDisplayFailed
(
p0
:
MaxAd
,
p1
:
MaxError
)
{
onHidden
?.
invoke
()
appOpenAd
?.
loadAd
()
val
obj
=
JSONObject
()
obj
.
put
(
"reason"
,
p1
.
message
)
obj
.
put
(
"ad_unit"
,
"openAd"
)
EventUtils
.
event
(
"ad_show_error"
,
ext
=
obj
)
}
})
appOpenAd
?.
setRevenueListener
{
ad
->
val
adjustAdRevenue
=
AdjustAdRevenue
(
AdjustConfig
.
AD_REVENUE_APPLOVIN_MAX
)
adjustAdRevenue
.
setRevenue
(
ad
.
revenue
,
"USD"
)
adjustAdRevenue
.
setAdRevenueNetwork
(
ad
.
networkName
)
adjustAdRevenue
.
setAdRevenueUnit
(
ad
.
adUnitId
)
adjustAdRevenue
.
setAdRevenuePlacement
(
ad
.
placement
)
Adjust
.
trackAdRevenue
(
adjustAdRevenue
)
}
}
}
fun
showAppOpenAd
(
activity
:
Activity
,
loaded
:
(()
->
Unit
)?
=
null
,
onHidden
:
(()
->
Unit
)?
=
null
)
{
setListener
(
activity
)
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
onHidden
?.
invoke
()
return
}
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
LogEx
.
logDebug
(
TAG
,
"!shouldShowAd"
)
onHidden
?.
invoke
()
return
}
if
(
System
.
currentTimeMillis
()
-
openLoadTime
>
1000
*
60
*
60
)
{
LogEx
.
logDebug
(
TAG
,
"openLoadTime > "
)
onHidden
?.
invoke
()
val
obj2
=
JSONObject
()
obj2
.
put
(
"ad_unit"
,
"openAd"
)
EventUtils
.
event
(
"ad_expire"
,
ext
=
obj2
)
appOpenAd
?.
loadAd
()
}
LogEx
.
logDebug
(
TAG
,
"showAppOpenAd continue"
)
appOpenAd
?.
loadAd
()
loadingListener
=
{
loaded
?.
invoke
()
LogEx
.
logDebug
(
TAG
,
"loadingListener callback"
)
if
(
appOpenAd
?.
isReady
==
true
)
{
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
"openAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
this
.
onHidden
=
onHidden
appOpenAd
?.
showAd
()
loadingListener
=
null
appOpenAd
?.
loadAd
()
}
else
{
onHidden
?.
invoke
()
appOpenAd
?.
loadAd
()
val
obj
=
JSONObject
()
obj
.
put
(
"reason"
,
"no_ad"
)
obj
.
put
(
"ad_unit"
,
"openAd"
)
EventUtils
.
event
(
"ad_show_error"
,
ext
=
obj
)
}
}
}
}
\ No newline at end of file
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