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
578a50b4
Commit
578a50b4
authored
Sep 24, 2019
by
Viktor De Pasquale
Committed by
John Wu
Sep 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added hiding actions on notifications typed "Download"
parent
3d4081d0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
XAndroid.kt
...src/main/java/com/topjohnwu/magisk/extensions/XAndroid.kt
+2
-0
DownloadService.kt
...va/com/topjohnwu/magisk/model/download/DownloadService.kt
+18
-5
NotificationService.kt
...om/topjohnwu/magisk/model/download/NotificationService.kt
+2
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/extensions/XAndroid.kt
View file @
578a50b4
...
@@ -119,3 +119,5 @@ fun ApplicationInfo.getLabel(pm: PackageManager): String {
...
@@ -119,3 +119,5 @@ fun ApplicationInfo.getLabel(pm: PackageManager): String {
return
loadLabel
(
pm
).
toString
()
return
loadLabel
(
pm
).
toString
()
}
}
fun
Intent
.
exists
(
packageManager
:
PackageManager
)
=
resolveActivity
(
packageManager
)
!=
null
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/model/download/DownloadService.kt
View file @
578a50b4
...
@@ -10,6 +10,7 @@ import androidx.core.app.NotificationCompat
...
@@ -10,6 +10,7 @@ import androidx.core.app.NotificationCompat
import
com.topjohnwu.magisk.ClassMap
import
com.topjohnwu.magisk.ClassMap
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.extensions.chooser
import
com.topjohnwu.magisk.extensions.chooser
import
com.topjohnwu.magisk.extensions.exists
import
com.topjohnwu.magisk.extensions.provide
import
com.topjohnwu.magisk.extensions.provide
import
com.topjohnwu.magisk.model.entity.internal.Configuration.*
import
com.topjohnwu.magisk.model.entity.internal.Configuration.*
import
com.topjohnwu.magisk.model.entity.internal.Configuration.Flash.Secondary
import
com.topjohnwu.magisk.model.entity.internal.Configuration.Flash.Secondary
...
@@ -17,6 +18,7 @@ import com.topjohnwu.magisk.model.entity.internal.DownloadSubject
...
@@ -17,6 +18,7 @@ import com.topjohnwu.magisk.model.entity.internal.DownloadSubject
import
com.topjohnwu.magisk.model.entity.internal.DownloadSubject.*
import
com.topjohnwu.magisk.model.entity.internal.DownloadSubject.*
import
com.topjohnwu.magisk.ui.flash.FlashActivity
import
com.topjohnwu.magisk.ui.flash.FlashActivity
import
com.topjohnwu.magisk.utils.APKInstall
import
com.topjohnwu.magisk.utils.APKInstall
import
org.koin.core.get
import
java.io.File
import
java.io.File
import
kotlin.random.Random.Default.nextInt
import
kotlin.random.Random.Default.nextInt
...
@@ -76,8 +78,14 @@ open class DownloadService : RemoteFileService() {
...
@@ -76,8 +78,14 @@ open class DownloadService : RemoteFileService() {
private
fun
NotificationCompat
.
Builder
.
addActionsInternal
(
subject
:
Magisk
)
private
fun
NotificationCompat
.
Builder
.
addActionsInternal
(
subject
:
Magisk
)
=
when
(
val
conf
=
subject
.
configuration
)
{
=
when
(
val
conf
=
subject
.
configuration
)
{
Download
->
addAction
(
0
,
R
.
string
.
download_open_parent
,
fileIntent
(
subject
.
file
.
parentFile
!!
))
Download
->
this
.
apply
{
.
addAction
(
0
,
R
.
string
.
download_open_self
,
fileIntent
(
subject
.
file
))
fileIntent
(
subject
.
file
.
parentFile
!!
)
.
takeIf
{
it
.
exists
(
get
())
}
?.
let
{
addAction
(
0
,
R
.
string
.
download_open_parent
,
it
.
chooser
())
}
fileIntent
(
subject
.
file
)
.
takeIf
{
it
.
exists
(
get
())
}
?.
let
{
addAction
(
0
,
R
.
string
.
download_open_self
,
it
.
chooser
())
}
}
Uninstall
->
setContentIntent
(
FlashActivity
.
uninstallIntent
(
context
,
subject
.
file
))
Uninstall
->
setContentIntent
(
FlashActivity
.
uninstallIntent
(
context
,
subject
.
file
))
is
Flash
->
setContentIntent
(
FlashActivity
.
flashIntent
(
context
,
subject
.
file
,
conf
is
Secondary
))
is
Flash
->
setContentIntent
(
FlashActivity
.
flashIntent
(
context
,
subject
.
file
,
conf
is
Secondary
))
is
Patch
->
setContentIntent
(
FlashActivity
.
patchIntent
(
context
,
subject
.
file
,
conf
.
fileUri
))
is
Patch
->
setContentIntent
(
FlashActivity
.
patchIntent
(
context
,
subject
.
file
,
conf
.
fileUri
))
...
@@ -86,8 +94,14 @@ open class DownloadService : RemoteFileService() {
...
@@ -86,8 +94,14 @@ open class DownloadService : RemoteFileService() {
private
fun
NotificationCompat
.
Builder
.
addActionsInternal
(
subject
:
Module
)
private
fun
NotificationCompat
.
Builder
.
addActionsInternal
(
subject
:
Module
)
=
when
(
subject
.
configuration
)
{
=
when
(
subject
.
configuration
)
{
Download
->
addAction
(
0
,
R
.
string
.
download_open_parent
,
fileIntent
(
subject
.
file
.
parentFile
!!
))
Download
->
this
.
apply
{
.
addAction
(
0
,
R
.
string
.
download_open_self
,
fileIntent
(
subject
.
file
))
fileIntent
(
subject
.
file
.
parentFile
!!
)
.
takeIf
{
it
.
exists
(
get
())
}
?.
let
{
addAction
(
0
,
R
.
string
.
download_open_parent
,
it
.
chooser
())
}
fileIntent
(
subject
.
file
)
.
takeIf
{
it
.
exists
(
get
())
}
?.
let
{
addAction
(
0
,
R
.
string
.
download_open_self
,
it
.
chooser
())
}
}
is
Flash
->
setContentIntent
(
FlashActivity
.
installIntent
(
context
,
subject
.
file
))
is
Flash
->
setContentIntent
(
FlashActivity
.
installIntent
(
context
,
subject
.
file
))
else
->
this
else
->
this
}
}
...
@@ -115,7 +129,6 @@ open class DownloadService : RemoteFileService() {
...
@@ -115,7 +129,6 @@ open class DownloadService : RemoteFileService() {
.
setDataAndType
(
file
.
provide
(
this
),
file
.
type
)
.
setDataAndType
(
file
.
provide
(
this
),
file
.
type
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
)
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
)
.
chooser
()
}
}
class
Builder
{
class
Builder
{
...
...
app/src/main/java/com/topjohnwu/magisk/model/download/NotificationService.kt
View file @
578a50b4
...
@@ -6,10 +6,11 @@ import android.content.Intent
...
@@ -6,10 +6,11 @@ import android.content.Intent
import
android.os.IBinder
import
android.os.IBinder
import
androidx.core.app.NotificationCompat
import
androidx.core.app.NotificationCompat
import
androidx.core.app.NotificationManagerCompat
import
androidx.core.app.NotificationManagerCompat
import
org.koin.core.KoinComponent
import
java.util.*
import
java.util.*
import
kotlin.random.Random.Default.nextInt
import
kotlin.random.Random.Default.nextInt
abstract
class
NotificationService
:
Service
()
{
abstract
class
NotificationService
:
Service
()
,
KoinComponent
{
abstract
val
defaultNotification
:
NotificationCompat
.
Builder
abstract
val
defaultNotification
:
NotificationCompat
.
Builder
...
...
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