diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 524fe903a..e5cb44632 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -250,7 +250,7 @@
android:launchMode="singleTop" />
-
+
diff --git a/app/src/main/java/io/legado/app/App.kt b/app/src/main/java/io/legado/app/App.kt
index 4fac6f22e..98f255c72 100644
--- a/app/src/main/java/io/legado/app/App.kt
+++ b/app/src/main/java/io/legado/app/App.kt
@@ -156,7 +156,7 @@ class App : MultiDexApplication() {
//用唯一的ID创建渠道对象
val downloadChannel = NotificationChannel(
channelIdDownload,
- getString(R.string.download_offline),
+ getString(R.string.offline_cache),
NotificationManager.IMPORTANCE_LOW
)
//初始化channel
diff --git a/app/src/main/java/io/legado/app/service/DownloadService.kt b/app/src/main/java/io/legado/app/service/CacheBookService.kt
similarity index 94%
rename from app/src/main/java/io/legado/app/service/DownloadService.kt
rename to app/src/main/java/io/legado/app/service/CacheBookService.kt
index 047e8d643..ed00be50e 100644
--- a/app/src/main/java/io/legado/app/service/DownloadService.kt
+++ b/app/src/main/java/io/legado/app/service/CacheBookService.kt
@@ -17,7 +17,7 @@ import io.legado.app.help.IntentHelp
import io.legado.app.help.coroutine.CompositeCoroutine
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.model.webBook.WebBook
-import io.legado.app.service.help.Download
+import io.legado.app.service.help.CacheBook
import io.legado.app.utils.postEvent
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.asCoroutineDispatcher
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArraySet
import java.util.concurrent.Executors
-class DownloadService : BaseService() {
+class CacheBookService : BaseService() {
private val threadCount = AppConfig.threadCount
private var searchPool =
Executors.newFixedThreadPool(threadCount).asCoroutineDispatcher()
@@ -49,11 +49,11 @@ class DownloadService : BaseService() {
val builder = NotificationCompat.Builder(this, AppConst.channelIdDownload)
.setSmallIcon(R.drawable.ic_download)
.setOngoing(true)
- .setContentTitle(getString(R.string.download_offline))
+ .setContentTitle(getString(R.string.offline_cache))
builder.addAction(
R.drawable.ic_stop_black_24dp,
getString(R.string.cancel),
- IntentHelp.servicePendingIntent(this, IntentAction.stop)
+ IntentHelp.servicePendingIntent(this, IntentAction.stop)
)
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
}
@@ -138,7 +138,7 @@ class DownloadService : BaseService() {
chapters.addAll(it)
downloadMap[bookUrl] = chapters
} else {
- Download.addLog("${getBook(bookUrl)?.name} is empty")
+ CacheBook.addLog("${getBook(bookUrl)?.name} is empty")
}
}
for (i in 0 until threadCount) {
@@ -158,7 +158,7 @@ class DownloadService : BaseService() {
downloadingCount += 1
val task = Coroutine.async(this, context = searchPool) {
if (!isActive) return@async
- val bookChapter: BookChapter? = synchronized(this@DownloadService) {
+ val bookChapter: BookChapter? = synchronized(this@CacheBookService) {
downloadMap.forEach {
it.value.forEach { chapter ->
if (!downloadingList.contains(chapter.url)) {
@@ -193,12 +193,12 @@ class DownloadService : BaseService() {
synchronized(this) {
downloadingList.remove(bookChapter.url)
}
- Download.addLog("getContentError${it.localizedMessage}")
+ CacheBook.addLog("getContentError${it.localizedMessage}")
updateNotification("getContentError${it.localizedMessage}")
}
.onSuccess(IO) { content ->
BookHelp.saveContent(book, bookChapter, content)
- synchronized(this@DownloadService) {
+ synchronized(this@CacheBookService) {
downloadCount[book.bookUrl]?.increaseSuccess()
downloadCount[book.bookUrl]?.increaseFinished()
downloadCount[book.bookUrl]?.let {
@@ -231,7 +231,7 @@ class DownloadService : BaseService() {
}
}
}.onError {
- Download.addLog("ERROR:${it.localizedMessage}")
+ CacheBook.addLog("ERROR:${it.localizedMessage}")
updateNotification("ERROR:${it.localizedMessage}")
}
tasks.add(task)
diff --git a/app/src/main/java/io/legado/app/service/help/Download.kt b/app/src/main/java/io/legado/app/service/help/CacheBook.kt
similarity index 80%
rename from app/src/main/java/io/legado/app/service/help/Download.kt
rename to app/src/main/java/io/legado/app/service/help/CacheBook.kt
index 5ba31004a..f2748826a 100644
--- a/app/src/main/java/io/legado/app/service/help/Download.kt
+++ b/app/src/main/java/io/legado/app/service/help/CacheBook.kt
@@ -3,9 +3,9 @@ package io.legado.app.service.help
import android.content.Context
import android.content.Intent
import io.legado.app.constant.IntentAction
-import io.legado.app.service.DownloadService
+import io.legado.app.service.CacheBookService
-object Download {
+object CacheBook {
val logs = arrayListOf()
@@ -20,7 +20,7 @@ object Download {
}
fun start(context: Context, bookUrl: String, start: Int, end: Int) {
- Intent(context, DownloadService::class.java).let {
+ Intent(context, CacheBookService::class.java).let {
it.action = IntentAction.start
it.putExtra("bookUrl", bookUrl)
it.putExtra("start", start)
@@ -30,7 +30,7 @@ object Download {
}
fun remove(context: Context, bookUrl: String) {
- Intent(context, DownloadService::class.java).let {
+ Intent(context, CacheBookService::class.java).let {
it.action = IntentAction.remove
it.putExtra("bookUrl", bookUrl)
context.startService(it)
@@ -38,7 +38,7 @@ object Download {
}
fun stop(context: Context) {
- Intent(context, DownloadService::class.java).let {
+ Intent(context, CacheBookService::class.java).let {
it.action = IntentAction.stop
context.startService(it)
}
diff --git a/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
similarity index 90%
rename from app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt
rename to app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
index a95ee3b54..6dbbf7589 100644
--- a/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.book.download
+package io.legado.app.ui.book.cache
import android.app.Activity
import android.content.Intent
@@ -18,7 +18,7 @@ import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
import io.legado.app.data.entities.BookGroup
import io.legado.app.help.BookHelp
-import io.legado.app.service.help.Download
+import io.legado.app.service.help.CacheBook
import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.ui.filechooser.FilePicker
import io.legado.app.ui.widget.dialog.TextListDialog
@@ -32,12 +32,12 @@ import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArraySet
-class DownloadActivity : VMBaseActivity(R.layout.activity_download),
+class CacheActivity : VMBaseActivity(R.layout.activity_download),
FileChooserDialog.CallBack,
- DownloadAdapter.CallBack {
+ CacheAdapter.CallBack {
private val exportRequestCode = 32
private val exportBookPathKey = "exportBookPath"
- lateinit var adapter: DownloadAdapter
+ lateinit var adapter: CacheAdapter
private var groupLiveData: LiveData>? = null
private var booksLiveData: LiveData>? = null
private var menu: Menu? = null
@@ -45,8 +45,8 @@ class DownloadActivity : VMBaseActivity(R.layout.activity_dow
private val groupList: ArrayList = arrayListOf()
private var groupId: Int = -1
- override val viewModel: DownloadViewModel
- get() = getViewModel(DownloadViewModel::class.java)
+ override val viewModel: CacheViewModel
+ get() = getViewModel(CacheViewModel::class.java)
override fun onActivityCreated(savedInstanceState: Bundle?) {
groupId = intent.getIntExtra("groupId", -1)
@@ -81,19 +81,19 @@ class DownloadActivity : VMBaseActivity(R.layout.activity_dow
R.id.menu_download -> launch(IO) {
if (adapter.downloadMap.isNullOrEmpty()) {
adapter.getItems().forEach { book ->
- Download.start(
- this@DownloadActivity,
+ CacheBook.start(
+ this@CacheActivity,
book.bookUrl,
book.durChapterIndex,
book.totalChapterNum
)
}
} else {
- Download.stop(this@DownloadActivity)
+ CacheBook.stop(this@CacheActivity)
}
}
R.id.menu_log -> {
- TextListDialog.show(supportFragmentManager, getString(R.string.log), Download.logs)
+ TextListDialog.show(supportFragmentManager, getString(R.string.log), CacheBook.logs)
}
R.id.menu_no_group -> {
title_bar.subtitle = getString(R.string.no_group)
@@ -116,7 +116,7 @@ class DownloadActivity : VMBaseActivity(R.layout.activity_dow
private fun initRecyclerView() {
recycler_view.layoutManager = LinearLayoutManager(this)
- adapter = DownloadAdapter(this, this)
+ adapter = CacheAdapter(this, this)
recycler_view.adapter = adapter
}
@@ -191,7 +191,7 @@ class DownloadActivity : VMBaseActivity(R.layout.activity_dow
override fun export(position: Int) {
exportPosition = position
val default = arrayListOf()
- val path = ACache.get(this@DownloadActivity).getAsString(exportBookPathKey)
+ val path = ACache.get(this@CacheActivity).getAsString(exportBookPathKey)
if (!path.isNullOrEmpty()) {
default.add(path)
}
@@ -213,7 +213,7 @@ class DownloadActivity : VMBaseActivity(R.layout.activity_dow
override fun onFilePicked(requestCode: Int, currentPath: String) {
when (requestCode) {
exportRequestCode -> {
- ACache.get(this@DownloadActivity).put(exportBookPathKey, currentPath)
+ ACache.get(this@CacheActivity).put(exportBookPathKey, currentPath)
startExport(currentPath)
}
}
@@ -228,7 +228,7 @@ class DownloadActivity : VMBaseActivity(R.layout.activity_dow
uri,
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
)
- ACache.get(this@DownloadActivity).put(exportBookPathKey, uri.toString())
+ ACache.get(this@CacheActivity).put(exportBookPathKey, uri.toString())
startExport(uri.toString())
}
}
diff --git a/app/src/main/java/io/legado/app/ui/book/download/DownloadAdapter.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt
similarity index 89%
rename from app/src/main/java/io/legado/app/ui/book/download/DownloadAdapter.kt
rename to app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt
index 3da043450..f90853d77 100644
--- a/app/src/main/java/io/legado/app/ui/book/download/DownloadAdapter.kt
+++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheAdapter.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.book.download
+package io.legado.app.ui.book.cache
import android.content.Context
import android.widget.ImageView
@@ -7,14 +7,14 @@ import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
-import io.legado.app.service.help.Download
+import io.legado.app.service.help.CacheBook
import kotlinx.android.synthetic.main.item_download.view.*
import org.jetbrains.anko.sdk27.listeners.onClick
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArraySet
-class DownloadAdapter(context: Context, private val callBack: CallBack) :
+class CacheAdapter(context: Context, private val callBack: CallBack) :
SimpleRecyclerAdapter(context, R.layout.item_download) {
val cacheChapters = hashMapOf>()
@@ -47,9 +47,9 @@ class DownloadAdapter(context: Context, private val callBack: CallBack) :
iv_download.onClick {
getItem(holder.layoutPosition)?.let {
if (downloadMap?.containsKey(it.bookUrl) == true) {
- Download.remove(context, it.bookUrl)
+ CacheBook.remove(context, it.bookUrl)
} else {
- Download.start(context, it.bookUrl, 0, it.totalChapterNum)
+ CacheBook.start(context, it.bookUrl, 0, it.totalChapterNum)
}
}
}
diff --git a/app/src/main/java/io/legado/app/ui/book/download/DownloadViewModel.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt
similarity index 97%
rename from app/src/main/java/io/legado/app/ui/book/download/DownloadViewModel.kt
rename to app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt
index c4a3ea97f..0673aaaab 100644
--- a/app/src/main/java/io/legado/app/ui/book/download/DownloadViewModel.kt
+++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt
@@ -1,4 +1,4 @@
-package io.legado.app.ui.book.download
+package io.legado.app.ui.book.cache
import android.app.Application
import android.net.Uri
@@ -13,7 +13,7 @@ import io.legado.app.utils.*
import java.io.File
-class DownloadViewModel(application: Application) : BaseViewModel(application) {
+class CacheViewModel(application: Application) : BaseViewModel(application) {
fun export(path: String, book: Book, finally: (msg: String) -> Unit) {
diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt
index 5360e08e6..2b7e8fd82 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt
@@ -20,7 +20,7 @@ import io.legado.app.lib.dialogs.*
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.ThemeStore
import io.legado.app.lib.theme.backgroundColor
-import io.legado.app.service.help.Download
+import io.legado.app.service.help.CacheBook
import io.legado.app.service.help.ReadBook
import io.legado.app.ui.widget.text.AutoCompleteTextView
import io.legado.app.utils.applyTint
@@ -108,7 +108,7 @@ object ReadBookActivityHelp {
@SuppressLint("InflateParams")
fun showDownloadDialog(context: Context) {
ReadBook.book?.let { book ->
- context.alert(titleResource = R.string.download_offline) {
+ context.alert(titleResource = R.string.offline_cache) {
var view: View? = null
customView {
LayoutInflater.from(context).inflate(R.layout.dialog_download_choice, null)
@@ -123,7 +123,7 @@ object ReadBookActivityHelp {
view?.apply {
val start = edit_start?.text?.toString()?.toInt() ?: 0
val end = edit_end?.text?.toString()?.toInt() ?: book.totalChapterNum
- Download.start(context, book.bookUrl, start - 1, end - 1)
+ CacheBook.start(context, book.bookUrl, start - 1, end - 1)
}
}
noButton()
diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt
index 28ae162d1..542f5a13f 100644
--- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt
+++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt
@@ -23,7 +23,7 @@ import io.legado.app.lib.dialogs.okButton
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.accentColor
import io.legado.app.ui.book.arrange.ArrangeBookActivity
-import io.legado.app.ui.book.download.DownloadActivity
+import io.legado.app.ui.book.cache.CacheActivity
import io.legado.app.ui.book.group.GroupManageDialog
import io.legado.app.ui.book.local.ImportBookActivity
import io.legado.app.ui.book.search.SearchActivity
@@ -87,7 +87,7 @@ class BookshelfFragment : VMBaseFragment(R.layout.fragment_b
Pair("groupId", selectedGroup?.groupId ?: 0),
Pair("groupName", selectedGroup?.groupName ?: 0)
)
- R.id.menu_download -> startActivity(
+ R.id.menu_download -> startActivity(
Pair("groupId", selectedGroup?.groupId ?: 0),
Pair("groupName", selectedGroup?.groupName ?: 0)
)
diff --git a/app/src/main/res/layout/activity_download.xml b/app/src/main/res/layout/activity_download.xml
index 2f7ebd6f2..c499af731 100644
--- a/app/src/main/res/layout/activity_download.xml
+++ b/app/src/main/res/layout/activity_download.xml
@@ -9,7 +9,7 @@
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- app:title="@string/download_offline" />
+ app:title="@string/offline_cache" />
- 啟用 Web 服務
web 編輯書源
http://%1$s:%2$d
- 離線下載
- 離線下載
- 下載已選擇的章節到本地
+ 離線緩存
+ 離線緩存
+ 緩存已選擇的章節到本地
換源
\u3000\u3000這是一款使用 Kotlin 全新開發的開源的閲讀應用程式,歡迎你的加入。關注公眾號[legado-top]!
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 09d1225b4..c14a9a485 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -83,9 +83,9 @@
啟用Web服務
web編輯書源
http://%1$s:%2$d
- 離線下載
- 離線下載
- 下載選擇的章節到本機
+ 離線緩存
+ 離線緩存
+ 緩存選擇的章節到本機
換源
\u3000\u3000這是一款使用Kotlin全新開發的開源的閱讀軟體,歡迎您的加入。關注公眾號[legado-top]!
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index a32fa95bb..036bcd6f9 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -85,9 +85,9 @@
启用Web服务
web编辑书源
http://%1$s:%2$d
- 离线下载
- 离线下载
- 下载选择的章节到本地
+ 离线缓存
+ 离线缓存
+ 缓存选择的章节到本地
换源
\u3000\u3000这是一款使用Kotlin全新开发的开源的阅读软件,欢迎您的加入。关注公众号[开源阅读]!
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6cdf21bb0..26124f21d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -85,9 +85,9 @@
Enable web service
Edit book sources on the web
http://%1$s:%2$d
- Offline download
- Offline download
- Download the selected chapter(s) to Storage
+ Offline cache
+ Offline cache
+ cache the selected chapter(s) to Storage
Change Origin
\u3000\u3000 This is an open source reading software newly developed by Kotlin, welcome to join us. Follow the WeChat Official Account [开源阅读]!