Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy Cleaner Junk
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
Easy Cleaner Junk
Commits
cd5c57d2
Commit
cd5c57d2
authored
Jul 01, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/free-master' into free-master
parents
4525ecbd
752fa4d7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
120 additions
and
86 deletions
+120
-86
NewMainActivity.kt
...est/easy/easycleanerjunk/activity/home/NewMainActivity.kt
+2
-1
NewSplashActivity.kt
...easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
+2
-0
PrivacyAgreementManager.kt
...asycleanerjunk/activity/splash/PrivacyAgreementManager.kt
+2
-0
NotificationUtil.java
...a/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
+3
-3
AdmobUtils.kt
...ava/com/test/easy/easycleanerjunk/helps/ads/AdmobUtils.kt
+111
-82
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/activity/home/NewMainActivity.kt
View file @
cd5c57d2
...
@@ -10,6 +10,7 @@ import com.test.easy.easycleanerjunk.databinding.ActivityMainBinding
...
@@ -10,6 +10,7 @@ import com.test.easy.easycleanerjunk.databinding.ActivityMainBinding
import
com.test.easy.easycleanerjunk.fragment.HomeFragment
import
com.test.easy.easycleanerjunk.fragment.HomeFragment
import
com.test.easy.easycleanerjunk.fragment.ToolsFragment
import
com.test.easy.easycleanerjunk.fragment.ToolsFragment
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.EventUtils
import
com.test.easy.easycleanerjunk.utils.BarUtils
import
com.test.easy.easycleanerjunk.utils.BarUtils
import
com.test.easy.easycleanerjunk.view.RateStarPop
import
com.test.easy.easycleanerjunk.view.RateStarPop
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
...
@@ -37,7 +38,7 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
...
@@ -37,7 +38,7 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
override
fun
initView
()
{
override
fun
initView
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
EventUtils
.
event
(
"page_home"
)
binding
.
idVp
.
run
{
binding
.
idVp
.
run
{
adapter
=
object
:
FragmentStateAdapter
(
this
@NewMainActivity
)
{
adapter
=
object
:
FragmentStateAdapter
(
this
@NewMainActivity
)
{
override
fun
getItemCount
():
Int
{
override
fun
getItemCount
():
Int
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
View file @
cd5c57d2
...
@@ -13,6 +13,7 @@ import com.test.easy.easycleanerjunk.fcm.CloseNotificationReceiver
...
@@ -13,6 +13,7 @@ import com.test.easy.easycleanerjunk.fcm.CloseNotificationReceiver
import
com.test.easy.easycleanerjunk.fcm.NotificationUtil
import
com.test.easy.easycleanerjunk.fcm.NotificationUtil
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.EventUtils
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.service.PermanentNotificationService
import
com.test.easy.easycleanerjunk.service.PermanentNotificationService
import
com.test.easy.easycleanerjunk.utils.BarUtils
import
com.test.easy.easycleanerjunk.utils.BarUtils
...
@@ -59,6 +60,7 @@ class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(),
...
@@ -59,6 +60,7 @@ class NewSplashActivity : BaseActivity<ActivityLayoutSplashBinding>(),
binding
.
idLlJindu
.
isVisible
=
true
binding
.
idLlJindu
.
isVisible
=
true
binding
.
idLlYinsi
.
isVisible
=
false
binding
.
idLlYinsi
.
isVisible
=
false
onAgreePrivacy
()
onAgreePrivacy
()
EventUtils
.
event
(
"app_start"
)
}
else
{
}
else
{
PrivacyAgreementManager
(
binding
,
this
,
this
)
PrivacyAgreementManager
(
binding
,
this
,
this
)
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/activity/splash/PrivacyAgreementManager.kt
View file @
cd5c57d2
...
@@ -9,6 +9,7 @@ import android.text.style.UnderlineSpan
...
@@ -9,6 +9,7 @@ import android.text.style.UnderlineSpan
import
com.test.easy.easycleanerjunk.MyApplication
import
com.test.easy.easycleanerjunk.MyApplication
import
com.test.easy.easycleanerjunk.databinding.ActivityLayoutSplashBinding
import
com.test.easy.easycleanerjunk.databinding.ActivityLayoutSplashBinding
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.EventUtils
class
PrivacyAgreementManager
{
class
PrivacyAgreementManager
{
...
@@ -59,6 +60,7 @@ class PrivacyAgreementManager {
...
@@ -59,6 +60,7 @@ class PrivacyAgreementManager {
ConfigHelper
.
ifAgreePrivacy
=
true
ConfigHelper
.
ifAgreePrivacy
=
true
(
context
.
application
as
MyApplication
).
initApp
()
(
context
.
application
as
MyApplication
).
initApp
()
listener
.
onAgreePrivacy
()
listener
.
onAgreePrivacy
()
EventUtils
.
event
(
"app_start"
)
}
}
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
View file @
cd5c57d2
...
@@ -83,7 +83,7 @@ public class NotificationUtil {
...
@@ -83,7 +83,7 @@ public class NotificationUtil {
}
}
int
interval
=
SPUtils
.
getInstance
().
getInt
(
"notification_interval"
,
60
);
int
interval
=
SPUtils
.
getInstance
().
getInt
(
"notification_interval"
,
60
);
long
lastTime
=
SPUtils
.
getInstance
().
get
Int
(
"last_notification_time"
,
0
);
long
lastTime
=
SPUtils
.
getInstance
().
get
Long
(
"last_notification_time"
,
0
);
long
nowTime
=
System
.
currentTimeMillis
();
long
nowTime
=
System
.
currentTimeMillis
();
long
x
=
nowTime
-
lastTime
;
long
x
=
nowTime
-
lastTime
;
if
(
x
<
(
interval
*
1000
))
{
if
(
x
<
(
interval
*
1000
))
{
...
@@ -157,7 +157,7 @@ public class NotificationUtil {
...
@@ -157,7 +157,7 @@ public class NotificationUtil {
btn
=
"Clean up"
;
btn
=
"Clean up"
;
}
else
if
(
actionId
==
ConfigBean
.
ID_APP_MANAGER
)
{
}
else
if
(
actionId
==
ConfigBean
.
ID_APP_MANAGER
)
{
icon
=
R
.
drawable
.
appmanager
;
icon
=
R
.
drawable
.
appmanager
;
desc
=
"
Manage apps that are not frequently used, free up storage space on your phone, and keep it running smoothly
!"
;
desc
=
"
Running out of space on your phone? Manage less frequently used apps to free up space on your phone
!"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
if
(
actionId
==
ConfigBean
.
ID_BATTERY
)
{
}
else
if
(
actionId
==
ConfigBean
.
ID_BATTERY
)
{
icon
=
R
.
drawable
.
battery
;
icon
=
R
.
drawable
.
battery
;
...
@@ -169,7 +169,7 @@ public class NotificationUtil {
...
@@ -169,7 +169,7 @@ public class NotificationUtil {
btn
=
"View"
;
btn
=
"View"
;
}
else
if
(
actionId
==
ConfigBean
.
ID_WHATSAPP
)
{
}
else
if
(
actionId
==
ConfigBean
.
ID_WHATSAPP
)
{
icon
=
R
.
drawable
.
whatsapp_clean
;
icon
=
R
.
drawable
.
whatsapp_clean
;
desc
=
"Running out of storage space on your phone? Clean up WhatsApp to free up space"
;
desc
=
"Running out of storage space on your phone? Clean up WhatsApp
junk files
to free up space"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
{
}
else
{
return
;
return
;
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ads/AdmobUtils.kt
View file @
cd5c57d2
...
@@ -4,7 +4,6 @@ import android.app.Activity
...
@@ -4,7 +4,6 @@ import android.app.Activity
import
android.app.Dialog
import
android.app.Dialog
import
android.os.Bundle
import
android.os.Bundle
import
android.os.CountDownTimer
import
android.os.CountDownTimer
import
android.util.Log
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.Toast
import
android.widget.Toast
import
androidx.core.view.isVisible
import
androidx.core.view.isVisible
...
@@ -30,11 +29,10 @@ import com.test.easy.easycleanerjunk.R
...
@@ -30,11 +29,10 @@ import com.test.easy.easycleanerjunk.R
import
com.test.easy.easycleanerjunk.activity.photocompress.photo.CustomDialog
import
com.test.easy.easycleanerjunk.activity.photocompress.photo.CustomDialog
import
com.test.easy.easycleanerjunk.helps.BaseApplication
import
com.test.easy.easycleanerjunk.helps.BaseApplication
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.EventUtils
import
com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import
com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import
com.test.easy.easycleanerjunk.utils.SPUtils
import
org.json.JSONObject
import
org.json.JSONObject
import
java.util.UUID
import
java.util.UUID
import
kotlin.system.exitProcess
object
AdmobUtils
{
object
AdmobUtils
{
...
@@ -45,19 +43,8 @@ object AdmobUtils {
...
@@ -45,19 +43,8 @@ object AdmobUtils {
private
var
nativeLoadTime
=
Long
.
MAX_VALUE
private
var
nativeLoadTime
=
Long
.
MAX_VALUE
private
var
mOpenAd
:
AppOpenAd
?
=
null
private
var
mOpenAd
:
AppOpenAd
?
=
null
private
const
val
typeShow
=
"Show"
private
const
val
typeClick
=
"Click"
var
isBlack
=
false
get
()
{
return
SPUtils
.
getInstance
().
getBoolean
(
"isBlack"
,
field
)
}
set
(
value
)
{
field
=
value
SPUtils
.
getInstance
().
put
(
"isBlack"
,
value
,
true
)
}
fun
loadAppOpenAd
(
skip
:
Boolean
=
false
,
onLoad
:
(()
->
Unit
)?
=
null
)
{
fun
loadAppOpenAd
(
skip
:
Boolean
=
false
,
onLoad
:
(()
->
Unit
)?
=
null
)
{
if
(
mOpenAd
!=
null
||
skip
)
{
if
(
mOpenAd
!=
null
||
skip
)
{
...
@@ -72,27 +59,26 @@ object AdmobUtils {
...
@@ -72,27 +59,26 @@ object AdmobUtils {
val
obj
=
JSONObject
()
val
obj
=
JSONObject
()
obj
.
put
(
"req_id"
,
reqId
)
obj
.
put
(
"req_id"
,
reqId
)
obj
.
put
(
"ad_type"
,
"openAd"
)
obj
.
put
(
"ad_type"
,
"openAd"
)
EventUtils
.
event
(
"ad_pull_start"
,
ext
=
obj
)
AppOpenAd
.
load
(
AppOpenAd
.
load
(
BaseApplication
.
context
,
BaseApplication
.
context
,
ConfigHelper
.
openAdmobId
,
ConfigHelper
.
openAdmobId
,
mRequest
,
mRequest
,
object
:
AppOpenAd
.
AppOpenAdLoadCallback
()
{
object
:
AppOpenAd
.
AppOpenAdLoadCallback
()
{
override
fun
onAdLoaded
(
ad
:
AppOpenAd
)
{
override
fun
onAdLoaded
(
ad
:
AppOpenAd
)
{
openLoadTime
=
System
.
currentTimeMillis
()
openLoadTime
=
System
.
currentTimeMillis
()
mOpenAd
=
ad
mOpenAd
=
ad
onLoad
?.
invoke
()
onLoad
?.
invoke
()
pull
(
ad
.
responseInfo
,
"openAd"
,
reqId
=
reqId
)
pull
(
ad
.
responseInfo
,
"openAd"
,
reqId
=
reqId
)
ad
.
onPaidEventListener
=
EventOnPaidEventListener
(
ad
)
ad
.
onPaidEventListener
=
EventOnPaidEventListener
(
ad
)
// Log.e("MXL", "拉取成功: ", )
}
}
override
fun
onAdFailedToLoad
(
p0
:
LoadAdError
)
{
override
fun
onAdFailedToLoad
(
p0
:
LoadAdError
)
{
mOpenAd
=
null
mOpenAd
=
null
onLoad
?.
invoke
()
onLoad
?.
invoke
()
pull
(
p0
.
responseInfo
,
"openAd"
,
p0
.
message
,
reqId
=
reqId
)
pull
(
p0
.
responseInfo
,
"openAd"
,
p0
.
message
,
reqId
=
reqId
)
// Log.e("MXL", "onAdFailedToLoad: " + p0.message)
}
}
})
})
}
}
fun
isOpenAdLoaded
()
=
mOpenAd
!=
null
fun
isOpenAdLoaded
()
=
mOpenAd
!=
null
...
@@ -107,16 +93,14 @@ object AdmobUtils {
...
@@ -107,16 +93,14 @@ object AdmobUtils {
}
}
val
obj
=
JSONObject
()
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
"openAd"
)
obj
.
put
(
"ad_unit"
,
"openAd"
)
// if (mOpenAd == null || skip) {
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj
)
// onHidden?.invoke()
// return
// }
if
(
System
.
currentTimeMillis
()
-
openLoadTime
>
1000
*
60
*
60
)
{
if
(
System
.
currentTimeMillis
()
-
openLoadTime
>
1000
*
60
*
60
)
{
mOpenAd
=
null
mOpenAd
=
null
loadAppOpenAd
()
loadAppOpenAd
()
onHidden
?.
invoke
()
onHidden
?.
invoke
()
val
obj
=
JSONObject
()
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
"openAd"
)
obj
.
put
(
"ad_unit"
,
"openAd"
)
EventUtils
.
event
(
"ad_expire"
,
ext
=
obj
)
return
return
}
}
if
(
mOpenAd
!=
null
)
{
if
(
mOpenAd
!=
null
)
{
...
@@ -141,6 +125,7 @@ object AdmobUtils {
...
@@ -141,6 +125,7 @@ object AdmobUtils {
val
obj
=
JSONObject
()
val
obj
=
JSONObject
()
obj
.
put
(
"reason"
,
p0
.
message
)
obj
.
put
(
"reason"
,
p0
.
message
)
obj
.
put
(
"ad_unit"
,
"openAd"
)
obj
.
put
(
"ad_unit"
,
"openAd"
)
EventUtils
.
event
(
"ad_show_error"
,
ext
=
obj
)
}
}
override
fun
onAdShowedFullScreenContent
()
{
override
fun
onAdShowedFullScreenContent
()
{
...
@@ -154,6 +139,7 @@ object AdmobUtils {
...
@@ -154,6 +139,7 @@ object AdmobUtils {
val
obj
=
JSONObject
()
val
obj
=
JSONObject
()
obj
.
put
(
"reason"
,
"no_ad"
)
obj
.
put
(
"reason"
,
"no_ad"
)
obj
.
put
(
"ad_unit"
,
"openAd"
)
obj
.
put
(
"ad_unit"
,
"openAd"
)
EventUtils
.
event
(
"ad_show_error"
,
ext
=
obj
)
}
}
}
}
...
@@ -164,6 +150,7 @@ object AdmobUtils {
...
@@ -164,6 +150,7 @@ object AdmobUtils {
fun
showNativeAd
(
activity
:
Activity
?,
parent
:
ViewGroup
)
{
fun
showNativeAd
(
activity
:
Activity
?,
parent
:
ViewGroup
)
{
val
obj
=
JSONObject
()
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
"NativeAd"
)
obj
.
put
(
"ad_unit"
,
"NativeAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj
)
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
return
return
}
}
...
@@ -188,6 +175,7 @@ object AdmobUtils {
...
@@ -188,6 +175,7 @@ object AdmobUtils {
val
obj
=
JSONObject
()
val
obj
=
JSONObject
()
obj
.
put
(
"reason"
,
"no_ad"
)
obj
.
put
(
"reason"
,
"no_ad"
)
obj
.
put
(
"ad_unit"
,
"nativeAd"
)
obj
.
put
(
"ad_unit"
,
"nativeAd"
)
EventUtils
.
event
(
"ad_show_error"
,
ext
=
obj
)
}
else
{
}
else
{
loadingListener
?.
invoke
()
loadingListener
?.
invoke
()
}
}
...
@@ -214,7 +202,7 @@ object AdmobUtils {
...
@@ -214,7 +202,7 @@ object AdmobUtils {
obj
.
put
(
"ad_type"
,
"nativeAd"
)
obj
.
put
(
"ad_type"
,
"nativeAd"
)
val
adLoader
=
AdLoader
.
Builder
(
val
adLoader
=
AdLoader
.
Builder
(
BaseApplication
.
context
,
ConfigHelper
.
nativeAdmobId
BaseApplication
.
context
,
ConfigHelper
.
nativeAdmobId
).
forNativeAd
{
).
forNativeAd
{
nativeLoadTime
=
System
.
currentTimeMillis
()
nativeLoadTime
=
System
.
currentTimeMillis
()
nativeAd
=
it
nativeAd
=
it
...
@@ -250,33 +238,38 @@ object AdmobUtils {
...
@@ -250,33 +238,38 @@ object AdmobUtils {
return
return
}
}
val
reqId
=
UUID
.
randomUUID
().
toString
()
val
reqId
=
UUID
.
randomUUID
().
toString
()
val
obj
=
JSONObject
()
obj
.
put
(
"req_id"
,
reqId
)
obj
.
put
(
"ad_type"
,
"interAd"
)
obj
.
put
(
"from"
,
activity
.
javaClass
.
simpleName
)
EventUtils
.
event
(
"ad_pull_start"
,
ext
=
obj
)
InterstitialAd
.
load
(
InterstitialAd
.
load
(
activity
,
activity
,
ConfigHelper
.
interAdmobId
,
ConfigHelper
.
interAdmobId
,
mRequest
,
mRequest
,
object
:
InterstitialAdLoadCallback
()
{
object
:
InterstitialAdLoadCallback
()
{
override
fun
onAdFailedToLoad
(
p0
:
LoadAdError
)
{
override
fun
onAdFailedToLoad
(
p0
:
LoadAdError
)
{
interAd
=
null
interAd
=
null
onLoad
?.
invoke
()
onLoad
?.
invoke
()
pull
(
p0
.
responseInfo
,
"interAd"
,
p0
.
message
,
reqId
=
reqId
)
pull
(
p0
.
responseInfo
,
"interAd"
,
p0
.
message
,
reqId
=
reqId
)
if
(
BuildConfig
.
DEBUG
)
{
if
(
BuildConfig
.
DEBUG
)
{
Toast
.
makeText
(
Toast
.
makeText
(
BaseApplication
.
context
,
BaseApplication
.
context
,
"拉取失败"
+
p0
.
message
,
"拉取失败"
+
p0
.
message
,
Toast
.
LENGTH_SHORT
Toast
.
LENGTH_SHORT
)
).
show
()
}
}
}
override
fun
onAdLoaded
(
ad
:
InterstitialAd
)
{
}
interAd
=
ad
onLoad
?.
invoke
()
override
fun
onAdLoaded
(
ad
:
InterstitialAd
)
{
interLoadTime
=
System
.
currentTimeMillis
()
interAd
=
ad
pull
(
ad
.
responseInfo
,
"interAd"
,
reqId
=
reqId
)
onLoad
?.
invoke
()
ad
.
onPaidEventListener
=
EventOnPaidEventListener
(
ad
)
interLoadTime
=
System
.
currentTimeMillis
()
}
pull
(
ad
.
responseInfo
,
"interAd"
,
reqId
=
reqId
)
})
ad
.
onPaidEventListener
=
EventOnPaidEventListener
(
ad
)
}
})
}
}
private
fun
isAdExpired
():
Boolean
{
private
fun
isAdExpired
():
Boolean
{
...
@@ -286,12 +279,22 @@ object AdmobUtils {
...
@@ -286,12 +279,22 @@ object AdmobUtils {
var
adDisplayInterval
:
Int
=
10
var
adDisplayInterval
:
Int
=
10
var
adLastDisplayTime
:
Long
=
0
var
adLastDisplayTime
:
Long
=
0
fun
showInterstitialAd
(
activity
:
Activity
,
isLoadAdNow
:
Boolean
=
false
,
onHidden
:
(()
->
Unit
)?
=
null
)
{
fun
showInterstitialAd
(
activity
:
Activity
,
isLoadAdNow
:
Boolean
=
false
,
onHidden
:
(()
->
Unit
)?
=
null
)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
return
return
}
}
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj
)
if
(
isAdExpired
())
{
if
(
isAdExpired
())
{
val
obj
=
JSONObject
()
obj
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_expire"
,
ext
=
obj
)
interAd
=
null
interAd
=
null
loadInterstitialAd
(
activity
)
loadInterstitialAd
(
activity
)
onHidden
?.
invoke
()
onHidden
?.
invoke
()
...
@@ -311,7 +314,12 @@ object AdmobUtils {
...
@@ -311,7 +314,12 @@ object AdmobUtils {
}
}
}
}
private
fun
showIntervalDialogAndShowAd
(
activity
:
Activity
,
isLoadAdNow
:
Boolean
,
onHidden
:
(()
->
Unit
)?,
interval
:
Int
)
{
private
fun
showIntervalDialogAndShowAd
(
activity
:
Activity
,
isLoadAdNow
:
Boolean
,
onHidden
:
(()
->
Unit
)?,
interval
:
Int
)
{
val
customDialog
=
CustomDialog
(
activity
,
R
.
layout
.
dialog_ad_loading
)
val
customDialog
=
CustomDialog
(
activity
,
R
.
layout
.
dialog_ad_loading
)
customDialog
.
setCountdownText
(
R
.
id
.
dialog_ad_loading_text
)
customDialog
.
setCountdownText
(
R
.
id
.
dialog_ad_loading_text
)
val
countdownTimer
=
object
:
CountDownTimer
((
interval
*
1000
).
toLong
(),
1000
)
{
val
countdownTimer
=
object
:
CountDownTimer
((
interval
*
1000
).
toLong
(),
1000
)
{
...
@@ -330,7 +338,11 @@ object AdmobUtils {
...
@@ -330,7 +338,11 @@ object AdmobUtils {
customDialog
.
show
()
customDialog
.
show
()
}
}
private
fun
showCachedInterstitialAd
(
activity
:
Activity
,
isLoadAdNow
:
Boolean
,
onHidden
:
(()
->
Unit
)?)
{
private
fun
showCachedInterstitialAd
(
activity
:
Activity
,
isLoadAdNow
:
Boolean
,
onHidden
:
(()
->
Unit
)?
)
{
if
(
interAd
!=
null
)
{
if
(
interAd
!=
null
)
{
displayInterstitialAd
(
activity
,
onHidden
)
displayInterstitialAd
(
activity
,
onHidden
)
}
else
{
}
else
{
...
@@ -345,7 +357,11 @@ object AdmobUtils {
...
@@ -345,7 +357,11 @@ object AdmobUtils {
}
}
private
fun
showAdDialogAndLoadInterstitial
(
activity
:
Activity
,
isLoadAdNow
:
Boolean
,
onHidden
:
(()
->
Unit
)?)
{
private
fun
showAdDialogAndLoadInterstitial
(
activity
:
Activity
,
isLoadAdNow
:
Boolean
,
onHidden
:
(()
->
Unit
)?
)
{
var
mDialog
:
Dialog
?
=
null
var
mDialog
:
Dialog
?
=
null
mDialog
=
CustomDialog
(
activity
,
R
.
layout
.
dialog_ad_loading
)
mDialog
=
CustomDialog
(
activity
,
R
.
layout
.
dialog_ad_loading
)
mDialog
.
show
()
mDialog
.
show
()
...
@@ -405,7 +421,8 @@ object AdmobUtils {
...
@@ -405,7 +421,8 @@ object AdmobUtils {
if
(
lastAd
==
currentAd
)
{
if
(
lastAd
==
currentAd
)
{
multiClick
++
multiClick
++
if
(
multiClick
>=
maxMultiClick
)
{
if
(
multiClick
>=
maxMultiClick
)
{
AdDisplayUtils
.
getInstance
().
setAdClickCount
(
AdDisplayUtils
.
getInstance
().
maxAdClickCount
)
AdDisplayUtils
.
getInstance
()
.
setAdClickCount
(
AdDisplayUtils
.
getInstance
().
maxAdClickCount
)
ActivityManagerUtils
.
getInstance
().
finishAllActivity
()
ActivityManagerUtils
.
getInstance
().
finishAllActivity
()
return
return
}
}
...
@@ -418,10 +435,10 @@ object AdmobUtils {
...
@@ -418,10 +435,10 @@ object AdmobUtils {
}
}
private
fun
pull
(
private
fun
pull
(
responseInfo
:
ResponseInfo
?,
responseInfo
:
ResponseInfo
?,
adUnit
:
String
,
adUnit
:
String
,
error
:
String
?
=
null
,
error
:
String
?
=
null
,
reqId
:
String
?
=
null
reqId
:
String
?
=
null
)
{
)
{
val
obj
=
JSONObject
()
val
obj
=
JSONObject
()
if
(
responseInfo
!=
null
)
{
if
(
responseInfo
!=
null
)
{
...
@@ -430,9 +447,9 @@ object AdmobUtils {
...
@@ -430,9 +447,9 @@ object AdmobUtils {
obj
.
put
(
"source"
,
response
.
adSourceName
)
obj
.
put
(
"source"
,
response
.
adSourceName
)
val
credentials
=
mapOf
(
val
credentials
=
mapOf
(
"placementid"
to
response
.
credentials
.
get
(
"placementid"
),
"placementid"
to
response
.
credentials
.
get
(
"placementid"
),
"appid"
to
response
.
credentials
.
get
(
"appid"
),
"appid"
to
response
.
credentials
.
get
(
"appid"
),
"pubid"
to
response
.
credentials
.
get
(
"pubid"
)
"pubid"
to
response
.
credentials
.
get
(
"pubid"
)
)
)
obj
.
put
(
"credentials"
,
credentials
.
toString
())
obj
.
put
(
"credentials"
,
credentials
.
toString
())
}
}
...
@@ -447,6 +464,7 @@ object AdmobUtils {
...
@@ -447,6 +464,7 @@ object AdmobUtils {
obj
.
put
(
"errMsg"
,
error
)
obj
.
put
(
"errMsg"
,
error
)
obj
.
put
(
"status"
,
"2"
)
obj
.
put
(
"status"
,
"2"
)
}
}
EventUtils
.
event
(
"ad_pull"
,
ext
=
obj
)
}
}
private
fun
show
(
responseInfo
:
ResponseInfo
?,
adUnit
:
String
,
activity
:
Activity
?
=
null
)
{
private
fun
show
(
responseInfo
:
ResponseInfo
?,
adUnit
:
String
,
activity
:
Activity
?
=
null
)
{
...
@@ -456,13 +474,18 @@ object AdmobUtils {
...
@@ -456,13 +474,18 @@ object AdmobUtils {
obj
.
put
(
"ad_unit"
,
adUnit
)
obj
.
put
(
"ad_unit"
,
adUnit
)
obj
.
put
(
"networkname"
,
responseInfo
?.
mediationAdapterClassName
)
obj
.
put
(
"networkname"
,
responseInfo
?.
mediationAdapterClassName
)
val
credentials
=
mapOf
(
val
credentials
=
mapOf
(
"placementid"
to
response
?.
credentials
?.
get
(
"placementid"
),
"placementid"
to
response
?.
credentials
?.
get
(
"placementid"
),
"appid"
to
response
?.
credentials
?.
get
(
"appid"
),
"appid"
to
response
?.
credentials
?.
get
(
"appid"
),
"pubid"
to
response
?.
credentials
?.
get
(
"pubid"
)
"pubid"
to
response
?.
credentials
?.
get
(
"pubid"
)
)
)
obj
.
put
(
"credentials"
,
credentials
.
toString
())
obj
.
put
(
"credentials"
,
credentials
.
toString
())
obj
.
put
(
"session_id"
,
responseInfo
?.
responseId
)
obj
.
put
(
"session_id"
,
responseInfo
?.
responseId
)
obj
.
put
(
"from"
,
activity
?.
javaClass
?.
simpleName
)
obj
.
put
(
"from"
,
activity
?.
javaClass
?.
simpleName
)
if
(
adUnit
!=
"nativeAd"
)
{
EventUtils
.
event
(
"ad_show"
,
ext
=
obj
)
}
else
{
EventUtils
.
event
(
"bigimage_ad_show"
,
ext
=
obj
)
}
}
}
...
@@ -475,13 +498,18 @@ object AdmobUtils {
...
@@ -475,13 +498,18 @@ object AdmobUtils {
obj
.
put
(
"ad_unit"
,
adUnit
)
obj
.
put
(
"ad_unit"
,
adUnit
)
val
credentials
=
mapOf
(
val
credentials
=
mapOf
(
"placementid"
to
response
?.
credentials
?.
get
(
"placementid"
),
"placementid"
to
response
?.
credentials
?.
get
(
"placementid"
),
"appid"
to
response
?.
credentials
?.
get
(
"appid"
),
"appid"
to
response
?.
credentials
?.
get
(
"appid"
),
"pubid"
to
response
?.
credentials
?.
get
(
"pubid"
)
"pubid"
to
response
?.
credentials
?.
get
(
"pubid"
)
)
)
obj
.
put
(
"credentials"
,
credentials
.
toString
())
obj
.
put
(
"credentials"
,
credentials
.
toString
())
obj
.
put
(
"session_id"
,
responseInfo
?.
responseId
)
obj
.
put
(
"session_id"
,
responseInfo
?.
responseId
)
obj
.
put
(
"networkname"
,
responseInfo
?.
mediationAdapterClassName
)
obj
.
put
(
"networkname"
,
responseInfo
?.
mediationAdapterClassName
)
if
(
adUnit
!=
"nativeAd"
)
{
EventUtils
.
event
(
"ad_click"
,
ext
=
obj
)
}
else
{
EventUtils
.
event
(
"bigimage_ad_click"
,
ext
=
obj
)
}
}
}
private
val
taichiPref
by
lazy
{
private
val
taichiPref
by
lazy
{
...
@@ -525,8 +553,8 @@ object AdmobUtils {
...
@@ -525,8 +553,8 @@ object AdmobUtils {
if
(
currentTaichiTroasCache
>=
0.01
)
{
//如果超过0.01就触发一次tROAS taichi事件
if
(
currentTaichiTroasCache
>=
0.01
)
{
//如果超过0.01就触发一次tROAS taichi事件
val
roasbundle
=
Bundle
()
val
roasbundle
=
Bundle
()
roasbundle
.
putDouble
(
roasbundle
.
putDouble
(
FirebaseAnalytics
.
Param
.
VALUE
,
FirebaseAnalytics
.
Param
.
VALUE
,
currentTaichiTroasCache
.
toDouble
()
currentTaichiTroasCache
.
toDouble
()
)
)
roasbundle
.
putString
(
FirebaseAnalytics
.
Param
.
CURRENCY
,
"USD"
)
roasbundle
.
putString
(
FirebaseAnalytics
.
Param
.
CURRENCY
,
"USD"
)
Firebase
.
analytics
.
logEvent
(
"Total_Ads_Revenue_001"
,
roasbundle
)
Firebase
.
analytics
.
logEvent
(
"Total_Ads_Revenue_001"
,
roasbundle
)
...
@@ -625,6 +653,7 @@ object AdmobUtils {
...
@@ -625,6 +653,7 @@ object AdmobUtils {
obj
.
put
(
"session_id"
,
sessionId
)
obj
.
put
(
"session_id"
,
sessionId
)
}
}
}
}
EventUtils
.
event
(
"ad_price"
,
ext
=
obj
)
}
}
}
}
}
}
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