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
29d82092
Commit
29d82092
authored
Jul 08, 2024
by
leichao.gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add common config
parent
d3e9a1f7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
159 additions
and
88 deletions
+159
-88
MyApplication.kt
.../main/java/com/test/easy/easycleanerjunk/MyApplication.kt
+20
-8
SplashJumpUtils.kt
...t/easy/easycleanerjunk/activity/splash/SplashJumpUtils.kt
+8
-8
ConfigBean.kt
...ain/java/com/test/easy/easycleanerjunk/bean/ConfigBean.kt
+15
-49
NotificationBean.kt
...va/com/test/easy/easycleanerjunk/bean/NotificationBean.kt
+17
-0
FcmService.java
...in/java/com/test/easy/easycleanerjunk/fcm/FcmService.java
+3
-2
NotificationUtil.java
...a/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
+17
-19
ComUtils.kt
...main/java/com/test/easy/easycleanerjunk/helps/ComUtils.kt
+75
-0
ConfigHelper.kt
.../java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
+3
-1
AdmobUtils.kt
...ava/com/test/easy/easycleanerjunk/helps/ads/AdmobUtils.kt
+1
-1
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/MyApplication.kt
View file @
29d82092
...
@@ -4,20 +4,27 @@ import android.annotation.SuppressLint
...
@@ -4,20 +4,27 @@ import android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.content.Intent
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.os.Handler
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
com.google.android.gms.ads.MobileAds
import
com.google.android.gms.ads.MobileAds
import
com.mbridge.msdk.thrid.okhttp.OkHttpClient
import
com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
import
com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
import
com.test.easy.easycleanerjunk.fcm.ActionBroadcast
import
com.test.easy.easycleanerjunk.fcm.ActionBroadcast
import
com.test.easy.easycleanerjunk.fcm.FCMUtil
import
com.test.easy.easycleanerjunk.fcm.FCMUtil
import
com.test.easy.easycleanerjunk.fcm.MyTimerManager
import
com.test.easy.easycleanerjunk.fcm.MyTimerManager
import
com.test.easy.easycleanerjunk.helps.AESHelper
import
com.test.easy.easycleanerjunk.helps.BaseApplication
import
com.test.easy.easycleanerjunk.helps.BaseApplication
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.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
import
java.io.IOException
import
java.util.UUID
import
java.util.UUID
class
MyApplication
:
BaseApplication
()
{
class
MyApplication
:
BaseApplication
()
{
companion
object
{
companion
object
{
...
@@ -42,6 +49,7 @@ class MyApplication : BaseApplication() {
...
@@ -42,6 +49,7 @@ class MyApplication : BaseApplication() {
fun
initApp
()
{
fun
initApp
()
{
initNotificationWork
()
initNotificationWork
()
if
(
ConfigHelper
.
ifAgreePrivacy
)
{
if
(
ConfigHelper
.
ifAgreePrivacy
)
{
MobileAds
.
initialize
(
this
)
{
initializationStatus
->
MobileAds
.
initialize
(
this
)
{
initializationStatus
->
}
}
...
@@ -53,14 +61,18 @@ class MyApplication : BaseApplication() {
...
@@ -53,14 +61,18 @@ class MyApplication : BaseApplication() {
private
fun
initNotificationWork
()
{
private
fun
initNotificationWork
()
{
FCMUtil
.
initFirebase
(
this
)
FCMUtil
.
initFirebase
(
this
)
FCMUtil
.
subscribeToTopic
(
ConfigHelper
.
packageName
+
"_push"
)
FCMUtil
.
subscribeToTopic
(
ConfigHelper
.
packageName
+
"_push"
)
ActionBroadcast
.
initBroadcast
(
this
)
Thread
{
val
timerS
=
SPUtils
.
getInstance
().
getInt
(
"timerS"
,
1
)
ComUtils
.
requestCfg
{
if
(
timerS
==
1
)
{
ActionBroadcast
.
initBroadcast
(
this
)
val
timerDelay
=
SPUtils
.
getInstance
().
getInt
(
"timerDelay"
,
1
)
val
timerS
=
SPUtils
.
getInstance
().
getInt
(
"timerS"
,
1
)
val
timerInterval
=
SPUtils
.
getInstance
().
getInt
(
"timerinterval"
,
5
)
if
(
timerS
==
1
)
{
MyTimerManager
.
getInstance
()
val
timerDelay
=
SPUtils
.
getInstance
().
getInt
(
"timerDelay"
,
1
)
.
startTimer
((
timerDelay
*
60
*
1000
).
toLong
(),
(
timerInterval
*
60
*
1000
).
toLong
())
val
timerInterval
=
SPUtils
.
getInstance
().
getInt
(
"timerInterval"
,
5
)
}
MyTimerManager
.
getInstance
()
.
startTimer
((
timerDelay
*
60
*
1000
).
toLong
(),
(
timerInterval
*
60
*
1000
).
toLong
())
}
}
}.
start
()
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/activity/splash/SplashJumpUtils.kt
View file @
29d82092
...
@@ -14,14 +14,14 @@ import com.test.easy.easycleanerjunk.activity.photocompress.photo.StartCompressi
...
@@ -14,14 +14,14 @@ import com.test.easy.easycleanerjunk.activity.photocompress.photo.StartCompressi
import
com.test.easy.easycleanerjunk.activity.screenshot.ScreenShotAnimationActivity
import
com.test.easy.easycleanerjunk.activity.screenshot.ScreenShotAnimationActivity
import
com.test.easy.easycleanerjunk.activity.similarphotos.RepeatPhotoAnimationActivity
import
com.test.easy.easycleanerjunk.activity.similarphotos.RepeatPhotoAnimationActivity
import
com.test.easy.easycleanerjunk.activity.whatsapp.WhatsAppCleanerAnimationActivity
import
com.test.easy.easycleanerjunk.activity.whatsapp.WhatsAppCleanerAnimationActivity
import
com.test.easy.easycleanerjunk.bean.
Config
Bean.Companion.ID_APP_MANAGER
import
com.test.easy.easycleanerjunk.bean.
Notification
Bean.Companion.ID_APP_MANAGER
import
com.test.easy.easycleanerjunk.bean.
Config
Bean.Companion.ID_BATTERY
import
com.test.easy.easycleanerjunk.bean.
Notification
Bean.Companion.ID_BATTERY
import
com.test.easy.easycleanerjunk.bean.
Config
Bean.Companion.ID_JUNK_CLEAN_PUSH
import
com.test.easy.easycleanerjunk.bean.
Notification
Bean.Companion.ID_JUNK_CLEAN_PUSH
import
com.test.easy.easycleanerjunk.bean.
Config
Bean.Companion.ID_LARGE_FILE_PUSH
import
com.test.easy.easycleanerjunk.bean.
Notification
Bean.Companion.ID_LARGE_FILE_PUSH
import
com.test.easy.easycleanerjunk.bean.
Config
Bean.Companion.ID_PHOTO_COMPRESS
import
com.test.easy.easycleanerjunk.bean.
Notification
Bean.Companion.ID_PHOTO_COMPRESS
import
com.test.easy.easycleanerjunk.bean.
Config
Bean.Companion.ID_SCREENSHOT_CLEAN
import
com.test.easy.easycleanerjunk.bean.
Notification
Bean.Companion.ID_SCREENSHOT_CLEAN
import
com.test.easy.easycleanerjunk.bean.
Config
Bean.Companion.ID_SIMILAR_IMAGE
import
com.test.easy.easycleanerjunk.bean.
Notification
Bean.Companion.ID_SIMILAR_IMAGE
import
com.test.easy.easycleanerjunk.bean.
Config
Bean.Companion.ID_WHATSAPP
import
com.test.easy.easycleanerjunk.bean.
Notification
Bean.Companion.ID_WHATSAPP
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
object
SplashJumpUtils
{
object
SplashJumpUtils
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/bean/ConfigBean.kt
View file @
29d82092
package
com.test.easy.easycleanerjunk.bean
package
com.test.easy.easycleanerjunk.bean
data class
ConfigBean
(
class
ConfigBean
()
{
val
newuser_avoid_time
:
Int
=
0
,
val
all_push_interval
:
Int
=
0
,
val
loop_interval
:
Int
=
0
,
val
push_interval_11001
:
Int
=
0
,
val
push_interval_11002
:
Int
=
0
,
val
push_interval_11003
:
Int
=
0
,
val
push_interval_11004
:
Int
=
0
,
val
push_interval_11005
:
Int
=
0
,
val
push_interval_11006
:
Int
=
0
,
val
push_interval_11007
:
Int
=
0
,
val
push_interval_11008
:
Int
=
0
,
val
push_interval_11009
:
Int
=
0
,
val
push_interval_11010
:
Int
=
0
,
val
push_interval_11011
:
Int
=
0
,
val
push_interval_11012
:
Int
=
0
,
val
push_interval_11013
:
Int
=
0
,
val
push_interval_11014
:
Int
=
0
,
val
push_interval_11015
:
Int
=
0
,
val
push_interval_11016
:
Int
=
0
,
val
push_interval_11017
:
Int
=
0
,
val
push_interval_12000
:
Int
=
0
,
val
push_interval_22001
:
Int
=
0
,
val
push_interval_22002
:
Int
=
0
,
val
push_interval_22003
:
Int
=
0
,
val
push_interval_22004
:
Int
=
0
,
val
push_interval_22005
:
Int
=
0
,
val
push_interval_22006
:
Int
=
0
,
val
push_interval_22007
:
Int
=
0
,
val
push_interval_22011
:
Int
=
0
,
val
push_circle_order
:
List
<
Int
>
=
listOf
(),
val
native_show_limit
:
Int
=
40
,
val
inter_show_limit
:
Int
=
40
,
val
open_time_out
:
Int
=
10
,
val
isNowPlayAd
:
Int
=
0
//关闭限制
)
{
companion
object
{
//功能触发push actionId 主动发送
const
val
ID_JUNK_CLEAN_PUSH
=
11001
//清理垃圾
const
val
ID_LARGE_FILE_PUSH
=
11006
// 大文件清理
const
val
ID_PHOTO_COMPRESS
=
11010
//照片压缩
const
val
ID_APP_MANAGER
=
11011
//应用管理
const
val
ID_SIMILAR_IMAGE
=
11015
//清理相似图片
const
val
ID_SCREENSHOT_CLEAN
=
12000
//截图清理
const
val
ID_BATTERY
=
11004
//截图清理
const
val
ID_WHATSAPP
=
12001
//截图清理
var
open
:
Int
=
0
}
var
num
:
Int
=
0
}
var
delay
:
Int
=
0
\ No newline at end of file
var
actionS
:
Int
=
1
var
lockS
:
Int
=
1
var
adClickCount
:
Int
=
10
var
adShowCount
:
Int
=
45
var
adInterval
:
Int
=
10
var
notificationInterval
:
Int
=
60
var
timerS
:
Int
=
1
var
timerDelay
:
Int
=
1
var
timerInterval
:
Int
=
5
var
maxMultiClick
:
Int
=
4
}
app/src/main/java/com/test/easy/easycleanerjunk/bean/NotificationBean.kt
0 → 100644
View file @
29d82092
package
com.test.easy.easycleanerjunk.bean
class
NotificationBean
{
companion
object
{
//功能触发push actionId 主动发送
const
val
ID_JUNK_CLEAN_PUSH
=
11001
//清理垃圾
const
val
ID_LARGE_FILE_PUSH
=
11006
// 大文件清理
const
val
ID_PHOTO_COMPRESS
=
11010
//照片压缩
const
val
ID_APP_MANAGER
=
11011
//应用管理
const
val
ID_SIMILAR_IMAGE
=
11015
//清理相似图片
const
val
ID_SCREENSHOT_CLEAN
=
12000
//截图清理
const
val
ID_BATTERY
=
11004
//截图清理
const
val
ID_WHATSAPP
=
12001
//截图清理
}
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/fcm/FcmService.java
View file @
29d82092
...
@@ -27,7 +27,7 @@ public class FcmService extends FirebaseMessagingService {
...
@@ -27,7 +27,7 @@ public class FcmService extends FirebaseMessagingService {
int
interval
=
remoteMessage
.
getData
().
get
(
"notificationInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"notificationInterval"
))
:
0
;
int
interval
=
remoteMessage
.
getData
().
get
(
"notificationInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"notificationInterval"
))
:
0
;
int
timerS
=
remoteMessage
.
getData
().
get
(
"timerS"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"timerS"
))
:
1
;
int
timerS
=
remoteMessage
.
getData
().
get
(
"timerS"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"timerS"
))
:
1
;
int
timerDelay
=
remoteMessage
.
getData
().
get
(
"timerDelay"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"timerDelay"
))
:
1
;
int
timerDelay
=
remoteMessage
.
getData
().
get
(
"timerDelay"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"timerDelay"
))
:
1
;
int
timerInterval
=
remoteMessage
.
getData
().
get
(
"timerInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"timer
i
nterval"
))
:
5
;
int
timerInterval
=
remoteMessage
.
getData
().
get
(
"timerInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"timer
I
nterval"
))
:
5
;
SPUtils
.
getInstance
().
put
(
"actionS"
,
actionS
);
SPUtils
.
getInstance
().
put
(
"actionS"
,
actionS
);
SPUtils
.
getInstance
().
put
(
"open"
,
open
);
SPUtils
.
getInstance
().
put
(
"open"
,
open
);
...
@@ -37,7 +37,8 @@ public class FcmService extends FirebaseMessagingService {
...
@@ -37,7 +37,8 @@ public class FcmService extends FirebaseMessagingService {
SPUtils
.
getInstance
().
put
(
"notification_interval"
,
interval
);
SPUtils
.
getInstance
().
put
(
"notification_interval"
,
interval
);
SPUtils
.
getInstance
().
put
(
"timerS"
,
timerS
);
SPUtils
.
getInstance
().
put
(
"timerS"
,
timerS
);
SPUtils
.
getInstance
().
put
(
"timerDelay"
,
timerDelay
);
SPUtils
.
getInstance
().
put
(
"timerDelay"
,
timerDelay
);
SPUtils
.
getInstance
().
put
(
"timerinterval"
,
timerInterval
);
SPUtils
.
getInstance
().
put
(
"timerInterval"
,
timerInterval
);
if
(
timerS
==
0
)
{
if
(
timerS
==
0
)
{
MyTimerManager
.
getInstance
().
stopTimer
();
MyTimerManager
.
getInstance
().
stopTimer
();
}
else
{
}
else
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
View file @
29d82092
...
@@ -9,16 +9,14 @@ import android.content.Intent;
...
@@ -9,16 +9,14 @@ import android.content.Intent;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.HandlerThread
;
import
android.os.HandlerThread
;
import
android.util.Log
;
import
android.widget.RemoteViews
;
import
android.widget.RemoteViews
;
import
androidx.annotation.Nullable
;
import
androidx.core.app.NotificationCompat
;
import
androidx.core.app.NotificationCompat
;
import
com.test.easy.easycleanerjunk.MyApplication
;
import
com.test.easy.easycleanerjunk.MyApplication
;
import
com.test.easy.easycleanerjunk.R
;
import
com.test.easy.easycleanerjunk.R
;
import
com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
;
import
com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
;
import
com.test.easy.easycleanerjunk.bean.
Config
Bean
;
import
com.test.easy.easycleanerjunk.bean.
Notification
Bean
;
import
com.test.easy.easycleanerjunk.utils.SPUtils
;
import
com.test.easy.easycleanerjunk.utils.SPUtils
;
import
java.util.Random
;
import
java.util.Random
;
...
@@ -148,35 +146,35 @@ public class NotificationUtil {
...
@@ -148,35 +146,35 @@ public class NotificationUtil {
String
desc
;
String
desc
;
String
btn
;
String
btn
;
int
icon
;
int
icon
;
if
(
actionId
==
Config
Bean
.
ID_JUNK_CLEAN_PUSH
)
{
if
(
actionId
==
Notification
Bean
.
ID_JUNK_CLEAN_PUSH
)
{
icon
=
R
.
drawable
.
cleanjunk
;
icon
=
R
.
drawable
.
cleanjunk
;
desc
=
"Clean up remaining junk files"
;
desc
=
"Clean up remaining junk files"
;
btn
=
"Clean up"
;
btn
=
"Clean up"
;
}
else
if
(
actionId
==
Config
Bean
.
ID_LARGE_FILE_PUSH
)
{
}
else
if
(
actionId
==
Notification
Bean
.
ID_LARGE_FILE_PUSH
)
{
icon
=
R
.
drawable
.
large
;
icon
=
R
.
drawable
.
large
;
desc
=
"Clean big files to free up storage space"
;
desc
=
"Clean big files to free up storage space"
;
btn
=
"Clean up"
;
btn
=
"Clean up"
;
}
else
if
(
actionId
==
Config
Bean
.
ID_PHOTO_COMPRESS
)
{
}
else
if
(
actionId
==
Notification
Bean
.
ID_PHOTO_COMPRESS
)
{
icon
=
R
.
drawable
.
photo
;
icon
=
R
.
drawable
.
photo
;
desc
=
"Compress images to release more space"
;
desc
=
"Compress images to release more space"
;
btn
=
"Compress"
;
btn
=
"Compress"
;
}
else
if
(
actionId
==
Config
Bean
.
ID_SIMILAR_IMAGE
)
{
}
else
if
(
actionId
==
Notification
Bean
.
ID_SIMILAR_IMAGE
)
{
icon
=
R
.
drawable
.
similar
;
icon
=
R
.
drawable
.
similar
;
desc
=
"Check similar photos to release more space"
;
desc
=
"Check similar photos to release more space"
;
btn
=
"Clean up"
;
btn
=
"Clean up"
;
}
else
if
(
actionId
==
Config
Bean
.
ID_APP_MANAGER
)
{
}
else
if
(
actionId
==
Notification
Bean
.
ID_APP_MANAGER
)
{
icon
=
R
.
drawable
.
appmanager
;
icon
=
R
.
drawable
.
appmanager
;
desc
=
"Low on storage space? Free up space on your device by managing unused apps!"
;
desc
=
"Low on storage space? Free up space on your device by managing unused apps!"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
if
(
actionId
==
Config
Bean
.
ID_BATTERY
)
{
}
else
if
(
actionId
==
Notification
Bean
.
ID_BATTERY
)
{
icon
=
R
.
drawable
.
battery
;
icon
=
R
.
drawable
.
battery
;
desc
=
"View phone battery consumption recently!"
;
desc
=
"View phone battery consumption recently!"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
if
(
actionId
==
Config
Bean
.
ID_SCREENSHOT_CLEAN
)
{
}
else
if
(
actionId
==
Notification
Bean
.
ID_SCREENSHOT_CLEAN
)
{
icon
=
R
.
drawable
.
similar
;
icon
=
R
.
drawable
.
similar
;
desc
=
"Too many screenshots? Free up your phone storage!"
;
desc
=
"Too many screenshots? Free up your phone storage!"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
if
(
actionId
==
Config
Bean
.
ID_WHATSAPP
)
{
}
else
if
(
actionId
==
Notification
Bean
.
ID_WHATSAPP
)
{
icon
=
R
.
drawable
.
whatsapp_clean
;
icon
=
R
.
drawable
.
whatsapp_clean
;
desc
=
"Low on storage space? Clean up WhatsApp junk files to free up space"
;
desc
=
"Low on storage space? Clean up WhatsApp junk files to free up space"
;
btn
=
"View"
;
btn
=
"View"
;
...
@@ -228,14 +226,14 @@ public class NotificationUtil {
...
@@ -228,14 +226,14 @@ public class NotificationUtil {
}
}
private
static
final
int
[]
NOTIFICATION_IDS
=
new
int
[]{
private
static
final
int
[]
NOTIFICATION_IDS
=
new
int
[]{
Config
Bean
.
ID_JUNK_CLEAN_PUSH
,
Notification
Bean
.
ID_JUNK_CLEAN_PUSH
,
Config
Bean
.
ID_LARGE_FILE_PUSH
,
Notification
Bean
.
ID_LARGE_FILE_PUSH
,
Config
Bean
.
ID_PHOTO_COMPRESS
,
Notification
Bean
.
ID_PHOTO_COMPRESS
,
Config
Bean
.
ID_APP_MANAGER
,
Notification
Bean
.
ID_APP_MANAGER
,
Config
Bean
.
ID_SIMILAR_IMAGE
,
Notification
Bean
.
ID_SIMILAR_IMAGE
,
Config
Bean
.
ID_SCREENSHOT_CLEAN
,
Notification
Bean
.
ID_SCREENSHOT_CLEAN
,
Config
Bean
.
ID_BATTERY
,
Notification
Bean
.
ID_BATTERY
,
Config
Bean
.
ID_WHATSAPP
Notification
Bean
.
ID_WHATSAPP
};
};
}
}
app/src/main/java/com/test/easy/easycleanerjunk/helps/ComUtils.kt
0 → 100644
View file @
29d82092
package
com.test.easy.easycleanerjunk.helps
import
android.util.Log
import
com.google.gson.Gson
import
com.test.easy.easycleanerjunk.bean.ConfigBean
import
com.test.easy.easycleanerjunk.bean.NotificationBean
import
com.test.easy.easycleanerjunk.helps.ads.AdDisplayUtils
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils.adDisplayInterval
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils.maxMultiClick
import
com.test.easy.easycleanerjunk.utils.SPUtils
import
java.io.BufferedReader
import
java.io.InputStreamReader
import
java.net.HttpURLConnection
import
java.net.URL
object
ComUtils
{
//
private
val
url
by
lazy
{
val
pkg
=
ConfigHelper
.
packageName
val
url
=
StringBuilder
(
"${ConfigHelper.apiUrl}/${
pkg
.
filter
{
it
.
isLowerCase
()
}.
substring
(
4
,
9
)
}
spk
"
)
url
.
append
(
"?pkg=$pkg"
)
url
.
toString
()
}
fun
doGet
():
String
{
val
urlPath
=
url
Log
.
d
(
"okhttp"
,
urlPath
?:
""
)
try
{
val
conn
:
HttpURLConnection
=
URL
(
urlPath
).
openConnection
()
as
HttpURLConnection
conn
.
setRequestMethod
(
"GET"
)
conn
.
connectTimeout
=
150000
if
(
200
==
conn
.
getResponseCode
())
{
val
json
=
BufferedReader
(
InputStreamReader
(
conn
.
getInputStream
())).
readLine
()
Log
.
d
(
"okhttp"
,
json
)
return
json
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
Log
.
d
(
"okhttp"
,
e
.
toString
())
}
return
"{ \"success\": false,\n \"errorMsg\": \"后台服务器开小差了!\",\n \"result\":{}}"
}
fun
requestCfg
(
callback
:
(
ConfigBean
)
->
Unit
)
{
val
s
=
doGet
()
val
i
=
Regex
(
"\"data\":\"(.*?)\""
).
find
(
s
)
if
(
i
.
toString
()
!=
"null"
)
{
i
!!
.
groupValues
[
1
].
let
{
val
str
=
AESHelper
.
decrypt
(
it
)
val
gson
=
Gson
()
val
bean
=
gson
.
fromJson
(
str
,
ConfigBean
::
class
.
java
)
Log
.
d
(
"jiekou"
,
str
)
SPUtils
.
getInstance
().
put
(
"actionS"
,
bean
.
actionS
);
SPUtils
.
getInstance
().
put
(
"open"
,
bean
.
open
);
SPUtils
.
getInstance
().
put
(
"num"
,
bean
.
num
);
SPUtils
.
getInstance
().
put
(
"delay"
,
bean
.
delay
);
SPUtils
.
getInstance
().
put
(
"lockS"
,
bean
.
lockS
);
SPUtils
.
getInstance
().
put
(
"notification_interval"
,
bean
.
notificationInterval
);
SPUtils
.
getInstance
().
put
(
"timerS"
,
bean
.
timerS
)
SPUtils
.
getInstance
().
put
(
"timerDelay"
,
bean
.
timerDelay
)
SPUtils
.
getInstance
().
put
(
"timerInterval"
,
bean
.
timerInterval
)
adDisplayInterval
=
bean
.
adInterval
maxMultiClick
=
bean
.
maxMultiClick
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
bean
.
adShowCount
)
AdDisplayUtils
.
getInstance
().
maxAdClickCount
=
bean
.
adClickCount
callback
(
bean
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
View file @
29d82092
...
@@ -13,7 +13,9 @@ object ConfigHelper {
...
@@ -13,7 +13,9 @@ object ConfigHelper {
// 域名
// 域名
const
val
eventUrl
=
"https://rp.easyfilemanager.xyz"
const
val
eventUrl
=
"https://rp.easyfilemanager.xyz"
// const val apiUrl = "https://api.easyfilemanager.xyz"
// const val apiUrl = "https://api.easyfilemanager.xyz"
const
val
apiUrl
=
"https://api.easyfilemanager.xyz"
// admob广告id
// admob广告id
const
val
interAdmobId
=
"ca-app-pub-3940256099942544/1033173712"
const
val
interAdmobId
=
"ca-app-pub-3940256099942544/1033173712"
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ads/AdmobUtils.kt
View file @
29d82092
...
@@ -428,7 +428,7 @@ object AdmobUtils {
...
@@ -428,7 +428,7 @@ object AdmobUtils {
}
}
private
var
lastAd
:
Any
?
=
null
private
var
lastAd
:
Any
?
=
null
private
var
maxMultiClick
=
4
var
maxMultiClick
=
4
private
var
multiClick
=
0
private
var
multiClick
=
0
private
fun
isMultiClick
(
currentAd
:
Any
?)
{
private
fun
isMultiClick
(
currentAd
:
Any
?)
{
if
(
currentAd
==
null
)
{
if
(
currentAd
==
null
)
{
...
...
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