mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Changed the download notification title
This commit is contained in:
parent
a066363e88
commit
42ce52bf29
@ -1,7 +1,6 @@
|
|||||||
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
|
||||||
@ -27,7 +26,6 @@ class DownloadService : Service() {
|
|||||||
private lateinit var videoUrl: String
|
private lateinit var videoUrl: String
|
||||||
private lateinit var audioUrl: String
|
private lateinit var audioUrl: String
|
||||||
private var downloadType: Int = 3
|
private var downloadType: Int = 3
|
||||||
|
|
||||||
private var videoDownloadId: Long? = null
|
private var videoDownloadId: Long? = null
|
||||||
private var audioDownloadId: Long? = null
|
private var audioDownloadId: Long? = null
|
||||||
|
|
||||||
@ -75,10 +73,9 @@ class DownloadService : Service() {
|
|||||||
)
|
)
|
||||||
if (downloadType in listOf(DownloadType.VIDEO, DownloadType.AUDIO_VIDEO)) {
|
if (downloadType in listOf(DownloadType.VIDEO, DownloadType.AUDIO_VIDEO)) {
|
||||||
videoDownloadId = downloadManagerRequest(
|
videoDownloadId = downloadManagerRequest(
|
||||||
videoName,
|
"[Video] $videoName",
|
||||||
getString(R.string.downloading),
|
getString(R.string.downloading),
|
||||||
videoUrl,
|
videoUrl,
|
||||||
false,
|
|
||||||
Uri.fromFile(
|
Uri.fromFile(
|
||||||
File(videoDownloadDir, videoName)
|
File(videoDownloadDir, videoName)
|
||||||
)
|
)
|
||||||
@ -86,10 +83,9 @@ class DownloadService : Service() {
|
|||||||
}
|
}
|
||||||
if (downloadType in listOf(DownloadType.AUDIO, DownloadType.AUDIO_VIDEO)) {
|
if (downloadType in listOf(DownloadType.AUDIO, DownloadType.AUDIO_VIDEO)) {
|
||||||
audioDownloadId = downloadManagerRequest(
|
audioDownloadId = downloadManagerRequest(
|
||||||
videoName,
|
"[Audio] $videoName",
|
||||||
getString(R.string.downloading),
|
getString(R.string.downloading),
|
||||||
audioUrl,
|
audioUrl,
|
||||||
true,
|
|
||||||
Uri.fromFile(
|
Uri.fromFile(
|
||||||
File(audioDownloadDir, videoName)
|
File(audioDownloadDir, videoName)
|
||||||
)
|
)
|
||||||
@ -126,7 +122,6 @@ 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 =
|
||||||
@ -136,9 +131,6 @@ 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…
x
Reference in New Issue
Block a user