mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Modified the notification visibility for audio
This commit is contained in:
parent
ae87a1d05f
commit
a066363e88
@ -1,6 +1,7 @@
|
|||||||
package com.github.libretube.services
|
package com.github.libretube.services
|
||||||
|
|
||||||
import android.app.DownloadManager
|
import android.app.DownloadManager
|
||||||
|
import android.app.DownloadManager.Request.VISIBILITY_HIDDEN
|
||||||
import android.app.Service
|
import android.app.Service
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@ -77,16 +78,18 @@ class DownloadService : Service() {
|
|||||||
videoName,
|
videoName,
|
||||||
getString(R.string.downloading),
|
getString(R.string.downloading),
|
||||||
videoUrl,
|
videoUrl,
|
||||||
|
false,
|
||||||
Uri.fromFile(
|
Uri.fromFile(
|
||||||
File(videoDownloadDir, videoName)
|
File(videoDownloadDir, videoName)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
else if (downloadType in listOf(DownloadType.AUDIO, DownloadType.AUDIO_VIDEO)) {
|
if (downloadType in listOf(DownloadType.AUDIO, DownloadType.AUDIO_VIDEO)) {
|
||||||
audioDownloadId = downloadManagerRequest(
|
audioDownloadId = downloadManagerRequest(
|
||||||
videoName,
|
videoName,
|
||||||
getString(R.string.downloading),
|
getString(R.string.downloading),
|
||||||
audioUrl,
|
audioUrl,
|
||||||
|
true,
|
||||||
Uri.fromFile(
|
Uri.fromFile(
|
||||||
File(audioDownloadDir, videoName)
|
File(audioDownloadDir, videoName)
|
||||||
)
|
)
|
||||||
@ -123,6 +126,7 @@ class DownloadService : Service() {
|
|||||||
title: String,
|
title: String,
|
||||||
descriptionText: String,
|
descriptionText: String,
|
||||||
url: String,
|
url: String,
|
||||||
|
isAudio: Boolean,
|
||||||
destination: Uri
|
destination: Uri
|
||||||
): Long {
|
): Long {
|
||||||
val request: DownloadManager.Request =
|
val request: DownloadManager.Request =
|
||||||
@ -132,6 +136,9 @@ class DownloadService : Service() {
|
|||||||
.setDestinationUri(destination)
|
.setDestinationUri(destination)
|
||||||
.setAllowedOverMetered(true) // Set if download is allowed on Mobile network
|
.setAllowedOverMetered(true) // Set if download is allowed on Mobile network
|
||||||
.setAllowedOverRoaming(true)
|
.setAllowedOverRoaming(true)
|
||||||
|
if (isAudio) {
|
||||||
|
request.setNotificationVisibility(VISIBILITY_HIDDEN)
|
||||||
|
}
|
||||||
|
|
||||||
val downloadManager: DownloadManager =
|
val downloadManager: DownloadManager =
|
||||||
applicationContext.getSystemService(DOWNLOAD_SERVICE) as DownloadManager
|
applicationContext.getSystemService(DOWNLOAD_SERVICE) as DownloadManager
|
||||||
|
Loading…
Reference in New Issue
Block a user