Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
fd4214cc
Commit
fd4214cc
authored
Jul 11, 2019
by
Viktor De Pasquale
Committed by
John Wu
Jul 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed minor bugs regarding notification cancellation
parent
07859456
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
NotificationService.kt
...om/topjohnwu/magisk/model/download/NotificationService.kt
+4
-7
No files found.
app/src/main/java/com/topjohnwu/magisk/model/download/NotificationService.kt
View file @
fd4214cc
...
@@ -15,14 +15,14 @@ abstract class NotificationService : Service() {
...
@@ -15,14 +15,14 @@ abstract class NotificationService : Service() {
abstract
val
defaultNotification
:
NotificationCompat
.
Builder
abstract
val
defaultNotification
:
NotificationCompat
.
Builder
private
val
manager
get
()
=
getSystemService
<
NotificationManager
>()
private
val
manager
get
()
=
getSystemService
<
NotificationManager
>()
private
val
hasNotifications
get
()
=
notifications
.
isEmpty
()
private
val
hasNotifications
get
()
=
notifications
.
is
Not
Empty
()
private
val
notifications
=
private
val
notifications
=
Collections
.
synchronizedMap
(
mutableMapOf
<
Int
,
NotificationCompat
.
Builder
>())
Collections
.
synchronizedMap
(
mutableMapOf
<
Int
,
NotificationCompat
.
Builder
>())
override
fun
onTaskRemoved
(
rootIntent
:
Intent
?)
{
override
fun
onTaskRemoved
(
rootIntent
:
Intent
?)
{
super
.
onTaskRemoved
(
rootIntent
)
super
.
onTaskRemoved
(
rootIntent
)
notifications
.
values
.
forEach
{
cancel
(
it
.
hashCode
()
)
}
notifications
.
forEach
{
cancel
(
it
.
key
)
}
notifications
.
clear
()
notifications
.
clear
()
}
}
...
@@ -45,15 +45,12 @@ abstract class NotificationService : Service() {
...
@@ -45,15 +45,12 @@ abstract class NotificationService : Service() {
id
:
Int
,
id
:
Int
,
editBody
:
(
NotificationCompat
.
Builder
)
->
NotificationCompat
.
Builder
?
=
{
null
}
editBody
:
(
NotificationCompat
.
Builder
)
->
NotificationCompat
.
Builder
?
=
{
null
}
)
{
)
{
val
currentNotification
=
remove
(
id
)
?.
run
(
editBody
)
?:
let
{
val
currentNotification
=
remove
(
id
)
?.
run
(
editBody
)
cancel
(
id
)
return
}
updateForeground
()
updateForeground
()
cancel
(
id
)
cancel
(
id
)
notify
(
nextInt
(),
currentNotification
.
build
())
currentNotification
?.
let
{
notify
(
nextInt
(),
it
.
build
())
}
if
(!
hasNotifications
)
{
if
(!
hasNotifications
)
{
stopForeground
(
true
)
stopForeground
(
true
)
...
...
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