pull/1625/head
kunfei 3 years ago
parent e495a7fa0e
commit f6f81d3600
  1. 26
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 22
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt
  3. 23
      app/src/main/res/menu/book_read.xml
  4. 3
      app/src/main/res/values-es-rES/strings.xml
  5. 3
      app/src/main/res/values-ja-rJP/strings.xml
  6. 3
      app/src/main/res/values-pt-rBR/strings.xml
  7. 3
      app/src/main/res/values-zh-rHK/strings.xml
  8. 3
      app/src/main/res/values-zh-rTW/strings.xml
  9. 3
      app/src/main/res/values-zh/strings.xml
  10. 3
      app/src/main/res/values/strings.xml

@ -241,14 +241,36 @@ class ReadBookActivity : BaseReadBookActivity(),
showDialogFragment(ChangeSourceDialog(it.name, it.author))
}
}
R.id.menu_refresh -> {
R.id.menu_refresh_dur -> {
if (ReadBook.bookSource == null) {
upContent()
} else {
ReadBook.book?.let {
ReadBook.curTextChapter = null
binding.readView.upContent()
viewModel.refreshContent(it)
viewModel.refreshContentDur(it)
}
}
}
R.id.menu_refresh_after -> {
if (ReadBook.bookSource == null) {
upContent()
} else {
ReadBook.book?.let {
ReadBook.clearTextChapter()
binding.readView.upContent()
viewModel.refreshContentAfter(it)
}
}
}
R.id.menu_refresh_all -> {
if (ReadBook.bookSource == null) {
upContent()
} else {
ReadBook.book?.let {
ReadBook.clearTextChapter()
binding.readView.upContent()
viewModel.refreshContentAll(it)
}
}
}

@ -253,7 +253,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
}
}
fun refreshContent(book: Book) {
fun refreshContentDur(book: Book) {
execute {
appDb.bookChapterDao.getChapter(book.bookUrl, ReadBook.durChapterIndex)
?.let { chapter ->
@ -263,6 +263,26 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
}
}
fun refreshContentAfter(book: Book) {
execute {
appDb.bookChapterDao.getChapterList(
book.bookUrl,
ReadBook.durChapterIndex,
book.totalChapterNum
).forEach { chapter ->
BookHelp.delContent(book, chapter)
}
ReadBook.loadContent(false)
}
}
fun refreshContentAll(book: Book) {
execute {
BookHelp.clearCache(book)
ReadBook.loadContent(false)
}
}
fun reverseContent(book: Book) {
execute {
appDb.bookChapterDao.getChapter(book.bookUrl, ReadBook.durChapterIndex)

@ -15,7 +15,28 @@
android:id="@+id/menu_refresh"
android:icon="@drawable/ic_refresh_black_24dp"
android:title="@string/refresh"
app:showAsAction="always" />
app:showAsAction="always">
<menu>
<item
android:id="@+id/menu_refresh_dur"
android:title="@string/menu_refresh_dur"
app:showAsAction="never" />
<item
android:id="@+id/menu_refresh_after"
android:title="@string/menu_refresh_after"
app:showAsAction="never" />
<item
android:id="@+id/menu_refresh_all"
android:title="@string/menu_refresh_all"
app:showAsAction="never" />
</menu>
</item>
<item
android:id="@+id/menu_download"

@ -934,5 +934,8 @@
<string name="scope_content">作用于正文</string>
<string name="join_qq_channel">加入QQ频道</string>
<string name="qq_channel_summary">点击加入阅读QQ频道</string>
<string name="menu_refresh_dur">刷新当前章节</string>
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<!-- string end -->
</resources>

@ -937,5 +937,8 @@
<string name="scope_content">作用于正文</string>
<string name="join_qq_channel">加入QQ频道</string>
<string name="qq_channel_summary">点击加入阅读QQ频道</string>
<string name="menu_refresh_dur">刷新当前章节</string>
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<!-- string end -->
</resources>

@ -937,5 +937,8 @@
<string name="scope_content">作用于正文</string>
<string name="join_qq_channel">加入QQ频道</string>
<string name="qq_channel_summary">点击加入阅读QQ频道</string>
<string name="menu_refresh_dur">刷新当前章节</string>
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<!-- string end -->
</resources>

@ -934,5 +934,8 @@
<string name="scope_content">作用于正文</string>
<string name="join_qq_channel">加入QQ频道</string>
<string name="qq_channel_summary">点击加入阅读QQ频道</string>
<string name="menu_refresh_dur">刷新当前章节</string>
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<!-- string end -->
</resources>

@ -936,5 +936,8 @@
<string name="scope_content">作用于正文</string>
<string name="join_qq_channel">加入QQ频道</string>
<string name="qq_channel_summary">点击加入阅读QQ频道</string>
<string name="menu_refresh_dur">刷新当前章节</string>
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<!-- string end -->
</resources>

@ -936,5 +936,8 @@
<string name="scope_content">作用于正文</string>
<string name="join_qq_channel">加入QQ频道</string>
<string name="qq_channel_summary">点击加入阅读QQ频道</string>
<string name="menu_refresh_dur">刷新当前章节</string>
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<!-- string end -->
</resources>

@ -937,5 +937,8 @@
<string name="scope_content">作用于正文</string>
<string name="join_qq_channel">Join QQ channel</string>
<string name="qq_channel_summary">点击加入阅读QQ频道</string>
<string name="menu_refresh_dur">刷新当前章节</string>
<string name="menu_refresh_after">刷新之后章节</string>
<string name="menu_refresh_all">刷新全部章节</string>
<!-- string end -->
</resources>

Loading…
Cancel
Save