From 00a68d4765f24d9efe767b91c42ab21fbc41be82 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 19 Oct 2019 12:03:18 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/book/search/SearchActivity.kt | 9 +++++++++ app/src/main/res/menu/book_search.xml | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) 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" /> - +