mirror of
https://github.com/gedoor/legado.git
synced 2024-09-03 09:55:00 +08:00
feat(SearchBook): 全文搜索/全书跳转进度条支持进度恢复
This commit is contained in:
parent
a659c03ff9
commit
22a61798d3
@ -125,6 +125,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
viewModel.searchResultIndex = index
|
||||
binding.searchMenu.updateSearchResultIndex(index)
|
||||
binding.searchMenu.selectedSearchResult?.let { currentResult ->
|
||||
ReadBook.saveCurrentBookProcess() //退出全文搜索恢复此时进度
|
||||
skipToSearch(currentResult)
|
||||
showActionMenu()
|
||||
}
|
||||
@ -493,6 +494,11 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
keyCode == KeyEvent.KEYCODE_BACK -> {
|
||||
if (isShowingSearchResult) {
|
||||
exitSearchMenu()
|
||||
restoreLastBookProcess()
|
||||
return true
|
||||
}
|
||||
if (ReadBook.lastBookPress != null) {
|
||||
restoreLastBookProcess()
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -977,6 +983,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
upNavigationBarColor()
|
||||
}
|
||||
|
||||
// 退出全文搜索
|
||||
override fun exitSearchMenu() {
|
||||
if (isShowingSearchResult) {
|
||||
isShowingSearchResult = false
|
||||
@ -987,6 +994,19 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
}
|
||||
}
|
||||
|
||||
/* 恢复到 全文搜索/进度条跳转前的位置 */
|
||||
private fun restoreLastBookProcess() {
|
||||
alert(R.string.draw) {
|
||||
setMessage(R.string.restore_last_book_process)
|
||||
yesButton {
|
||||
ReadBook.restoreLastBookProcess() //恢复启动全文搜索前的进度
|
||||
}
|
||||
noButton {
|
||||
ReadBook.lastBookPress = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun showLogin() {
|
||||
ReadBook.bookSource?.let {
|
||||
startActivity<SourceLoginActivity> {
|
||||
@ -1134,8 +1154,6 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
}
|
||||
}
|
||||
|
||||
/* 回复到 全文搜索/进度条跳转前的位置 */
|
||||
|
||||
/* 进度条跳转到指定章节 */
|
||||
override fun skipToChapter(index: Int) {
|
||||
viewModel.openChapter(index)
|
||||
|
@ -375,11 +375,13 @@ class ReadMenu @JvmOverloads constructor(
|
||||
"page" -> ReadBook.skipToPage(seekBar.progress)
|
||||
"chapter" -> {
|
||||
if (confirmSkipToChapter) {
|
||||
ReadBook.saveCurrentBookProcess()
|
||||
callBack.skipToChapter(seekBar.progress)
|
||||
} else {
|
||||
context.alert("章节跳转确认", "确定要跳转章节吗?") {
|
||||
yesButton {
|
||||
confirmSkipToChapter = true
|
||||
ReadBook.saveCurrentBookProcess()
|
||||
callBack.skipToChapter(seekBar.progress)
|
||||
}
|
||||
noButton {
|
||||
|
Loading…
Reference in New Issue
Block a user