mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -24,6 +24,9 @@ interface ReplaceRuleDao {
|
||||
@Query("select `group` from replace_rules where `group` is not null and `group` <> ''")
|
||||
fun flowGroupsUnProcessed(): Flow<List<String>>
|
||||
|
||||
@Query("select * from replace_rules where `group` is null or trim(`group`) = '' or trim(`group`) like '%未分组%'")
|
||||
fun flowNoGroup(): Flow<List<ReplaceRule>>
|
||||
|
||||
@get:Query("SELECT MIN(sortOrder) FROM replace_rules")
|
||||
val minOrder: Int
|
||||
|
||||
|
||||
@@ -182,6 +182,9 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
|
||||
searchKey.isNullOrEmpty() -> {
|
||||
appDb.replaceRuleDao.flowAll()
|
||||
}
|
||||
searchKey == getString(R.string.no_group) -> {
|
||||
appDb.replaceRuleDao.flowNoGroup()
|
||||
}
|
||||
searchKey.startsWith("group:") -> {
|
||||
val key = searchKey.substringAfter("group:")
|
||||
appDb.replaceRuleDao.flowGroupSearch("%$key%")
|
||||
@@ -225,6 +228,9 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
|
||||
}
|
||||
R.id.menu_import_qr -> qrCodeResult.launch()
|
||||
R.id.menu_help -> showHelp()
|
||||
R.id.menu_group_null -> {
|
||||
searchView.setQuery(getString(R.string.no_group), true)
|
||||
}
|
||||
else -> if (item.groupId == R.id.replace_group) {
|
||||
searchView.setQuery("group:${item.title}", true)
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
android:id="@+id/menu_group_manage"
|
||||
android:title="@string/group_manage" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_group_null"
|
||||
android:title="@string/no_group" />
|
||||
|
||||
<group android:id="@+id/replace_group">
|
||||
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user