pull/323/head
gedoor 4 years ago
parent 94a0701bcd
commit 900aef347f
  1. 6
      app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditDialog.kt
  2. 16
      app/src/main/java/io/legado/app/ui/replacerule/edit/ReplaceEditViewModel.kt
  3. 2
      build.gradle

@ -35,15 +35,17 @@ class ReplaceEditDialog : BaseDialogFragment(),
fragmentManager: FragmentManager, fragmentManager: FragmentManager,
id: Long = -1, id: Long = -1,
pattern: String? = null, pattern: String? = null,
isRegex: Boolean = false isRegex: Boolean = false,
scope: String? = null
) { ) {
val dialog = ReplaceEditDialog() val dialog = ReplaceEditDialog()
val bundle = Bundle() val bundle = Bundle()
bundle.putLong("id", id) bundle.putLong("id", id)
bundle.putString("pattern", pattern) bundle.putString("pattern", pattern)
bundle.putBoolean("isRegex", isRegex) bundle.putBoolean("isRegex", isRegex)
bundle.putString("scope", scope)
dialog.arguments = bundle dialog.arguments = bundle
dialog.show(fragmentManager, "editReplace") dialog.show(fragmentManager, this::class.simpleName)
} }
} }

@ -20,12 +20,16 @@ class ReplaceEditViewModel(application: Application) : BaseViewModel(application
replaceRuleData.postValue(it) replaceRuleData.postValue(it)
} }
} else { } else {
bundle.getString("pattern")?.let { pattern -> val pattern = bundle.getString("pattern") ?: ""
val isRegex = bundle.getBoolean("isRegex") val isRegex = bundle.getBoolean("isRegex")
replaceRuleData.postValue( val scope = bundle.getString("scope")
ReplaceRule(name = pattern, pattern = pattern, isRegex = isRegex) val rule = ReplaceRule(
) name = pattern,
} pattern = pattern,
isRegex = isRegex,
scope = scope
)
replaceRuleData.postValue(rule)
} }
} }
} }

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.3.72' ext.kotlin_version = '1.4.0'
repositories { repositories {
google() google()
jcenter() jcenter()

Loading…
Cancel
Save