@ -56,10 +56,14 @@ data class Book(
return origin == BookType.local
}
fun isTxt(): Boolean {
fun isLocalTxt(): Boolean {
return isLocalBook() && originName.endsWith(".txt", true)
fun isOnLineTxt(): Boolean {
return !isLocalBook() && type == 0
override fun equals(other: Any?): Boolean {
if (other is Book) {
return other.bookUrl == bookUrl
@ -47,7 +47,7 @@ object LocalBook {
fun deleteBook(book: Book, deleteOriginal: Boolean) {
kotlin.runCatching {
if (book.isTxt()) {
if (book.isLocalTxt()) {
val bookFile = FileUtils.getFile(AnalyzeTxtFile.cacheFolder, book.originName)
bookFile.delete()
@ -125,7 +125,7 @@ class DownloadActivity : VMBaseActivity<DownloadViewModel>(R.layout.activity_dow
booksLiveData?.observe(this, Observer { list ->
val booksDownload = list.filter {
!it.isLocalBook() && it.isTxt()
it.isOnLineTxt()
val books = when (getPrefInt(PreferKey.bookshelfSort)) {
1 -> booksDownload.sortedByDescending { it.latestChapterTime }
@ -198,7 +198,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
when (item.groupId) {
R.id.menu_group_on_line -> item.isVisible = onLine
R.id.menu_group_local -> item.isVisible = !onLine
R.id.menu_group_text -> item.isVisible = book.isTxt()
R.id.menu_group_text -> item.isVisible = book.isLocalTxt()
R.id.menu_group_login ->
item.isVisible = !ReadBook.webBook?.bookSource?.loginUrl.isNullOrEmpty()
else -> if (item.itemId == R.id.menu_enable_replace) {