Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
swiftcleanerphonehelper
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
swiftcleanerphonehelper
Commits
053abc89
Commit
053abc89
authored
Dec 20, 2024
by
Your Name
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
8b79581b
841b13a2
Pipeline
#1391
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
NotificationUtils.kt
app/src/main/java/com/zxdemo/notity/NotificationUtils.kt
+12
-1
No files found.
app/src/main/java/com/zxdemo/notity/NotificationUtils.kt
View file @
053abc89
...
@@ -118,12 +118,22 @@ object NotificationUtils {
...
@@ -118,12 +118,22 @@ object NotificationUtils {
}
}
private
var
lastNotificationTime
=
0L
fun
sendNotification
(
context
:
Context
,
where
:
String
)
{
fun
sendNotification
(
context
:
Context
,
where
:
String
)
{
if
(
isDeviceLocked
||
isAppInForeground
||
!
isScreenOn
)
{
if
(
isDeviceLocked
||
isAppInForeground
||
!
isScreenOn
)
{
return
return
}
}
val
actionId
=
nextNotificationId
val
actionId
=
nextNotificationId
val
intervalTime
=
System
.
currentTimeMillis
()
-
lastNotificationTime
val
spInterval
=
SpUtils
.
getInstance
().
getInt
(
"NotificationInterval"
,
1
)
val
oneMinute
=
1
*
60
*
1000L
Log
.
e
(
"sendNotification"
,
"where=$where actionId=$actionId intervalTime=$intervalTime spInterval=$spInterval"
)
if
(
lastNotificationTime
!=
0L
&&
intervalTime
<
spInterval
*
oneMinute
)
{
return
}
val
bigRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common
)
val
bigRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common
)
val
smallRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common_small
)
val
smallRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common_small
)
var
intentAction
=
""
var
intentAction
=
""
...
@@ -227,6 +237,7 @@ object NotificationUtils {
...
@@ -227,6 +237,7 @@ object NotificationUtils {
bigRemoteViews
,
bigRemoteViews
,
smallRemoteViews
,
smallRemoteViews
,
)
)
lastNotificationTime
=
System
.
currentTimeMillis
()
}
}
}
}
...
...
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