Changed the download notification title

This commit is contained in:
shantanu1k 2022-10-23 21:23:20 +05:30
parent a066363e88
commit 42ce52bf29

View File

@ -1,7 +1,6 @@
package com.github.libretube.services
import android.app.DownloadManager
import android.app.DownloadManager.Request.VISIBILITY_HIDDEN
import android.app.Service
import android.content.BroadcastReceiver
import android.content.Context
@ -27,7 +26,6 @@ class DownloadService : Service() {
private lateinit var videoUrl: String
private lateinit var audioUrl: String
private var downloadType: Int = 3
private var videoDownloadId: Long? = null
private var audioDownloadId: Long? = null
@ -75,10 +73,9 @@ class DownloadService : Service() {
)
if (downloadType in listOf(DownloadType.VIDEO, DownloadType.AUDIO_VIDEO)) {
videoDownloadId = downloadManagerRequest(
videoName,
"[Video] $videoName",
getString(R.string.downloading),
videoUrl,
false,
Uri.fromFile(
File(videoDownloadDir, videoName)
)
@ -86,10 +83,9 @@ class DownloadService : Service() {
}
if (downloadType in listOf(DownloadType.AUDIO, DownloadType.AUDIO_VIDEO)) {
audioDownloadId = downloadManagerRequest(
videoName,
"[Audio] $videoName",
getString(R.string.downloading),
audioUrl,
true,
Uri.fromFile(
File(audioDownloadDir, videoName)
)
@ -126,7 +122,6 @@ class DownloadService : Service() {
title: String,
descriptionText: String,
url: String,
isAudio: Boolean,
destination: Uri
): Long {
val request: DownloadManager.Request =
@ -136,9 +131,6 @@ class DownloadService : Service() {
.setDestinationUri(destination)
.setAllowedOverMetered(true) // Set if download is allowed on Mobile network
.setAllowedOverRoaming(true)
if (isAudio) {
request.setNotificationVisibility(VISIBILITY_HIDDEN)
}
val downloadManager: DownloadManager =
applicationContext.getSystemService(DOWNLOAD_SERVICE) as DownloadManager