diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt index ee9a13c52..32667f476 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt @@ -72,6 +72,14 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se precisionSearchMenuItem?.isChecked = getPrefBoolean("precisionSearch") } R.id.menu_source_manage -> startActivity() + else -> if (item.groupId == R.id.source_group) { + item.isChecked = true + if (item.title.toString() == getString(R.string.all_source)) { + putPrefString("sourceGroup", "") + } else { + putPrefString("sourceGroup", item.title.toString()) + } + } } return super.onCompatOptionsItemSelected(item) } @@ -164,6 +172,7 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se private fun upGroupMenu() { menu?.removeGroup(R.id.source_group) + menu?.add(R.id.source_group, Menu.NONE, Menu.NONE, R.string.all_source) groups.map { menu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it) } diff --git a/app/src/main/res/menu/book_search.xml b/app/src/main/res/menu/book_search.xml index 33e0b51f5..9c0b1762f 100644 --- a/app/src/main/res/menu/book_search.xml +++ b/app/src/main/res/menu/book_search.xml @@ -14,7 +14,9 @@ android:title="@string/book_source_manage" app:showAsAction="never" /> - +