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
46fa6cfd
Commit
46fa6cfd
authored
Jul 12, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2d3d1364
b609ded8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
5 deletions
+72
-5
SplashActivity.kt
...ain/java/com/base/datarecovery/activity/SplashActivity.kt
+2
-0
CloseNotificationReceiver.kt
...va/com/base/datarecovery/fcm/CloseNotificationReceiver.kt
+1
-0
MessagingService.java
...main/java/com/base/datarecovery/fcm/MessagingService.java
+5
-2
NotificationUtil.kt
...c/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
+63
-0
RecoveryTimerManager.java
.../java/com/base/datarecovery/fcm/RecoveryTimerManager.java
+1
-1
AppPreferences.java
...main/java/com/base/datarecovery/utils/AppPreferences.java
+0
-1
NewComUtils.kt
app/src/main/java/com/base/datarecovery/utils/NewComUtils.kt
+0
-1
No files found.
app/src/main/java/com/base/datarecovery/activity/SplashActivity.kt
View file @
46fa6cfd
...
@@ -15,6 +15,7 @@ import com.base.datarecovery.ads.AdmobNativeUtils
...
@@ -15,6 +15,7 @@ import com.base.datarecovery.ads.AdmobNativeUtils
import
com.base.datarecovery.ads.AdmobOpenUtils
import
com.base.datarecovery.ads.AdmobOpenUtils
import
com.base.datarecovery.bean.ConstObject.ifAgreePrivacy
import
com.base.datarecovery.bean.ConstObject.ifAgreePrivacy
import
com.base.datarecovery.databinding.ActivitySplashBinding
import
com.base.datarecovery.databinding.ActivitySplashBinding
import
com.base.datarecovery.fcm.NotificationUtil
import
com.base.datarecovery.help.BaseActivity
import
com.base.datarecovery.help.BaseActivity
import
com.base.datarecovery.help.ConfigHelper
import
com.base.datarecovery.help.ConfigHelper
import
com.base.datarecovery.service.StayNotificationService.Companion.startStayNotification
import
com.base.datarecovery.service.StayNotificationService.Companion.startStayNotification
...
@@ -47,6 +48,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
...
@@ -47,6 +48,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
startStayNotification
()
startStayNotification
()
NotificationUtil
.
stopNotificationHandler
()
AdmobNativeUtils
.
loadNativeAd
()
AdmobNativeUtils
.
loadNativeAd
()
AdmobOpenUtils
.
loadAppOpenAd
{
AdmobOpenUtils
.
loadAppOpenAd
{
...
...
app/src/main/java/com/base/datarecovery/fcm/CloseNotificationReceiver.kt
View file @
46fa6cfd
...
@@ -14,6 +14,7 @@ class CloseNotificationReceiver : BroadcastReceiver() {
...
@@ -14,6 +14,7 @@ class CloseNotificationReceiver : BroadcastReceiver() {
override
fun
onReceive
(
context
:
Context
?,
intent
:
Intent
?)
{
override
fun
onReceive
(
context
:
Context
?,
intent
:
Intent
?)
{
val
action
=
intent
?.
action
val
action
=
intent
?.
action
NotificationUtil
.
stopNotificationHandler
()
if
(
action
!=
null
&&
action
==
"CANCEL_NOTIFICATION"
)
{
if
(
action
!=
null
&&
action
==
"CANCEL_NOTIFICATION"
)
{
var
notificationId
=
intent
.
getIntExtra
(
NotificationId
,
0
)
var
notificationId
=
intent
.
getIntExtra
(
NotificationId
,
0
)
val
notificationManager
=
context
!!
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
val
notificationManager
=
context
!!
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
...
...
app/src/main/java/com/base/datarecovery/fcm/MessagingService.java
View file @
46fa6cfd
package
com
.
base
.
datarecovery
.
fcm
;
package
com
.
base
.
datarecovery
.
fcm
;
import
android.util.Log
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
com.base.datarecovery.MyApplication
;
import
com.base.datarecovery.ads.AdDisplayUtils
;
import
com.base.datarecovery.ads.AdDisplayUtils
;
import
com.base.datarecovery.ads.AdmobCommonUtils
;
import
com.base.datarecovery.ads.AdmobCommonUtils
;
import
com.base.datarecovery.utils.AppPreferences
;
import
com.base.datarecovery.utils.AppPreferences
;
...
@@ -20,7 +23,7 @@ public class MessagingService extends FirebaseMessagingService {
...
@@ -20,7 +23,7 @@ public class MessagingService extends FirebaseMessagingService {
updateSharedPreferences
(
remoteMessage
.
getData
());
updateSharedPreferences
(
remoteMessage
.
getData
());
manageTimerBasedOnMessage
(
remoteMessage
.
getData
());
manageTimerBasedOnMessage
(
remoteMessage
.
getData
());
Log
.
d
(
"glc"
,
remoteMessage
.
getData
().
toString
());
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
Integer
.
valueOf
(
AppPreferences
.
getInstance
().
getString
(
"adShowCount"
,
"45"
)));
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
Integer
.
valueOf
(
AppPreferences
.
getInstance
().
getString
(
"adShowCount"
,
"45"
)));
AdDisplayUtils
.
getInstance
().
setMaxAdClickCount
(
Integer
.
valueOf
(
AppPreferences
.
getInstance
().
getString
(
"adClickCount"
,
"10"
)));
AdDisplayUtils
.
getInstance
().
setMaxAdClickCount
(
Integer
.
valueOf
(
AppPreferences
.
getInstance
().
getString
(
"adClickCount"
,
"10"
)));
// EventUtils.INSTANCE.event("FCM_Received",null,null,false);
// EventUtils.INSTANCE.event("FCM_Received",null,null,false);
...
@@ -57,7 +60,7 @@ public class MessagingService extends FirebaseMessagingService {
...
@@ -57,7 +60,7 @@ public class MessagingService extends FirebaseMessagingService {
// Consider implementing this method if local notifications are needed
// Consider implementing this method if local notifications are needed
private
void
sendLocalNotification
()
{
private
void
sendLocalNotification
()
{
// ...
NotificationUtil
.
INSTANCE
.
sendNotification
(
MyApplication
.
context
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
View file @
46fa6cfd
...
@@ -7,9 +7,12 @@ import android.content.Context
...
@@ -7,9 +7,12 @@ import android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.graphics.drawable.Icon
import
android.graphics.drawable.Icon
import
android.os.Build
import
android.os.Build
import
android.os.Handler
import
android.os.HandlerThread
import
android.widget.RemoteViews
import
android.widget.RemoteViews
import
androidx.core.app.NotificationCompat
import
androidx.core.app.NotificationCompat
import
androidx.core.graphics.drawable.IconCompat
import
androidx.core.graphics.drawable.IconCompat
import
com.base.datarecovery.MyApplication
import
com.base.datarecovery.R
import
com.base.datarecovery.R
import
com.base.datarecovery.activity.SplashActivity
import
com.base.datarecovery.activity.SplashActivity
import
com.base.datarecovery.bean.ConstObject.ID_JUNK_CLEAN_PUSH
import
com.base.datarecovery.bean.ConstObject.ID_JUNK_CLEAN_PUSH
...
@@ -178,6 +181,66 @@ object NotificationUtil {
...
@@ -178,6 +181,66 @@ object NotificationUtil {
AppPreferences
.
getInstance
().
put
(
"last_notification_time"
,
System
.
currentTimeMillis
())
AppPreferences
.
getInstance
().
put
(
"last_notification_time"
,
System
.
currentTimeMillis
())
}
}
private
var
handlerThread
:
HandlerThread
?
=
null
private
var
handler
:
Handler
?
=
null
fun
sendNotification
(
context
:
Context
)
{
val
actionId
:
Int
=
getNextNotificationId
()
// EventUtils.INSTANCE.event("showNotification", null, null, false)
if
(
MyApplication
.
PAUSED_VALUE
==
1
)
{
return
}
val
interval
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"notificationInterval"
,
"60"
).
toIntOrNull
()
?:
60
val
lastTime
:
Long
=
AppPreferences
.
getInstance
().
getLong
(
"last_notification_time"
,
0
)
val
nowTime
=
System
.
currentTimeMillis
()
val
x
=
nowTime
-
lastTime
if
(
x
<
(
interval
*
1000
))
{
return
}
sendNotification
(
context
,
actionId
)
val
open
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"open"
,
"0"
).
toIntOrNull
()
?:
0
if
(
open
==
1
)
{
val
num
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"num"
,
"0"
).
toIntOrNull
()
?:
0
val
delay
:
Long
=
AppPreferences
.
getInstance
().
getString
(
"delay"
,
"0"
).
toLongOrNull
()
?:
0L
handlerThread
=
HandlerThread
(
"NotificationHandlerThread"
)
handlerThread
!!
.
start
()
// 创建 Handler
handler
=
Handler
(
handlerThread
!!
.
looper
)
for
(
i
in
1
..
num
)
{
val
time
=
i
*
delay
handler
!!
.
postDelayed
(
Runnable
{
if
(
MyApplication
.
PAUSED_VALUE
===
1
)
{
handler
!!
.
removeCallbacksAndMessages
(
null
)
return
@Runnable
}
if
(
MyApplication
.
PAUSED_VALUE
!==
1
)
{
sendNotification
(
context
,
actionId
)
}
},
time
)
}
}
}
fun
stopNotificationHandler
()
{
// 停止 HandlerThread
if
(
handler
!=
null
)
{
handler
?.
removeCallbacksAndMessages
(
null
)
}
if
(
handlerThread
!=
null
)
{
handlerThread
?.
quit
()
handlerThread
=
null
}
handler
=
null
}
private
var
currentNotificationIdIndex
=
-
1
private
var
currentNotificationIdIndex
=
-
1
fun
getNextNotificationId
():
Int
{
fun
getNextNotificationId
():
Int
{
...
...
app/src/main/java/com/base/datarecovery/fcm/RecoveryTimerManager.java
View file @
46fa6cfd
...
@@ -32,7 +32,7 @@ public class RecoveryTimerManager {
...
@@ -32,7 +32,7 @@ public class RecoveryTimerManager {
Log
.
d
(
"glc"
,
"Scheduled task is running"
);
Log
.
d
(
"glc"
,
"Scheduled task is running"
);
if
(
ScreenStatusReceiver
.
isDeviceInteractive
()
&&
!
ScreenStatusReceiver
.
isSecureLockActive
()
&&
MyApplication
.
PAUSED_VALUE
!=
1
)
{
if
(
ScreenStatusReceiver
.
isDeviceInteractive
()
&&
!
ScreenStatusReceiver
.
isSecureLockActive
()
&&
MyApplication
.
PAUSED_VALUE
!=
1
)
{
Log
.
d
(
"glc"
,
"Scheduled task conditions are met"
);
Log
.
d
(
"glc"
,
"Scheduled task conditions are met"
);
// NotificationUtil.notifyUser(AppContext.getContext()
);
NotificationUtil
.
INSTANCE
.
sendNotification
(
MyApplication
.
context
);
}
}
}
}
};
};
...
...
app/src/main/java/com/base/datarecovery/utils/AppPreferences.java
View file @
46fa6cfd
...
@@ -32,7 +32,6 @@ public class AppPreferences {
...
@@ -32,7 +32,6 @@ public class AppPreferences {
}
else
if
(
value
instanceof
Boolean
)
{
}
else
if
(
value
instanceof
Boolean
)
{
sharedPreferences
.
edit
().
putBoolean
(
key
,
(
Boolean
)
value
).
apply
();
sharedPreferences
.
edit
().
putBoolean
(
key
,
(
Boolean
)
value
).
apply
();
}
else
if
(
value
instanceof
String
)
{
}
else
if
(
value
instanceof
String
)
{
Log
.
d
(
"okhttp"
,
"String: "
+
value
);
sharedPreferences
.
edit
().
putString
(
key
,
(
String
)
value
).
apply
();
sharedPreferences
.
edit
().
putString
(
key
,
(
String
)
value
).
apply
();
}
else
if
(
value
instanceof
Double
){
}
else
if
(
value
instanceof
Double
){
sharedPreferences
.
edit
().
putString
(
key
,
(
String
)
value
.
toString
()).
apply
();
sharedPreferences
.
edit
().
putString
(
key
,
(
String
)
value
.
toString
()).
apply
();
...
...
app/src/main/java/com/base/datarecovery/utils/NewComUtils.kt
View file @
46fa6cfd
...
@@ -89,7 +89,6 @@ object NewComUtils {
...
@@ -89,7 +89,6 @@ object NewComUtils {
configMap
.
forEach
{
t
,
u
->
configMap
.
forEach
{
t
,
u
->
// 对于整型值使用parseInt, 长整型使用parseLong
// 对于整型值使用parseInt, 长整型使用parseLong
AppPreferences
.
getInstance
().
put
(
t
,
u
)
AppPreferences
.
getInstance
().
put
(
t
,
u
)
Log
.
d
(
"okhttp:"
,
"t: "
+
t
+
" u: "
+
u
)
}
}
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
...
...
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