替换规则添加排除字段

This commit is contained in:
kunfei
2023-05-10 22:26:30 +08:00
parent 95a07cf6ef
commit 474a3ed15c
10 changed files with 24 additions and 0 deletions
@@ -51,6 +51,7 @@ interface ReplaceRuleDao {
@Query(
"""SELECT * FROM replace_rules WHERE isEnabled = 1 and scopeContent = 1
AND (scope LIKE '%' || :name || '%' or scope LIKE '%' || :origin || '%' or scope is null or scope = '')
and (excludeScope is null or (excludeScope not LIKE '%' || :name || '%' and excludeScope not LIKE '%' || :origin || '%'))
order by sortOrder"""
)
fun findEnabledByContentScope(name: String, origin: String): List<ReplaceRule>
@@ -58,6 +59,7 @@ interface ReplaceRuleDao {
@Query(
"""SELECT * FROM replace_rules WHERE isEnabled = 1 and scopeTitle = 1
AND (scope LIKE '%' || :name || '%' or scope LIKE '%' || :origin || '%' or scope is null or scope = '')
and (excludeScope is null or (excludeScope not LIKE '%' || :name || '%' and excludeScope not LIKE '%' || :origin || '%'))
order by sortOrder"""
)
fun findEnabledByTitleScope(name: String, origin: String): List<ReplaceRule>
@@ -95,6 +95,7 @@ class ReplaceEditActivity :
cbScopeTitle.isChecked = replaceRule.scopeTitle
cbScopeContent.isChecked = replaceRule.scopeContent
etScope.setText(replaceRule.scope)
etExcludeScope.setText(replaceRule.excludeScope)
etTimeout.setText(replaceRule.timeoutMillisecond.toString())
}
@@ -108,6 +109,7 @@ class ReplaceEditActivity :
replaceRule.scopeTitle = cbScopeTitle.isChecked
replaceRule.scopeContent = cbScopeContent.isChecked
replaceRule.scope = etScope.text.toString()
replaceRule.excludeScope = etExcludeScope.text.toString()
replaceRule.timeoutMillisecond = etTimeout.text.toString().ifEmpty { "3000" }.toLong()
return replaceRule
}
@@ -139,6 +139,19 @@
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
</io.legado.app.ui.widget.text.TextInputLayout>
<io.legado.app.ui.widget.text.TextInputLayout
android:id="@+id/til_exclude_scope"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/exclude_scope">
<io.legado.app.lib.theme.view.ThemeEditText
android:id="@+id/et_exclude_scope"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
</io.legado.app.ui.widget.text.TextInputLayout>
<io.legado.app.ui.widget.text.TextInputLayout
android:id="@+id/til_timeout"
android:layout_width="match_parent"
@@ -1101,4 +1101,5 @@
<string name="only_latest_backup_s">本地备份仅保留最新备份文件</string>
<string name="webdav_application_authorization_error">Fail to authorize WebDav application</string>
<string name="load_word_count">Cargar palabras del libro</string>
<string name="exclude_scope">排除范围</string>
</resources>
@@ -1104,4 +1104,5 @@
<string name="only_latest_backup_s">本地备份仅保留最新备份文件</string>
<string name="webdav_application_authorization_error">Fail to authorize WebDav application</string>
<string name="load_word_count">Load word count</string>
<string name="exclude_scope">排除范围</string>
</resources>
@@ -1104,4 +1104,5 @@
<string name="only_latest_backup_s">本地备份仅保留最新备份文件</string>
<string name="webdav_application_authorization_error">Fail to authorize WebDav application</string>
<string name="load_word_count">Carregar os palavras do livro</string>
<string name="exclude_scope">排除范围</string>
</resources>
@@ -1101,4 +1101,5 @@
<string name="only_latest_backup_s">本地备份仅保留最新备份文件</string>
<string name="webdav_application_authorization_error">webDav应用验证失败</string>
<string name="load_word_count">加載字數</string>
<string name="exclude_scope">排除范围</string>
</resources>
@@ -1103,4 +1103,5 @@
<string name="only_latest_backup_s">本地备份仅保留最新备份文件</string>
<string name="webdav_application_authorization_error">webDav应用验证失败</string>
<string name="load_word_count">加載字數</string>
<string name="exclude_scope">排除范围</string>
</resources>
+1
View File
@@ -1103,4 +1103,5 @@
<string name="only_latest_backup_s">本地备份仅保留最新备份文件</string>
<string name="webdav_application_authorization_error">webDav应用验证失败</string>
<string name="load_word_count">加载字数</string>
<string name="exclude_scope">排除范围</string>
</resources>
+1
View File
@@ -1104,4 +1104,5 @@
<string name="webdav_application_authorization_error">Fail to authorize WebDav application</string>
<string name="respondTime">respondTime: %1$d ms</string>
<string name="load_word_count">Load word count</string>
<string name="exclude_scope">排除范围</string>
</resources>