|
|
@ -109,7 +109,6 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel |
|
|
|
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean { |
|
|
|
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean { |
|
|
|
menuInflater.inflate(R.menu.book_search, menu) |
|
|
|
menuInflater.inflate(R.menu.book_search, menu) |
|
|
|
this.menu = menu |
|
|
|
this.menu = menu |
|
|
|
upSearchScopeMenu() |
|
|
|
|
|
|
|
precisionSearchMenuItem = menu.findItem(R.id.menu_precision_search) |
|
|
|
precisionSearchMenuItem = menu.findItem(R.id.menu_precision_search) |
|
|
|
precisionSearchMenuItem?.isChecked = getPrefBoolean(PreferKey.precisionSearch) |
|
|
|
precisionSearchMenuItem?.isChecked = getPrefBoolean(PreferKey.precisionSearch) |
|
|
|
return super.onCompatCreateOptionsMenu(menu) |
|
|
|
return super.onCompatCreateOptionsMenu(menu) |
|
|
@ -220,7 +219,7 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel |
|
|
|
|
|
|
|
|
|
|
|
private fun initData() { |
|
|
|
private fun initData() { |
|
|
|
viewModel.searchScope.stateLiveData.observe(this) { |
|
|
|
viewModel.searchScope.stateLiveData.observe(this) { |
|
|
|
upSearchScopeMenu() |
|
|
|
upSearchScope() |
|
|
|
} |
|
|
|
} |
|
|
|
viewModel.isSearchLiveData.observe(this) { |
|
|
|
viewModel.isSearchLiveData.observe(this) { |
|
|
|
if (it) { |
|
|
|
if (it) { |
|
|
@ -237,9 +236,8 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun upSearchScopeMenu() { |
|
|
|
private fun upSearchScope() { |
|
|
|
menu?.findItem(R.id.menu_search_scope)?.title = |
|
|
|
binding.tvSearchScope.text = viewModel.searchScope.display |
|
|
|
"${getString(R.string.search_scope)}-${viewModel.searchScope.display}" |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -249,7 +247,7 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel |
|
|
|
val searchScope = intent?.getStringExtra("searchScope") |
|
|
|
val searchScope = intent?.getStringExtra("searchScope") |
|
|
|
searchScope?.let { |
|
|
|
searchScope?.let { |
|
|
|
viewModel.searchScope.update(searchScope) |
|
|
|
viewModel.searchScope.update(searchScope) |
|
|
|
upSearchScopeMenu() |
|
|
|
upSearchScope() |
|
|
|
} |
|
|
|
} |
|
|
|
val key = intent?.getStringExtra("key") |
|
|
|
val key = intent?.getStringExtra("key") |
|
|
|
if (key.isNullOrBlank()) { |
|
|
|
if (key.isNullOrBlank()) { |
|
|
|