[Android] SubtitleDownload: enable without storage access

Duncan McNamara git at videolan.org
Fri Feb 25 06:39:16 UTC 2022


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Wed Feb 16 16:21:08 2022 +0100| [d317d49dacba5e2ccad2d88c4fe1f8426e5e5910] | committer: Nicolas Pomepuy

SubtitleDownload: enable without storage access

Fixes #2365

> https://code.videolan.org/videolan/vlc-android/commit/d317d49dacba5e2ccad2d88c4fe1f8426e5e5910
---

 application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt    | 6 +-----
 .../vlc-android/src/org/videolan/vlc/util/VLCDownloadManager.kt     | 3 +--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt b/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt
index 9a5cc5f67..9ec562a63 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt
@@ -69,11 +69,7 @@ object MediaUtils {
     fun getSubs(activity: FragmentActivity, media: MediaWrapper) = getSubs(activity, listOf(media))
 
     fun showSubtitleDownloaderDialogFragment(activity: FragmentActivity, mediaUris: List<Uri>, mediaTitles:List<String>) {
-        val callBack = java.lang.Runnable {
-            SubtitleDownloaderDialogFragment.newInstance(mediaUris, mediaTitles).show(activity.supportFragmentManager, "Subtitle_downloader")
-        }
-        if (Permissions.canWriteStorage()) callBack.run()
-        else Permissions.askWriteStoragePermission(activity, false, callBack)
+        SubtitleDownloaderDialogFragment.newInstance(mediaUris, mediaTitles).show(activity.supportFragmentManager, "Subtitle_downloader")
     }
 
 
diff --git a/application/vlc-android/src/org/videolan/vlc/util/VLCDownloadManager.kt b/application/vlc-android/src/org/videolan/vlc/util/VLCDownloadManager.kt
index f2eb6ae41..4a93259fc 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/VLCDownloadManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/VLCDownloadManager.kt
@@ -68,8 +68,7 @@ object VLCDownloadManager: BroadcastReceiver(), LifecycleObserver {
         val request = DownloadManager.Request(subtitleItem.zipDownloadLink.toUri())
         request.setDescription(subtitleItem.movieReleaseName)
         request.setTitle(context.resources.getString(R.string.download_subtitle_title))
-        request.setVisibleInDownloadsUi(false)
-        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, getDownloadPath(subtitleItem))
+        request.setDestinationInExternalFilesDir(context, getDownloadPath(subtitleItem), "")
         val id = downloadManager.enqueue(request)
         val deferred = CompletableDeferred<SubDlResult>().also { dlDeferred = it }
         ExternalSubRepository.getInstance(context.applicationContext).addDownloadingItem(id, subtitleItem)



More information about the Android mailing list