Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
D
Data Recovery White
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
Data Recovery White
Commits
589ec952
Commit
589ec952
authored
Jul 16, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
535874b4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
19 deletions
+10
-19
AdMaxInterstitialUtils.kt
...a/com/base/datarecovery/ads/max/AdMaxInterstitialUtils.kt
+10
-19
No files found.
app/src/main/java/com/base/datarecovery/ads/max/AdMaxInterstitialUtils.kt
View file @
589ec952
...
...
@@ -12,7 +12,9 @@ import com.base.datarecovery.help.ConfigHelper
import
com.base.datarecovery.utils.EventUtils
import
com.base.datarecovery.utils.LogEx
import
com.base.datarecovery.view.CustomDialog
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.async
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
import
org.json.JSONObject
...
...
@@ -28,7 +30,6 @@ object AdMaxInterstitialUtils {
private
var
onHidden
:
(()
->
Unit
)?
=
null
private
var
loadingListener
:
(()
->
Unit
)?
=
null
private
var
retryAttempt
=
0
private
var
maxRetryAttempt
=
3
@SuppressLint
(
"StaticFieldLeak"
)
private
var
customDialog
:
CustomDialog
?
=
null
...
...
@@ -56,14 +57,11 @@ object AdMaxInterstitialUtils {
onHidden
?.
invoke
()
customDialog
?.
dismiss
()
}
if
(
retryAttempt
<=
maxRetryAttempt
)
{
MainScope
().
launch
{
delay
(
delayMillis
)
MainScope
().
async
{
interstitialAd
?.
loadAd
()
}
}
else
{
retryAttempt
=
0
}
delay
(
delayMillis
)
}.
onAwait
}
...
...
@@ -92,8 +90,6 @@ object AdMaxInterstitialUtils {
fun
showInterstitialAd
(
activity
:
Activity
,
isReLoadAd
:
Boolean
=
false
,
isShowDialog
:
Boolean
=
true
,
onHidden
:
(()
->
Unit
)?
=
null
)
{
setListener
(
activity
)
...
...
@@ -123,11 +119,11 @@ object AdMaxInterstitialUtils {
this
.
onHidden
=
onHidden
if
(
interstitialAd
?.
isReady
==
true
)
{
LogEx
.
logDebug
(
TAG
,
"isReady=true"
)
showIntervalDialogAndShowAd
(
activity
,
isShowDialog
,
onHidden
,
2
)
interstitialAd
?.
showAd
(
)
}
else
{
interstitialAd
?.
loadAd
()
LogEx
.
logDebug
(
TAG
,
"isReady=false"
)
showAdDialogAndLoadInterstitial
(
activity
,
isShowDialog
)
showAdDialogAndLoadInterstitial
(
activity
)
}
}
...
...
@@ -164,7 +160,7 @@ object AdMaxInterstitialUtils {
// }
// customDialog = null
// LogEx.logDebug(TAG, "onFinish")
interstitialAd
?.
showAd
()
//
interstitialAd?.showAd()
// }
// }
// countdownTimer.start()
...
...
@@ -173,12 +169,7 @@ object AdMaxInterstitialUtils {
private
fun
showAdDialogAndLoadInterstitial
(
activity
:
Activity
,
isShowDialog
:
Boolean
,
)
{
if
(!
isShowDialog
)
{
return
}
if
(!
activity
.
isFinishing
&&
!
activity
.
isDestroyed
)
{
customDialog
=
CustomDialog
(
activity
,
R
.
layout
.
dialog_ad_loading
)
// 设置对话框的样式和内容
...
...
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