Просмотр исходного кода

替换规则添加作用于标题和作用于正文

kunfei 4 лет назад
Родитель
Сommit
a02c7b9859

+ 4 - 0
app/src/main/java/io/legado/app/ui/replace/edit/ReplaceEditActivity.kt

@@ -97,6 +97,8 @@ class ReplaceEditActivity :
         etReplaceRule.setText(replaceRule.pattern)
         cbUseRegex.isChecked = replaceRule.isRegex
         etReplaceTo.setText(replaceRule.replacement)
+        cbScopeTitle.isChecked = replaceRule.scopeTitle
+        cbScopeContent.isChecked = replaceRule.scopeContent
         etScope.setText(replaceRule.scope)
     }
 
@@ -107,6 +109,8 @@ class ReplaceEditActivity :
         replaceRule.pattern = etReplaceRule.text.toString()
         replaceRule.isRegex = cbUseRegex.isChecked
         replaceRule.replacement = etReplaceTo.text.toString()
+        replaceRule.scopeTitle = cbScopeTitle.isChecked
+        replaceRule.scopeContent = cbScopeTitle.isChecked
         replaceRule.scope = etScope.text.toString()
         return replaceRule
     }

+ 22 - 0
app/src/main/res/layout/activity_replace_edit.xml

@@ -103,6 +103,28 @@
                     tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
             </io.legado.app.ui.widget.text.TextInputLayout>
 
+            <androidx.appcompat.widget.LinearLayoutCompat
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+                <io.legado.app.lib.theme.view.ThemeCheckBox
+                    android:id="@+id/cb_scope_title"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/scope_title"
+                    android:checked="false" />
+
+                <io.legado.app.lib.theme.view.ThemeCheckBox
+                    android:id="@+id/cb_scope_content"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="10dp"
+                    android:text="@string/scope_content"
+                    android:checked="true"
+                    tools:ignore="RtlHardcoded" />
+
+            </androidx.appcompat.widget.LinearLayoutCompat>
+
             <io.legado.app.ui.widget.text.TextInputLayout
                 android:id="@+id/til_scope"
                 android:layout_width="match_parent"

+ 2 - 0
app/src/main/res/values-es-rES/strings.xml

@@ -930,5 +930,7 @@
     <string name="sub_dir">子文件夹</string>
     <string name="general">全局</string>
     <string name="use_replace">使用替换</string>
+    <string name="scope_title">作用于标题</string>
+    <string name="scope_content">作用于正文</string>
     <!-- string end -->
 </resources>

+ 2 - 0
app/src/main/res/values-ja-rJP/strings.xml

@@ -933,5 +933,7 @@
     <string name="sub_dir">子文件夹</string>
     <string name="general">全局</string>
     <string name="use_replace">使用替换</string>
+    <string name="scope_title">作用于标题</string>
+    <string name="scope_content">作用于正文</string>
     <!-- string end -->
 </resources>

+ 2 - 0
app/src/main/res/values-pt-rBR/strings.xml

@@ -933,5 +933,7 @@
     <string name="sub_dir">子文件夹</string>
     <string name="general">全局</string>
     <string name="use_replace">使用替换</string>
+    <string name="scope_title">作用于标题</string>
+    <string name="scope_content">作用于正文</string>
     <!-- string end -->
 </resources>

+ 2 - 0
app/src/main/res/values-zh-rHK/strings.xml

@@ -930,5 +930,7 @@
     <string name="sub_dir">子文件夹</string>
     <string name="general">全局</string>
     <string name="use_replace">使用替换</string>
+    <string name="scope_title">作用于标题</string>
+    <string name="scope_content">作用于正文</string>
     <!-- string end -->
 </resources>

+ 2 - 0
app/src/main/res/values-zh-rTW/strings.xml

@@ -932,5 +932,7 @@
     <string name="sub_dir">子文件夹</string>
     <string name="general">全局</string>
     <string name="use_replace">使用替换</string>
+    <string name="scope_title">作用于标题</string>
+    <string name="scope_content">作用于正文</string>
     <!-- string end -->
 </resources>

+ 2 - 0
app/src/main/res/values-zh/strings.xml

@@ -932,5 +932,7 @@
     <string name="sub_dir">子文件夹</string>
     <string name="general">全局</string>
     <string name="use_replace">使用替换</string>
+    <string name="scope_title">作用于标题</string>
+    <string name="scope_content">作用于正文</string>
     <!-- string end -->
 </resources>

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -933,5 +933,7 @@
     <string name="sub_dir">Sub dir</string>
     <string name="general">General</string>
     <string name="use_replace">Use replace</string>
+    <string name="scope_title">作用于标题</string>
+    <string name="scope_content">作用于正文</string>
     <!-- string end -->
 </resources>