pull/37/head
kunfei 5 years ago
parent 11275a4f1b
commit 00a68d4765
  1. 9
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
  2. 4
      app/src/main/res/menu/book_search.xml

@ -72,6 +72,14 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
precisionSearchMenuItem?.isChecked = getPrefBoolean("precisionSearch") precisionSearchMenuItem?.isChecked = getPrefBoolean("precisionSearch")
} }
R.id.menu_source_manage -> startActivity<BookSourceActivity>() R.id.menu_source_manage -> startActivity<BookSourceActivity>()
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) return super.onCompatOptionsItemSelected(item)
} }
@ -164,6 +172,7 @@ class SearchActivity : VMBaseActivity<SearchViewModel>(R.layout.activity_book_se
private fun upGroupMenu() { private fun upGroupMenu() {
menu?.removeGroup(R.id.source_group) menu?.removeGroup(R.id.source_group)
menu?.add(R.id.source_group, Menu.NONE, Menu.NONE, R.string.all_source)
groups.map { groups.map {
menu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it) menu?.add(R.id.source_group, Menu.NONE, Menu.NONE, it)
} }

@ -14,7 +14,9 @@
android:title="@string/book_source_manage" android:title="@string/book_source_manage"
app:showAsAction="never" /> app:showAsAction="never" />
<group android:id="@+id/source_group"> <group
android:id="@+id/source_group"
android:checkableBehavior="single">
</group> </group>

Loading…
Cancel
Save