|
|
|
@ -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 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -926,13 +932,6 @@ class ReadBookActivity : BaseReadBookActivity(), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 跳转到指定章节 |
|
|
|
|
*/ |
|
|
|
|
override fun skipToChapter(index: Int) { |
|
|
|
|
viewModel.openChapter(index) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 打开搜索界面 |
|
|
|
|
*/ |
|
|
|
@ -984,6 +983,7 @@ class ReadBookActivity : BaseReadBookActivity(), |
|
|
|
|
upNavigationBarColor() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 退出全文搜索 |
|
|
|
|
override fun exitSearchMenu() { |
|
|
|
|
if (isShowingSearchResult) { |
|
|
|
|
isShowingSearchResult = false |
|
|
|
@ -994,6 +994,20 @@ 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> { |
|
|
|
@ -1141,11 +1155,18 @@ class ReadBookActivity : BaseReadBookActivity(), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* 进度条跳转到指定章节 */ |
|
|
|
|
override fun skipToChapter(index: Int) { |
|
|
|
|
viewModel.openChapter(index) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* 全文搜索跳转 */ |
|
|
|
|
override fun navigateToSearch(searchResult: SearchResult, index: Int) { |
|
|
|
|
viewModel.searchResultIndex = index |
|
|
|
|
skipToSearch(searchResult) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* 全文搜索跳转 */ |
|
|
|
|
private fun skipToSearch(searchResult: SearchResult) { |
|
|
|
|
val previousResult = binding.searchMenu.previousSearchResult |
|
|
|
|
|
|
|
|
|