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
1c224f88
Commit
1c224f88
authored
Jul 11, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.huolea.com:koko/data-recovery-white
parents
c5de749d
3833952b
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
65 additions
and
116 deletions
+65
-116
MyApplication.kt
app/src/main/java/com/base/datarecovery/MyApplication.kt
+5
-0
RepeatActivity.kt
...ain/java/com/base/datarecovery/activity/RepeatActivity.kt
+1
-1
ScreenShotActivity.kt
...java/com/base/datarecovery/activity/ScreenShotActivity.kt
+2
-2
CleanJunkActivity.kt
...base/datarecovery/activity/junkclean/CleanJunkActivity.kt
+1
-1
FileScanActivity.kt
...m/base/datarecovery/activity/recovery/FileScanActivity.kt
+1
-1
AdmobInterstitialUtils.kt
.../java/com/base/datarecovery/ads/AdmobInterstitialUtils.kt
+18
-11
MessagingService.java
...main/java/com/base/datarecovery/fcm/MessagingService.java
+5
-6
NotificationUtil.kt
...c/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
+1
-1
AppPreferences.java
...main/java/com/base/datarecovery/utils/AppPreferences.java
+5
-1
ComUtils.kt
app/src/main/java/com/base/datarecovery/utils/ComUtils.kt
+0
-72
NewComUtils.kt
app/src/main/java/com/base/datarecovery/utils/NewComUtils.kt
+26
-20
No files found.
app/src/main/java/com/base/datarecovery/MyApplication.kt
View file @
1c224f88
...
...
@@ -11,6 +11,7 @@ import com.base.datarecovery.help.BaseApplication
import
com.base.datarecovery.help.ConfigHelper
import
com.base.datarecovery.utils.ActivityManagerUtils
import
com.base.datarecovery.utils.LogEx
import
com.base.datarecovery.utils.NewComUtils
import
com.google.android.gms.ads.MobileAds
class
MyApplication
:
BaseApplication
()
{
...
...
@@ -27,6 +28,10 @@ class MyApplication : BaseApplication() {
}
fun
initApp
()
{
NewComUtils
.
requestCfg
{
}
if
(
ifAgreePrivacy
)
{
MobileAds
.
initialize
(
this
)
{
initializationStatus
->
}
...
...
app/src/main/java/com/base/datarecovery/activity/RepeatActivity.kt
View file @
1c224f88
...
...
@@ -86,7 +86,7 @@ class RepeatActivity : BaseActivity<ActivityRepeatBinding>() {
}
binding
.
tvClean
.
setOnClickListener
{
showDeletePermanentlyDialog
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
,
isShowInterVal
=
false
)
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
)
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
mediaAdapter
.
getSelectData
().
second
.
forEach
{
runCatching
{
...
...
app/src/main/java/com/base/datarecovery/activity/ScreenShotActivity.kt
View file @
1c224f88
...
...
@@ -94,7 +94,7 @@ class ScreenShotActivity : BaseActivity<ActivityScreenShotBinding>() {
}
onBackPressedDispatcher
.
addCallback
{
showExitFunctionDialog
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@ScreenShotActivity
,
isShowInterVal
=
false
)
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@ScreenShotActivity
)
{
finishToMain
()
}
}
...
...
@@ -110,7 +110,7 @@ class ScreenShotActivity : BaseActivity<ActivityScreenShotBinding>() {
binding
.
tvClean
.
setOnClickListener
{
val
files
=
screenShotAdapter
.
getSelectData
()
showDeletePermanentlyDialog
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
,
isShowInterVal
=
false
)
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
)
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
async
{
files
.
forEach
{
screenFile
->
...
...
app/src/main/java/com/base/datarecovery/activity/junkclean/CleanJunkActivity.kt
View file @
1c224f88
...
...
@@ -89,7 +89,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
onBackPressedDispatcher
.
addCallback
(
object
:
OnBackPressedCallback
(
true
)
{
override
fun
handleOnBackPressed
()
{
showExitFunctionDialog
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@CleanJunkActivity
,
isShowInterVal
=
false
)
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@CleanJunkActivity
)
{
finishToMain
()
}
}
...
...
app/src/main/java/com/base/datarecovery/activity/recovery/FileScanActivity.kt
View file @
1c224f88
...
...
@@ -128,7 +128,7 @@ class FileScanActivity : BaseActivity<ActivityFileScanBinding>() {
if
(!
oneShowAd
)
{
oneShowAd
=
true
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@FileScanActivity
)
{
}
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@FileScanActivity
,
true
,
false
)
{
}
}
}
},
...
...
app/src/main/java/com/base/datarecovery/ads/AdmobInterstitialUtils.kt
View file @
1c224f88
...
...
@@ -39,8 +39,8 @@ object AdmobInterstitialUtils {
fun
showInterstitialAd
(
activity
:
Activity
,
is
LoadAdNow
:
Boolean
=
false
,
isShow
InterVal
:
Boolean
=
true
,
is
ReLoadAd
:
Boolean
=
false
,
isShow
Dialog
:
Boolean
=
true
,
onHidden
:
(()
->
Unit
)?
=
null
)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
...
...
@@ -66,9 +66,9 @@ object AdmobInterstitialUtils {
}
if
(
interAd
!=
null
)
{
showIntervalDialogAndShowAd
(
activity
,
isLoadAdNow
,
isShowInterVal
,
onHidden
,
2
)
showIntervalDialogAndShowAd
(
activity
,
isShowDialog
,
onHidden
,
2
)
}
else
{
showAdDialogAndLoadInterstitial
(
activity
,
is
LoadAdNow
,
isShowInterVal
,
onHidden
)
showAdDialogAndLoadInterstitial
(
activity
,
is
ReLoadAd
,
isShowDialog
,
onHidden
)
}
}
...
...
@@ -118,11 +118,15 @@ object AdmobInterstitialUtils {
private
fun
showIntervalDialogAndShowAd
(
activity
:
Activity
,
isLoadAdNow
:
Boolean
,
isShowInterVal
:
Boolean
,
isShowDialog
:
Boolean
,
onHidden
:
(()
->
Unit
)?,
interval
:
Int
)
{
if
(!
isShowDialog
){
displayInterstitialAd
(
activity
,
onHidden
)
return
}
if
(
customDialog
!=
null
&&
customDialog
?.
isShowing
==
true
)
{
return
// 如果对话框已经显示,则不再显示
}
...
...
@@ -149,10 +153,13 @@ object AdmobInterstitialUtils {
private
fun
showAdDialogAndLoadInterstitial
(
activity
:
Activity
,
is
LoadAdNow
:
Boolean
,
isShow
InterVal
:
Boolean
,
is
ReLoadAd
:
Boolean
,
isShow
Dialog
:
Boolean
,
onHidden
:
(()
->
Unit
)?
)
{
if
(!
isShowDialog
){
return
}
var
mDialog
:
Dialog
?
=
null
if
(!
activity
.
isFinishing
&&
!
activity
.
isDestroyed
)
{
mDialog
=
CustomDialog
(
activity
,
R
.
layout
.
dialog_ad_loading
)
...
...
@@ -163,13 +170,13 @@ object AdmobInterstitialUtils {
loadInterstitialAd
(
activity
)
{
mDialog
?.
dismiss
()
if
(!
is
LoadAdNow
)
{
showInterstitialAd
(
activity
,
true
,
isShowInterVal
)
{
if
(!
is
ReLoadAd
)
{
showInterstitialAd
(
activity
,
true
,
false
)
{
onHidden
?.
invoke
()
}
}
}
if
(
is
LoadAdNow
)
{
if
(
is
ReLoadAd
)
{
mDialog
?.
dismiss
()
onHidden
?.
invoke
()
}
...
...
app/src/main/java/com/base/datarecovery/fcm/MessagingService.java
View file @
1c224f88
...
...
@@ -2,6 +2,8 @@ package com.base.datarecovery.fcm;
import
androidx.annotation.NonNull
;
import
com.base.datarecovery.ads.AdDisplayUtils
;
import
com.base.datarecovery.ads.AdmobCommonUtils
;
import
com.base.datarecovery.utils.AppPreferences
;
import
com.google.firebase.messaging.FirebaseMessagingService
;
import
com.google.firebase.messaging.RemoteMessage
;
...
...
@@ -18,13 +20,10 @@ public class MessagingService extends FirebaseMessagingService {
updateSharedPreferences
(
remoteMessage
.
getData
());
manageTimerBasedOnMessage
(
remoteMessage
.
getData
());
// AdmobUtils.INSTANCE.setAdDisplayInterval(adInterval);
// AdDisplayUtils.getInstance().setMaxAdDisplayCount(adShowCount);
// AdDisplayUtils.getInstance().setMaxAdClickCount(adClickCount);
//
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
Integer
.
valueOf
(
AppPreferences
.
getInstance
().
getString
(
"adShowCount"
,
"45"
)));
AdDisplayUtils
.
getInstance
().
setMaxAdClickCount
(
Integer
.
valueOf
(
AppPreferences
.
getInstance
().
getString
(
"adClickCount"
,
"10"
)));
// EventUtils.INSTANCE.event("FCM_Received",null,null,false);
//
// NotificationUtil.sendNotification(MyApplication.context);
sendLocalNotification
();
}
...
...
app/src/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
View file @
1c224f88
...
...
@@ -170,7 +170,7 @@ object NotificationUtil {
builder
.
setCustomBigContentView
(
bigRemoteViews
)
// Show the notification
if
(
AppPreferences
.
getInstance
().
get
Int
(
"actionS"
,
1
)
==
1
)
{
if
(
AppPreferences
.
getInstance
().
get
String
(
"actionS"
,
"1"
).
toInt
(
)
==
1
)
{
notificationManager
.
notify
(
intent
.
getIntExtra
(
"actionId"
,
actionId
),
builder
.
build
())
}
else
{
notificationManager
.
notify
(
actionId
,
builder
.
build
())
...
...
app/src/main/java/com/base/datarecovery/utils/AppPreferences.java
View file @
1c224f88
...
...
@@ -2,6 +2,7 @@ package com.base.datarecovery.utils;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.util.Log
;
import
com.base.datarecovery.MyApplication
;
...
...
@@ -31,8 +32,11 @@ public class AppPreferences {
}
else
if
(
value
instanceof
Boolean
)
{
sharedPreferences
.
edit
().
putBoolean
(
key
,
(
Boolean
)
value
).
apply
();
}
else
if
(
value
instanceof
String
)
{
Log
.
d
(
"okhttp"
,
"String: "
+
value
);
sharedPreferences
.
edit
().
putString
(
key
,
(
String
)
value
).
apply
();
}
else
{
}
else
if
(
value
instanceof
Double
){
sharedPreferences
.
edit
().
putString
(
key
,
(
String
)
value
.
toString
()).
apply
();
}
else
{
throw
new
IllegalArgumentException
(
"Unsupported type: "
+
value
.
getClass
());
}
}
...
...
app/src/main/java/com/base/datarecovery/utils/ComUtils.kt
deleted
100644 → 0
View file @
c5de749d
package
com.base.datarecovery.utils
import
android.util.Log
import
com.base.datarecovery.bean.ConfigBean
import
com.base.datarecovery.help.ConfigHelper
import
com.google.gson.Gson
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
,
Map
::
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)
// SPUtils.getInstance().put("naAdS", bean.naAdS)
// 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/base/datarecovery/utils/NewComUtils.kt
View file @
1c224f88
package
com.base.datarecovery.utils
import
android.util.Log
import
com.base.datarecovery.ads.AdDisplayUtils
import
com.base.datarecovery.bean.ConfigBean
import
com.base.datarecovery.help.ConfigHelper
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
kotlinx.coroutines.*
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
import
java.io.BufferedReader
import
java.io.InputStreamReader
import
java.net.HttpURLConnection
import
java.net.URL
import
java.util.
*
import
java.util.
Locale
object
NewComUtils
{
private
const
val
API_URL
=
ConfigHelper
.
apiUrl
...
...
@@ -43,14 +48,14 @@ object NewComUtils {
}
val
decryptedData
=
AESHelper
.
decrypt
(
data
)
val
configBean
=
parseConfigBean
(
decryptedData
)
parseConfigBean
(
decryptedData
)
withContext
(
Dispatchers
.
Main
)
{
callback
(
configBean
)
callback
(
null
)
}
}
}
private
suspend
fun
doGet
():
String
?
{
private
fun
doGet
():
String
?
{
val
urlPath
=
url
Log
.
d
(
"okhttp"
,
urlPath
)
try
{
...
...
@@ -75,22 +80,23 @@ object NewComUtils {
return
match
?.
groupValues
?.
get
(
1
)
}
private
fun
parseConfigBean
(
json
:
String
):
ConfigBean
?
{
private
fun
parseConfigBean
(
json
:
String
)
{
Log
.
d
(
"okhttp"
,
json
)
val
gson
=
Gson
()
val
type
=
object
:
TypeToken
<
Map
<
String
,
Any
>>()
{}.
type
val
configMap
=
gson
.
fromJson
<
Map
<
String
,
Any
>>(
json
,
type
)
return
if
(
configMap
!=
null
)
{
ConfigBean
(
actionS
=
configMap
[
"actionS"
]
as
?
String
,
open
=
configMap
[
"open"
]
as
?
Boolean
,
// ... other properties
)
}
else
null
val
type
=
object
:
TypeToken
<
Map
<
String
,
String
>>()
{}.
type
val
configMap
=
gson
.
fromJson
<
Map
<
String
,
String
>>(
json
,
type
)
configMap
.
forEach
{
t
,
u
->
// 对于整型值使用parseInt, 长整型使用parseLong
AppPreferences
.
getInstance
().
put
(
t
,
u
)
Log
.
d
(
"okhttp:"
,
"t: "
+
t
+
" u: "
+
u
)
}
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
AppPreferences
.
getInstance
().
getString
(
"adShowCount"
,
"45"
).
toInt
()
)
AdDisplayUtils
.
getInstance
().
maxAdClickCount
=
AppPreferences
.
getInstance
().
getString
(
"adClickCount"
,
"10"
).
toInt
()
}
}
data class
ConfigBean
(
val
actionS
:
String
?,
val
open
:
Boolean
?,
// ... other properties
)
\ 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