pull/1344/head
gedoor 3 years ago
parent 99d12e5ce2
commit c704535fbd
  1. 15
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt

@ -139,20 +139,7 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
binding.llView.longSnackbar(fileName, getString(R.string.action_download)) { binding.llView.longSnackbar(fileName, getString(R.string.action_download)) {
// 指定下载地址 // 指定下载地址
val request = DownloadManager.Request(Uri.parse(url)) val request = DownloadManager.Request(Uri.parse(url))
// 允许媒体扫描,根据下载的文件类型被加入相册、音乐等媒体库 // 设置通知
@Suppress("DEPRECATION")
request.allowScanningByMediaScanner()
// 设置通知的显示类型,下载进行时和完成后显示通知
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
// 允许在计费流量下下载
request.setAllowedOverMetered(false)
// 允许该记录在下载管理界面可见
@Suppress("DEPRECATION")
request.setVisibleInDownloadsUi(false)
// 允许漫游时下载
request.setAllowedOverRoaming(true)
// 允许下载的网路类型
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN) request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN)
// 设置下载文件保存的路径和文件名 // 设置下载文件保存的路径和文件名
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName) request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName)

Loading…
Cancel
Save