From a41cd5e92fa5c6b452424623156caa4b2b53e1a8 Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Sun, 11 Dec 2022 20:42:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/data/dao/ReplaceRuleDao.kt | 3 +++ .../java/io/legado/app/ui/replace/ReplaceRuleActivity.kt | 6 ++++++ app/src/main/res/menu/replace_rule.xml | 4 ++++ 3 files changed, 13 insertions(+) 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" /> + +