优化代码

pull/754/head^2
gedoor 4 years ago
parent 39c7975855
commit 4f12856169
  1. 16
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@ -70,6 +70,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
AutoReadDialog.CallBack,
TocRegexDialog.CallBack,
ColorPickerDialogListener {
private val requestCodeChapterList = 568
private val requestCodeReplace = 312
private val requestCodeSearchResult = 123
@ -154,6 +155,9 @@ class ReadBookActivity : ReadBookBaseActivity(),
return super.onPrepareOptionsMenu(menu)
}
/**
* 更新菜单
*/
private fun upMenu() {
val menu = menu
val book = ReadBook.book
@ -189,10 +193,14 @@ class ReadBookActivity : ReadBookBaseActivity(),
}
}
R.id.menu_refresh -> {
ReadBook.book?.let {
ReadBook.curTextChapter = null
binding.readView.upContent()
viewModel.refreshContent(it)
if (ReadBook.bookSource == null) {
upContent()
} else {
ReadBook.book?.let {
ReadBook.curTextChapter = null
binding.readView.upContent()
viewModel.refreshContent(it)
}
}
}
R.id.menu_download -> showDownloadDialog()

Loading…
Cancel
Save