[Android] SubDownload: fix endless download animation
Duncan McNamara
git at videolan.org
Thu Feb 13 09:37:09 UTC 2025
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Thu Feb 6 15:03:31 2025 +0100| [21b23c8f081bcb16550b602b0eb1fdf22677c044] | committer: Nicolas Pomepuy
SubDownload: fix endless download animation
If for some reason the FileUtils.copyFile fails, the subtitleItem should
be removed from the ExternalSubDirectory's downloading items to change
the item's state back to NotDownloaded to stop the download progress
animation. Also nice to display a snackbar error for the user.
> https://code.videolan.org/videolan/vlc-android/commit/21b23c8f081bcb16550b602b0eb1fdf22677c044
---
.../vlc-android/src/org/videolan/vlc/util/VLCDownloadManager.kt | 3 +++
1 file changed, 3 insertions(+)
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 fc5598e5ed..04c7f55622 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/VLCDownloadManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/VLCDownloadManager.kt
@@ -102,6 +102,9 @@ object VLCDownloadManager: BroadcastReceiver(), DefaultLifecycleObserver {
}
withContext(Dispatchers.IO) { FileUtils.deleteFile(localUri) }
+ } ?: run {
+ ExternalSubRepository.getInstance(context).removeDownloadingItem(id)
+ Toast.makeText(context, R.string.subtitles_download_failed, Toast.LENGTH_SHORT).show()
}
}
More information about the Android
mailing list