diff --git a/app/src/main/java/io/legado/app/data/dao/ReplaceRuleDao.kt b/app/src/main/java/io/legado/app/data/dao/ReplaceRuleDao.kt index 60a723710..bc39446a9 100644 --- a/app/src/main/java/io/legado/app/data/dao/ReplaceRuleDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/ReplaceRuleDao.kt @@ -24,6 +24,9 @@ interface ReplaceRuleDao { @Query("select `group` from replace_rules where `group` is not null and `group` <> ''") fun flowGroupsUnProcessed(): Flow> + @Query("select * from replace_rules where `group` is null or trim(`group`) = '' or trim(`group`) like '%未分组%'") + fun flowNoGroup(): Flow> + @get:Query("SELECT MIN(sortOrder) FROM replace_rules") val minOrder: Int diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt index 3c453ea15..6461f3b87 100644 --- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt @@ -182,6 +182,9 @@ class ReplaceRuleActivity : VMBaseActivity { 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 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) } diff --git a/app/src/main/res/menu/replace_rule.xml b/app/src/main/res/menu/replace_rule.xml index 9b49c60db..3ab56934e 100644 --- a/app/src/main/res/menu/replace_rule.xml +++ b/app/src/main/res/menu/replace_rule.xml @@ -16,6 +16,10 @@ android:id="@+id/menu_group_manage" android:title="@string/group_manage" /> + +