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
12a612cd
Commit
12a612cd
authored
Jul 16, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开屏广告
parent
b63b9639
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
12 deletions
+138
-12
RepeatActivity.kt
.../filerecoveryrecyclebin/activity/repeat/RepeatActivity.kt
+9
-2
RepeatAnimationActivity.kt
...veryrecyclebin/activity/repeat/RepeatAnimationActivity.kt
+12
-3
AdmobInterstitialUtils.kt
...ilerecoveryrecyclebin/ads/admob/AdmobInterstitialUtils.kt
+6
-6
AdMaxInterstitialUtils.kt
.../filerecoveryrecyclebin/ads/max/AdMaxInterstitialUtils.kt
+111
-0
AdMaxOpenUtils.kt
...com/base/filerecoveryrecyclebin/ads/max/AdMaxOpenUtils.kt
+0
-1
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/activity/repeat/RepeatActivity.kt
View file @
12a612cd
...
...
@@ -9,6 +9,7 @@ import com.base.filerecoveryrecyclebin.adapter.MediaAdapter
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils.showInterAdSp
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobNativeUtils
import
com.base.filerecoveryrecyclebin.ads.max.AdMaxInterstitialUtils
import
com.base.filerecoveryrecyclebin.bean.MediaBean
import
com.base.filerecoveryrecyclebin.bean.MediaTimeBean
import
com.base.filerecoveryrecyclebin.databinding.ActivityRepeatBinding
...
...
@@ -73,9 +74,15 @@ class RepeatActivity : BaseActivity<ActivityRepeatBinding>() {
onBackPressedDispatcher
.
addCallback
{
showExitFunctionDialog
{
if
(
it
)
{
if
(
ConfigHelper
.
admobTrueMaxFlase
)
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@RepeatActivity
)
{
finishToMain
()
}
}
else
{
AdMaxInterstitialUtils
.
showInterstitialAd
(
this
@RepeatActivity
)
{
finishToMain
()
}
}
}
else
{
finishToMain
()
}
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/activity/repeat/RepeatAnimationActivity.kt
View file @
12a612cd
...
...
@@ -4,8 +4,10 @@ import android.content.Intent
import
android.widget.Toast
import
androidx.activity.addCallback
import
com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils
import
com.base.filerecoveryrecyclebin.ads.max.AdMaxInterstitialUtils
import
com.base.filerecoveryrecyclebin.databinding.ActivityRepeatAnimationBinding
import
com.base.filerecoveryrecyclebin.help.BaseActivity
import
com.base.filerecoveryrecyclebin.help.ConfigHelper
import
kotlin.random.Random
class
RepeatAnimationActivity
:
BaseActivity
<
ActivityRepeatAnimationBinding
>()
{
...
...
@@ -17,10 +19,17 @@ class RepeatAnimationActivity : BaseActivity<ActivityRepeatAnimationBinding>() {
override
fun
initView
()
{
binding
.
root
.
postDelayed
({
if
(
ConfigHelper
.
admobTrueMaxFlase
)
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
)
{
startActivity
(
Intent
(
this
,
RepeatActivity
::
class
.
java
))
finish
()
}
}
else
{
AdMaxInterstitialUtils
.
showInterstitialAd
(
this
)
{
startActivity
(
Intent
(
this
,
RepeatActivity
::
class
.
java
))
finish
()
}
}
},
Random
.
nextLong
(
3000
,
4500
))
}
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/ads/admob/AdmobInterstitialUtils.kt
View file @
12a612cd
...
...
@@ -56,14 +56,14 @@ object AdmobInterstitialUtils {
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
return
}
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj
)
val
obj
1
=
JSONObject
()
obj
1
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj
1
)
if
(
isAdExpired
())
{
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_expire"
,
ext
=
obj
)
val
obj
2
=
JSONObject
()
obj
2
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_expire"
,
ext
=
obj
2
)
interAd
=
null
loadInterstitialAd
(
activity
)
onHidden
?.
invoke
()
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/ads/max/AdMaxInterstitialUtils.kt
0 → 100644
View file @
12a612cd
package
com.base.filerecoveryrecyclebin.ads.max
import
android.app.Activity
import
android.os.Handler
import
com.applovin.mediation.MaxAd
import
com.applovin.mediation.MaxAdListener
import
com.applovin.mediation.MaxError
import
com.applovin.mediation.ads.MaxInterstitialAd
import
com.base.filerecoveryrecyclebin.ads.AdDisplayUtils
import
com.base.filerecoveryrecyclebin.help.ConfigHelper
import
com.base.filerecoveryrecyclebin.utils.EventUtils
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
import
org.json.JSONObject
import
java.util.concurrent.TimeUnit
import
kotlin.math.min
import
kotlin.math.pow
object
AdMaxInterstitialUtils
{
private
var
interstitialAd
:
MaxInterstitialAd
?
=
null
private
var
interLoadTime
=
Long
.
MAX_VALUE
private
var
onHidden
:
(()
->
Unit
)?
=
null
private
var
loadingListener
:
(()
->
Unit
)?
=
null
private
var
retryAttempt
=
0
fun
setListener
(
activity
:
Activity
)
{
if
(
interstitialAd
==
null
)
{
interstitialAd
=
MaxInterstitialAd
(
ConfigHelper
.
interAdMaxId
,
activity
)
}
interstitialAd
?.
setListener
(
object
:
MaxAdListener
{
override
fun
onAdLoaded
(
p0
:
MaxAd
)
{
loadingListener
?.
invoke
()
interLoadTime
=
System
.
currentTimeMillis
()
retryAttempt
=
0
}
override
fun
onAdDisplayed
(
p0
:
MaxAd
)
{
}
override
fun
onAdHidden
(
p0
:
MaxAd
)
{
onHidden
?.
invoke
()
}
override
fun
onAdClicked
(
p0
:
MaxAd
)
{
}
override
fun
onAdLoadFailed
(
p0
:
String
,
p1
:
MaxError
)
{
retryAttempt
++
val
delayMillis
=
TimeUnit
.
SECONDS
.
toMillis
(
2.0
.
pow
(
min
(
6
,
retryAttempt
)).
toLong
())
MainScope
().
launch
{
delay
(
delayMillis
)
interstitialAd
?.
loadAd
()
}
}
override
fun
onAdDisplayFailed
(
p0
:
MaxAd
,
p1
:
MaxError
)
{
}
})
}
fun
showInterstitialAd
(
activity
:
Activity
,
isReLoadAd
:
Boolean
=
false
,
isShowDialog
:
Boolean
=
true
,
onHidden
:
(()
->
Unit
)?
=
null
)
{
setListener
(
activity
)
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
return
}
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
if
(
isAdExpired
())
{
val
obj2
=
JSONObject
()
obj2
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_expire"
,
ext
=
obj2
)
interstitialAd
?.
loadAd
()
onHidden
?.
invoke
()
return
}
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
onHidden
?.
invoke
()
return
}
this
.
onHidden
=
onHidden
if
(
interstitialAd
?.
isReady
==
true
)
{
interstitialAd
?.
showAd
()
}
else
{
interstitialAd
?.
loadAd
()
loadingListener
=
{
interstitialAd
?.
showAd
()
loadingListener
=
null
}
}
}
private
fun
isAdExpired
():
Boolean
{
return
System
.
currentTimeMillis
()
-
interLoadTime
>
1000
*
60
*
60
}
}
\ No newline at end of file
app/src/main/java/com/base/filerecoveryrecyclebin/ads/max/AdMaxOpenUtils.kt
View file @
12a612cd
...
...
@@ -76,7 +76,6 @@ object AdMaxOpenUtils {
setListener
(
activity
)
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
onHidden
?.
invoke
()
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