|
|
@ -181,6 +181,9 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
R.id.menu_group_login -> { |
|
|
|
R.id.menu_group_login -> { |
|
|
|
searchView.setQuery(getString(R.string.need_login), true) |
|
|
|
searchView.setQuery(getString(R.string.need_login), true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
R.id.menu_group_null -> { |
|
|
|
|
|
|
|
searchView.setQuery(getString(R.string.no_group), true) |
|
|
|
|
|
|
|
} |
|
|
|
R.id.menu_help -> showHelp() |
|
|
|
R.id.menu_help -> showHelp() |
|
|
|
} |
|
|
|
} |
|
|
|
if (item.groupId == R.id.source_group) { |
|
|
|
if (item.groupId == R.id.source_group) { |
|
|
@ -229,6 +232,9 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
searchKey == getString(R.string.need_login) -> { |
|
|
|
searchKey == getString(R.string.need_login) -> { |
|
|
|
appDb.bookSourceDao.flowLogin() |
|
|
|
appDb.bookSourceDao.flowLogin() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
searchKey == getString(R.string.no_group) -> { |
|
|
|
|
|
|
|
appDb.bookSourceDao.flowNoGroup() |
|
|
|
|
|
|
|
} |
|
|
|
searchKey.startsWith("group:") -> { |
|
|
|
searchKey.startsWith("group:") -> { |
|
|
|
val key = searchKey.substringAfter("group:") |
|
|
|
val key = searchKey.substringAfter("group:") |
|
|
|
appDb.bookSourceDao.flowGroupSearch(key) |
|
|
|
appDb.bookSourceDao.flowGroupSearch(key) |
|
|
@ -296,10 +302,15 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
|
|
|
|
|
|
|
|
private fun initLiveDataGroup() { |
|
|
|
private fun initLiveDataGroup() { |
|
|
|
launch { |
|
|
|
launch { |
|
|
|
|
|
|
|
val noGroupName = getString(R.string.no_group) |
|
|
|
appDb.bookSourceDao.flowGroup().conflate().collect { |
|
|
|
appDb.bookSourceDao.flowGroup().conflate().collect { |
|
|
|
groups.clear() |
|
|
|
groups.clear() |
|
|
|
it.forEach { group -> |
|
|
|
it.forEach { groupStr -> |
|
|
|
groups.addAll(group.splitNotBlank(AppPattern.splitGroupRegex)) |
|
|
|
groupStr.splitNotBlank(AppPattern.splitGroupRegex).forEach { group -> |
|
|
|
|
|
|
|
if (group != noGroupName) { |
|
|
|
|
|
|
|
groups.add(group) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
upGroupMenu() |
|
|
|
upGroupMenu() |
|
|
|
} |
|
|
|
} |
|
|
|