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
7543625b
Commit
7543625b
authored
Jul 09, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...ump
parent
fbc2465c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
46 deletions
+48
-46
MyApplication.kt
.../main/java/com/test/easy/easycleanerjunk/MyApplication.kt
+4
-1
NewSplashActivity.kt
...easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
+0
-5
PrivacyAgreementManager.kt
...asycleanerjunk/activity/splash/PrivacyAgreementManager.kt
+4
-22
HomeFragment.kt
...va/com/test/easy/easycleanerjunk/fragment/HomeFragment.kt
+14
-1
ConfigHelper.kt
.../java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
+0
-9
UmpHelp.kt
.../main/java/com/test/easy/easycleanerjunk/helps/UmpHelp.kt
+26
-8
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/MyApplication.kt
View file @
7543625b
...
@@ -18,6 +18,7 @@ import com.test.easy.easycleanerjunk.helps.BaseApplication
...
@@ -18,6 +18,7 @@ import com.test.easy.easycleanerjunk.helps.BaseApplication
import
com.test.easy.easycleanerjunk.helps.ComUtils
import
com.test.easy.easycleanerjunk.helps.ComUtils
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.InstallHelps
import
com.test.easy.easycleanerjunk.helps.InstallHelps
import
com.test.easy.easycleanerjunk.helps.UmpHelp.canRequestAds
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import
com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import
com.test.easy.easycleanerjunk.utils.SPUtils
import
com.test.easy.easycleanerjunk.utils.SPUtils
...
@@ -51,8 +52,10 @@ class MyApplication : BaseApplication() {
...
@@ -51,8 +52,10 @@ class MyApplication : BaseApplication() {
initNotificationWork
()
initNotificationWork
()
if
(
ConfigHelper
.
ifAgreePrivacy
)
{
if
(
ConfigHelper
.
ifAgreePrivacy
)
{
if
(
context
.
canRequestAds
())
{
MobileAds
.
initialize
(
this
)
{
initializationStatus
->
MobileAds
.
initialize
(
this
)
{
initializationStatus
->
}
}
}
InstallHelps
.
init
()
InstallHelps
.
init
()
}
}
initLifeListener
()
initLifeListener
()
...
...
app/src/main/java/com/test/easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
View file @
7543625b
...
@@ -13,13 +13,8 @@ import com.test.easy.easycleanerjunk.fcm.CloseNotificationReceiver
...
@@ -13,13 +13,8 @@ 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.ConfigHelper.remainNotification
import
com.test.easy.easycleanerjunk.helps.ConfigHelper.umpGathered
import
com.test.easy.easycleanerjunk.helps.EventUtils
import
com.test.easy.easycleanerjunk.helps.EventUtils
import
com.test.easy.easycleanerjunk.helps.LogEx
import
com.test.easy.easycleanerjunk.helps.UmpHelp.requestUMP
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.Companion.startNotification
import
com.test.easy.easycleanerjunk.service.PermanentNotificationService.Companion.startNotification
import
com.test.easy.easycleanerjunk.utils.BarUtils
import
com.test.easy.easycleanerjunk.utils.BarUtils
...
...
app/src/main/java/com/test/easy/easycleanerjunk/activity/splash/PrivacyAgreementManager.kt
View file @
7543625b
...
@@ -6,6 +6,7 @@ import android.net.Uri
...
@@ -6,6 +6,7 @@ import android.net.Uri
import
android.text.SpannableString
import
android.text.SpannableString
import
android.text.Spanned
import
android.text.Spanned
import
android.text.style.UnderlineSpan
import
android.text.style.UnderlineSpan
import
android.widget.Toast
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
...
@@ -33,7 +34,6 @@ class PrivacyAgreementManager {
...
@@ -33,7 +34,6 @@ class PrivacyAgreementManager {
private
fun
initView
()
{
private
fun
initView
()
{
val
spannableString
=
SpannableString
(
"Privacy Policy"
)
val
spannableString
=
SpannableString
(
"Privacy Policy"
)
spannableString
.
setSpan
(
spannableString
.
setSpan
(
UnderlineSpan
(),
UnderlineSpan
(),
...
@@ -57,28 +57,10 @@ class PrivacyAgreementManager {
...
@@ -57,28 +57,10 @@ class PrivacyAgreementManager {
return
@setOnClickListener
return
@setOnClickListener
}
}
clicked
=
true
clicked
=
true
// binding.idTvStart.isVisible = false
// binding.idLlJindu.isVisible = true
// binding.idLlYinsi.isVisible = false
ConfigHelper
.
ifAgreePrivacy
=
true
ConfigHelper
.
ifAgreePrivacy
=
true
context
.
requestUMP
(
loadAndShowErrorAction
=
{},
formErrorAction
=
{},
gatheredAction
=
{
// LogEx.logDebug(TAG, "gatherAction $it")
// ConfigHelper.umpGathered = it
// (context.application as MyApplication).initApp()
//
// listener.onAgreePrivacy()
// EventUtils.event("app_start")
},
dialogAction
=
{
LogEx
.
logDebug
(
TAG
,
"dialogAction $it"
)
ConfigHelper
.
umpGathered
=
it
(
context
.
application
as
MyApplication
).
initApp
()
(
context
.
application
as
MyApplication
).
initApp
()
listener
.
onAgreePrivacy
()
listener
.
onAgreePrivacy
()
EventUtils
.
event
(
"app_start"
)
EventUtils
.
event
(
"app_start"
)
})
}
}
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fragment/HomeFragment.kt
View file @
7543625b
...
@@ -5,6 +5,7 @@ import android.annotation.SuppressLint
...
@@ -5,6 +5,7 @@ import android.annotation.SuppressLint
import
android.content.Intent
import
android.content.Intent
import
android.view.animation.LinearInterpolator
import
android.view.animation.LinearInterpolator
import
android.widget.ScrollView
import
android.widget.ScrollView
import
android.widget.Toast
import
androidx.core.view.updatePadding
import
androidx.core.view.updatePadding
import
com.test.easy.easycleanerjunk.activity.scanjunk.ScanJunkActivity
import
com.test.easy.easycleanerjunk.activity.scanjunk.ScanJunkActivity
import
com.test.easy.easycleanerjunk.activity.SettingActivity
import
com.test.easy.easycleanerjunk.activity.SettingActivity
...
@@ -17,6 +18,7 @@ import com.test.easy.easycleanerjunk.activity.similarphotos.RepeatPhotoAnimation
...
@@ -17,6 +18,7 @@ import com.test.easy.easycleanerjunk.activity.similarphotos.RepeatPhotoAnimation
import
com.test.easy.easycleanerjunk.activity.whatsapp.WhatsAppCleanerAnimationActivity
import
com.test.easy.easycleanerjunk.activity.whatsapp.WhatsAppCleanerAnimationActivity
import
com.test.easy.easycleanerjunk.databinding.FragmentLayoutHomeBinding
import
com.test.easy.easycleanerjunk.databinding.FragmentLayoutHomeBinding
import
com.test.easy.easycleanerjunk.helps.BaseFragment
import
com.test.easy.easycleanerjunk.helps.BaseFragment
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.KotlinExt.setOnClickListener
import
com.test.easy.easycleanerjunk.helps.KotlinExt.setOnClickListener
import
com.test.easy.easycleanerjunk.helps.UmpHelp.requestUMP
import
com.test.easy.easycleanerjunk.helps.UmpHelp.requestUMP
import
com.test.easy.easycleanerjunk.utils.BarUtils
import
com.test.easy.easycleanerjunk.utils.BarUtils
...
@@ -72,7 +74,18 @@ class HomeFragment : BaseFragment<FragmentLayoutHomeBinding>() {
...
@@ -72,7 +74,18 @@ class HomeFragment : BaseFragment<FragmentLayoutHomeBinding>() {
binding
.
idScrollView
.
fullScroll
(
ScrollView
.
FOCUS_DOWN
)
binding
.
idScrollView
.
fullScroll
(
ScrollView
.
FOCUS_DOWN
)
}
}
listOf
(
binding
.
idCleanJunk
,
binding
.
idFlClean
,
binding
.
idCleanUp
).
setOnClickListener
{
listOf
(
binding
.
idCleanJunk
,
binding
.
idFlClean
,
binding
.
idCleanUp
).
setOnClickListener
{
startActivity
(
Intent
(
requireContext
(),
ScanJunkActivity
::
class
.
java
))
// startActivity(Intent(requireContext(), ScanJunkActivity::class.java))
requireActivity
().
requestUMP
(
loadAndShowErrorAction
=
{
Toast
.
makeText
(
context
,
"loadAndShowErrorAction"
,
Toast
.
LENGTH_SHORT
).
show
()
},
formErrorAction
=
{
Toast
.
makeText
(
context
,
"formErrorAction"
,
Toast
.
LENGTH_SHORT
).
show
()
},
dialogAction
=
{
Toast
.
makeText
(
context
,
"dialogAction flag=$it"
,
Toast
.
LENGTH_SHORT
).
show
()
})
}
}
binding
.
idPhotoCompress
.
setOnClickListener
{
binding
.
idPhotoCompress
.
setOnClickListener
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
View file @
7543625b
...
@@ -40,15 +40,6 @@ object ConfigHelper {
...
@@ -40,15 +40,6 @@ object ConfigHelper {
SPUtils
.
getInstance
().
put
(
"junkSizeClean"
,
value
)
SPUtils
.
getInstance
().
put
(
"junkSizeClean"
,
value
)
}
}
var
umpGathered
=
true
get
()
{
return
SPUtils
.
getInstance
().
getBoolean
(
"umpGathered"
,
field
)
}
set
(
value
)
{
field
=
value
SPUtils
.
getInstance
().
put
(
"umpGathered"
,
value
,
true
)
}
var
ifAgreePrivacy
=
false
var
ifAgreePrivacy
=
false
get
()
{
get
()
{
return
SPUtils
.
getInstance
().
getBoolean
(
"ifAgreePrivacy"
,
field
)
return
SPUtils
.
getInstance
().
getBoolean
(
"ifAgreePrivacy"
,
field
)
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/UmpHelp.kt
View file @
7543625b
package
com.test.easy.easycleanerjunk.helps
package
com.test.easy.easycleanerjunk.helps
import
android.app.Activity
import
android.app.Activity
import
android.content.Context
import
com.google.android.ump.ConsentDebugSettings
import
com.google.android.ump.ConsentForm.OnConsentFormDismissedListener
import
com.google.android.ump.ConsentForm.OnConsentFormDismissedListener
import
com.google.android.ump.ConsentInformation.OnConsentInfoUpdateFailureListener
import
com.google.android.ump.ConsentInformation.OnConsentInfoUpdateFailureListener
import
com.google.android.ump.ConsentRequestParameters
import
com.google.android.ump.ConsentRequestParameters
import
com.google.android.ump.FormError
import
com.google.android.ump.FormError
import
com.google.android.ump.UserMessagingPlatform
import
com.google.android.ump.UserMessagingPlatform
import
com.test.easy.easycleanerjunk.BuildConfig
import
com.test.easy.easycleanerjunk.helps.UmpHelp.requestUMP
object
UmpHelp
{
object
UmpHelp
{
private
fun
Context
.
umpTest
():
ConsentDebugSettings
{
val
debugSettings
=
ConsentDebugSettings
.
Builder
(
this
)
debugSettings
.
addTestDeviceHashedId
(
"TEST-DEVICE-HASHED-ID"
)
debugSettings
.
addTestDeviceHashedId
(
"33BE2250B43518CCDA7DE426D04EE231"
)
return
debugSettings
.
build
()
}
private
val
TAG
=
"UmpHelp"
private
val
TAG
=
"UmpHelp"
fun
Activity
.
requestUMP
(
fun
Activity
.
requestUMP
(
loadAndShowErrorAction
:
(()
->
Unit
)?
=
null
,
//加载弹出错误
loadAndShowErrorAction
:
(()
->
Unit
)?
=
null
,
//加载弹出错误
formErrorAction
:
(()
->
Unit
)?
=
null
,
//请求错误
formErrorAction
:
(()
->
Unit
)?
=
null
,
//请求错误
gatheredAction
:
((
flag
:
Boolean
)
->
Unit
)?
=
null
,
//已经授权过
dialogAction
:
((
flag
:
Boolean
)
->
Unit
)?
=
null
,
//dialog授权
dialogAction
:
((
flag
:
Boolean
)
->
Unit
)?
=
null
,
//dialog授权
)
{
)
{
val
paramsBuild
=
ConsentRequestParameters
.
Builder
()
if
(
BuildConfig
.
DEBUG
)
{
paramsBuild
.
setConsentDebugSettings
(
umpTest
())
}
val
params
=
ConsentRequestParameters
.
Builder
()
// 指示用户是否低于同意年龄; true 低于同意年龄
// 指示用户是否低于同意年龄; true 低于同意年龄
// 未满同意年龄的用户不会收到 GDPR 消息表单
// 未满同意年龄的用户不会收到 GDPR 消息表单
.
setTagForUnderAgeOfConsent
(
false
)
paramsBuild
.
setTagForUnderAgeOfConsent
(
false
)
.
build
()
val
params
=
paramsBuild
.
build
()
val
consentInformation
=
UserMessagingPlatform
.
getConsentInformation
(
this
)
val
consentInformation
=
UserMessagingPlatform
.
getConsentInformation
(
this
)
consentInformation
.
requestConsentInfoUpdate
(
consentInformation
.
requestConsentInfoUpdate
(
...
@@ -43,8 +59,10 @@ object UmpHelp {
...
@@ -43,8 +59,10 @@ object UmpHelp {
LogEx
.
logDebug
(
TAG
,
"FormError=${requestConsentError?.errorCode} ${requestConsentError?.message}"
)
LogEx
.
logDebug
(
TAG
,
"FormError=${requestConsentError?.errorCode} ${requestConsentError?.message}"
)
formErrorAction
?.
invoke
()
formErrorAction
?.
invoke
()
})
})
}
// 授权完成,初始化SDK
fun
Context
.
canRequestAds
():
Boolean
{
gatheredAction
?.
invoke
(
consentInformation
.
canRequestAds
())
val
consentInformation
=
UserMessagingPlatform
.
getConsentInformation
(
this
)
return
consentInformation
.
canRequestAds
()
}
}
}
}
\ 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