pull/2412/head
kunfei 2 years ago
parent 6256e78f5f
commit aa74875c15
  1. 9
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
  2. 16
      app/src/main/java/io/legado/app/ui/book/search/SearchScopeDialog.kt

@ -39,6 +39,7 @@ import splitties.init.appCtx
class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel>(), class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel>(),
BookAdapter.CallBack, BookAdapter.CallBack,
HistoryKeyAdapter.CallBack, HistoryKeyAdapter.CallBack,
SearchScopeDialog.Callback,
SearchAdapter.CallBack { SearchAdapter.CallBack {
override val binding by viewBinding(ActivityBookSearchBinding::inflate) override val binding by viewBinding(ActivityBookSearchBinding::inflate)
@ -402,10 +403,18 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
} }
} }
/**
* 删除搜索记录
*/
override fun deleteHistory(searchKeyword: SearchKeyword) { override fun deleteHistory(searchKeyword: SearchKeyword) {
viewModel.deleteHistory(searchKeyword) viewModel.deleteHistory(searchKeyword)
} }
override fun onSearchScopeOk() {
}
private fun alertSearchScope() { private fun alertSearchScope() {
showDialogFragment<SearchScopeDialog>() showDialogFragment<SearchScopeDialog>()
} }

@ -7,10 +7,24 @@ import io.legado.app.base.BaseDialogFragment
class SearchScopeDialog : BaseDialogFragment(R.layout.dialog_search_scope, true) { class SearchScopeDialog : BaseDialogFragment(R.layout.dialog_search_scope, true) {
val callback: Callback
get() {
return parentFragment as? Callback ?: activity as Callback
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
TODO("Not yet implemented")
} }
interface Callback {
/**
* 搜索范围确认
*/
fun onSearchScopeOk()
}
} }
Loading…
Cancel
Save