优化离线下载

pull/275/head
gedoor 4 years ago
parent 5aa1cc0884
commit 235289e3c3
  1. 6
      app/src/main/java/io/legado/app/service/DownloadService.kt
  2. 2
      app/src/main/res/values-zh-rCN/strings.xml
  3. 2
      app/src/main/res/values-zh-rHK/strings.xml
  4. 2
      app/src/main/res/values-zh-rTW/strings.xml
  5. 5
      app/src/main/res/values-zh/strings.xml
  6. 2
      app/src/main/res/values/strings.xml

@ -43,7 +43,7 @@ class DownloadService : BaseService() {
@Volatile @Volatile
private var downloadingCount = 0 private var downloadingCount = 0
private var notificationContent = "正在启动下载" private var notificationContent = getString(R.string.starting_download)
private val notificationBuilder by lazy { private val notificationBuilder by lazy {
val builder = NotificationCompat.Builder(this, AppConst.channelIdDownload) val builder = NotificationCompat.Builder(this, AppConst.channelIdDownload)
@ -126,7 +126,7 @@ class DownloadService : BaseService() {
private fun addDownloadData(bookUrl: String?, start: Int, end: Int) { private fun addDownloadData(bookUrl: String?, start: Int, end: Int) {
bookUrl ?: return bookUrl ?: return
if (downloadMap.containsKey(bookUrl)) { if (downloadMap.containsKey(bookUrl)) {
toast("该书已在下载列表") toast(R.string.already_in_download)
return return
} }
downloadCount[bookUrl] = DownloadCount() downloadCount[bookUrl] = DownloadCount()
@ -256,7 +256,7 @@ class DownloadService : BaseService() {
content: String content: String
) { ) {
notificationContent = notificationContent =
"进度:${downloadCount.downloadFinishedCount}/$totalCount,成功:${downloadCount.successCount},$content" "进度:" + downloadCount.downloadFinishedCount + "/" + totalCount + ",成功:" + downloadCount.successCount + "," + content
} }
/** /**

@ -707,4 +707,6 @@
<string name="import_old_summary">选择旧版备份文件夹</string> <string name="import_old_summary">选择旧版备份文件夹</string>
<string name="enabled">已启用</string> <string name="enabled">已启用</string>
<string name="disabled">已禁用</string> <string name="disabled">已禁用</string>
<string name="starting_download">正在启动下载</string>
<string name="already_in_download">该书已在下载列表</string>
</resources> </resources>

@ -707,4 +707,6 @@
<string name="enabled">已啓用</string> <string name="enabled">已啓用</string>
<string name="disabled">已禁用</string> <string name="disabled">已禁用</string>
<string name="text_bottom_justify">文字底部對齊</string> <string name="text_bottom_justify">文字底部對齊</string>
<string name="starting_download">正在启动下载</string>
<string name="already_in_download">该书已在下载列表</string>
</resources> </resources>

@ -707,5 +707,7 @@
<string name="enabled">已啓用</string> <string name="enabled">已啓用</string>
<string name="disabled">已禁用</string> <string name="disabled">已禁用</string>
<string name="text_bottom_justify">文字底部對齊</string> <string name="text_bottom_justify">文字底部對齊</string>
<string name="starting_download">正在启动下载</string>
<string name="already_in_download">该书已在下载列表</string>
</resources> </resources>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="starting_download">正在启动下载</string>
<string name="already_in_download">该书已在下载列表</string>
</resources>

@ -707,4 +707,6 @@
<string name="import_old_summary">Select legacy backup folder</string> <string name="import_old_summary">Select legacy backup folder</string>
<string name="enabled">Enabled</string> <string name="enabled">Enabled</string>
<string name="disabled">Disabled</string> <string name="disabled">Disabled</string>
<string name="starting_download">正在启动下载</string>
<string name="already_in_download">该书已在下载列表</string>
</resources> </resources>
Loading…
Cancel
Save