pull/1658/head
kunfei 3 years ago
parent 4fc68405ed
commit e4ea55d42f
  1. 8
      app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt
  2. 5
      app/src/main/java/io/legado/app/ui/book/audio/AudioPlayViewModel.kt
  3. 5
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt
  4. 3
      app/src/main/java/io/legado/app/ui/book/read/ContentEditDialog.kt
  5. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt
  6. 2
      app/src/main/res/layout/dialog_content_edit.xml
  7. 5
      app/src/main/res/menu/content_edit.xml
  8. 1
      app/src/main/res/values-es-rES/strings.xml
  9. 1
      app/src/main/res/values-ja-rJP/strings.xml
  10. 1
      app/src/main/res/values-pt-rBR/strings.xml
  11. 1
      app/src/main/res/values-zh-rHK/strings.xml
  12. 1
      app/src/main/res/values-zh-rTW/strings.xml
  13. 1
      app/src/main/res/values-zh/strings.xml
  14. 1
      app/src/main/res/values/strings.xml

@ -6,6 +6,7 @@ import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
import io.legado.app.data.entities.BookSource
import io.legado.app.data.entities.rule.TocRule
import io.legado.app.help.ContentProcessor
import io.legado.app.model.Debug
import io.legado.app.model.NoStackTraceException
import io.legado.app.model.TocEmptyException
@ -118,9 +119,10 @@ object BookChapterList {
list.forEachIndexed { index, bookChapter ->
bookChapter.index = index
}
book.latestChapterTitle = list.last().title
book.durChapterTitle =
list.getOrNull(book.durChapterIndex)?.title ?: book.latestChapterTitle
val replaceRules = ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
book.latestChapterTitle = list.last().getDisplayTitle(replaceRules)
book.durChapterTitle = list.getOrElse(book.durChapterIndex) { list.last() }
.getDisplayTitle(replaceRules)
if (book.totalChapterNum < list.size) {
book.lastCheckCount = list.size - book.totalChapterNum
book.latestChapterTime = System.currentTimeMillis()

@ -10,6 +10,7 @@ import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
import io.legado.app.data.entities.BookSource
import io.legado.app.help.BookHelp
import io.legado.app.help.ContentProcessor
import io.legado.app.model.AudioPlay
import io.legado.app.model.webBook.WebBook
import io.legado.app.utils.postEvent
@ -120,7 +121,9 @@ class AudioPlayViewModel(application: Application) : BaseViewModel(application)
chapters,
oldTocSize
)
book.durChapterTitle = chapters[book.durChapterIndex].title
book.durChapterTitle = chapters[book.durChapterIndex].getDisplayTitle(
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
)
appDb.bookDao.update(book)
appDb.bookChapterDao.insert(*chapters.toTypedArray())
}

@ -13,6 +13,7 @@ import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
import io.legado.app.data.entities.BookSource
import io.legado.app.help.BookHelp
import io.legado.app.help.ContentProcessor
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.model.NoStackTraceException
import io.legado.app.model.ReadBook
@ -208,7 +209,9 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
chapters,
oldTocSize
)
book.durChapterTitle = chapters[book.durChapterIndex].title
book.durChapterTitle = chapters[book.durChapterIndex].getDisplayTitle(
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
)
if (inBookshelf) {
appDb.bookDao.update(book)
appDb.bookChapterDao.insert(*chapters.toTypedArray())

@ -19,6 +19,7 @@ import io.legado.app.lib.theme.primaryColor
import io.legado.app.model.ReadBook
import io.legado.app.model.webBook.WebBook
import io.legado.app.utils.applyTint
import io.legado.app.utils.sendToClip
import io.legado.app.utils.setLayout
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Dispatchers.IO
@ -78,6 +79,8 @@ class ContentEditDialog : BaseDialogFragment(R.layout.dialog_content_edit) {
binding.contentView.setText(content)
ReadBook.loadContent(ReadBook.durChapterIndex, resetPageOffset = false)
}
R.id.menu_copy_all -> requireContext()
.sendToClip("${binding.toolBar.title}\n${viewModel.content}")
}
return@setOnMenuItemClickListener true
}

@ -189,7 +189,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
chapters,
oldBook.totalChapterNum
)
book.durChapterTitle = chapters[book.durChapterIndex].title
book.durChapterTitle = chapters[book.durChapterIndex].getDisplayTitle(
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
)
oldBook.changeTo(book)
appDb.bookChapterDao.insert(*chapters.toTypedArray())
ReadBook.resetData(book)

@ -11,7 +11,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?attr/actionBarStyle"
app:title="code edit"
app:title="edit"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:titleTextAppearance="@style/ToolbarTitle" />

@ -15,4 +15,9 @@
android:title="@string/reset"
app:showAsAction="never" />
<item
android:id="@+id/menu_copy_all"
android:title="@string/copy_all"
app:showAsAction="never" />
</menu>

@ -943,5 +943,6 @@
<string name="book_change_source">整书换源</string>
<string name="sort_by_time">时间排序</string>
<string name="enable_record">开启记录</string>
<string name="copy_all">拷贝所有</string>
<!-- string end -->
</resources>

@ -946,5 +946,6 @@
<string name="book_change_source">整书换源</string>
<string name="sort_by_time">时间排序</string>
<string name="enable_record">开启记录</string>
<string name="copy_all">拷贝所有</string>
<!-- string end -->
</resources>

@ -946,5 +946,6 @@
<string name="book_change_source">整书换源</string>
<string name="sort_by_time">时间排序</string>
<string name="enable_record">开启记录</string>
<string name="copy_all">拷贝所有</string>
<!-- string end -->
</resources>

@ -943,5 +943,6 @@
<string name="book_change_source">整书换源</string>
<string name="sort_by_time">时间排序</string>
<string name="enable_record">开启记录</string>
<string name="copy_all">拷贝所有</string>
<!-- string end -->
</resources>

@ -945,5 +945,6 @@
<string name="book_change_source">整书换源</string>
<string name="sort_by_time">时间排序</string>
<string name="enable_record">开启记录</string>
<string name="copy_all">拷贝所有</string>
<!-- string end -->
</resources>

@ -945,5 +945,6 @@
<string name="book_change_source">整书换源</string>
<string name="sort_by_time">时间排序</string>
<string name="enable_record">开启记录</string>
<string name="copy_all">拷贝所有</string>
<!-- string end -->
</resources>

@ -946,5 +946,6 @@
<string name="book_change_source">整书换源</string>
<string name="sort_by_time">时间排序</string>
<string name="enable_record">开启记录</string>
<string name="copy_all">拷贝所有</string>
<!-- string end -->
</resources>

Loading…
Cancel
Save