阅读界面的TXT目录正则 弹框中也支持正则标题示例

This commit is contained in:
fisher
2022-08-17 18:38:19 +08:00
parent 4a251f93b7
commit 58fa446e1f
2 changed files with 53 additions and 39 deletions
@@ -169,12 +169,14 @@ class TocRegexDialog() : BaseDialogFragment(R.layout.dialog_toc_regex),
alertBinding.apply {
tvRuleName.setText(tocRule.name)
tvRuleRegex.setText(tocRule.rule)
tvRuleExample.setText(tocRule.example)
}
customView { alertBinding.root }
okButton {
alertBinding.apply {
tocRule.name = tvRuleName.text.toString()
tocRule.rule = tvRuleRegex.text.toString()
tocRule.example = tvRuleExample.text.toString()
viewModel.saveRule(tocRule)
}
}
@@ -200,6 +202,7 @@ class TocRegexDialog() : BaseDialogFragment(R.layout.dialog_toc_regex),
if (payloads.isEmpty()) {
root.setBackgroundColor(context.backgroundColor)
rbRegexName.text = item.name
titleExample.text = item.example
rbRegexName.isChecked = item.name == selectedName
swtEnabled.isChecked = item.enable
} else {
+13 -2
View File
@@ -3,10 +3,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
<io.legado.app.lib.theme.view.ThemeRadioButton
android:id="@+id/rb_regex_name"
android:layout_width="0dp"
@@ -43,5 +47,12 @@
android:src="@drawable/ic_clear_all"
android:tint="@color/primaryText"
tools:ignore="UnusedAttribute" />
</LinearLayout>
<TextView
android:id="@+id/title_example"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp" />
</LinearLayout>