From afc99e13d373994e9c3fc290b4a10cad3cdc9681 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 1 Mar 2020 17:41:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/replacerule/edit/ReplaceEditDialog.kt | 8 +++++++- .../app/ui/replacerule/edit/ReplaceEditViewModel.kt | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditDialog.kt b/app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditDialog.kt index 71026502e..f4226a64e 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditDialog.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditDialog.kt @@ -23,11 +23,17 @@ class ReplaceEditDialog : DialogFragment(), companion object { - fun show(fragmentManager: FragmentManager, id: Long = -1, pattern: String? = null) { + fun show( + fragmentManager: FragmentManager, + id: Long = -1, + pattern: String? = null, + isRegex: Boolean = false + ) { val dialog = ReplaceEditDialog() val bundle = Bundle() bundle.putLong("id", id) bundle.putString("pattern", pattern) + bundle.putBoolean("isRegex", isRegex) dialog.arguments = bundle dialog.show(fragmentManager, "editReplace") } diff --git a/app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditViewModel.kt b/app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditViewModel.kt index f326c88c3..722deb738 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditViewModel.kt @@ -21,8 +21,9 @@ class ReplaceEditViewModel(application: Application) : BaseViewModel(application } } else { bundle.getString("pattern")?.let { pattern -> + val isRegex = bundle.getBoolean("isRegex") replaceRuleData.postValue( - ReplaceRule(pattern = pattern) + ReplaceRule(pattern = pattern, isRegex = isRegex) ) } }