pull/1732/head
kunfei 3 years ago
parent 29f8f6be20
commit 561f1e4e6b
  1. 29
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt

@ -64,19 +64,12 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
private var menu: Menu? = null private var menu: Menu? = null
private var precisionSearchMenuItem: MenuItem? = null private var precisionSearchMenuItem: MenuItem? = null
private var groups = linkedSetOf<String>() private var groups = linkedSetOf<String>()
private val searchFinishCallback: (isEmpty: Boolean) -> Unit = {
override fun onActivityCreated(savedInstanceState: Bundle?) { if (it) {
binding.llHistory.setBackgroundColor(backgroundColor) val searchGroup = getPrefString("searchGroup")
initRecyclerView() if (!searchGroup.isNullOrEmpty()) {
initSearchView() launch {
initOtherView() alert("搜索结果为空") {
initData()
receiptIntent(intent)
viewModel.searchFinishCallback = {
if (it) {
val searchGroup = getPrefString("searchGroup")
if (!searchGroup.isNullOrEmpty()) {
alert(R.string.empty) {
setMessage("${searchGroup}分组搜索结果为空,是否切换到全部分组") setMessage("${searchGroup}分组搜索结果为空,是否切换到全部分组")
cancelButton() cancelButton()
okButton { okButton {
@ -90,6 +83,16 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
} }
} }
override fun onActivityCreated(savedInstanceState: Bundle?) {
binding.llHistory.setBackgroundColor(backgroundColor)
initRecyclerView()
initSearchView()
initOtherView()
initData()
receiptIntent(intent)
viewModel.searchFinishCallback = searchFinishCallback
}
override fun onNewIntent(data: Intent?) { override fun onNewIntent(data: Intent?) {
super.onNewIntent(data) super.onNewIntent(data)
receiptIntent(data) receiptIntent(data)

Loading…
Cancel
Save