pull/2628/head
Horis 2 years ago
parent e6baa8ac54
commit a41cd5e92f
  1. 3
      app/src/main/java/io/legado/app/data/dao/ReplaceRuleDao.kt
  2. 6
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
  3. 4
      app/src/main/res/menu/replace_rule.xml

@ -24,6 +24,9 @@ interface ReplaceRuleDao {
@Query("select `group` from replace_rules where `group` is not null and `group` <> ''") @Query("select `group` from replace_rules where `group` is not null and `group` <> ''")
fun flowGroupsUnProcessed(): Flow<List<String>> 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") @get:Query("SELECT MIN(sortOrder) FROM replace_rules")
val minOrder: Int val minOrder: Int

@ -182,6 +182,9 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
searchKey.isNullOrEmpty() -> { searchKey.isNullOrEmpty() -> {
appDb.replaceRuleDao.flowAll() appDb.replaceRuleDao.flowAll()
} }
searchKey == getString(R.string.no_group) -> {
appDb.replaceRuleDao.flowNoGroup()
}
searchKey.startsWith("group:") -> { searchKey.startsWith("group:") -> {
val key = searchKey.substringAfter("group:") val key = searchKey.substringAfter("group:")
appDb.replaceRuleDao.flowGroupSearch("%$key%") appDb.replaceRuleDao.flowGroupSearch("%$key%")
@ -225,6 +228,9 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
} }
R.id.menu_import_qr -> qrCodeResult.launch() R.id.menu_import_qr -> qrCodeResult.launch()
R.id.menu_help -> showHelp() 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) { else -> if (item.groupId == R.id.replace_group) {
searchView.setQuery("group:${item.title}", true) searchView.setQuery("group:${item.title}", true)
} }

@ -16,6 +16,10 @@
android:id="@+id/menu_group_manage" android:id="@+id/menu_group_manage"
android:title="@string/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 android:id="@+id/replace_group">
</group> </group>

Loading…
Cancel
Save