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,
id: Long = -1,
pattern: String? = null,
isRegex: Boolean = false
isRegex: Boolean = false,
scope: String? = null
) {
val dialog = ReplaceEditDialog()
val bundle = Bundle()
bundle.putLong("id", id)
bundle.putString("pattern", pattern)
bundle.putBoolean("isRegex", isRegex)
bundle.putString("scope", scope)
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)
}
} else {
bundle.getString("pattern")?.let { pattern ->
val isRegex = bundle.getBoolean("isRegex")
replaceRuleData.postValue(
ReplaceRule(name = pattern, pattern = pattern, isRegex = isRegex)
)
}
val pattern = bundle.getString("pattern") ?: ""
val isRegex = bundle.getBoolean("isRegex")
val scope = bundle.getString("scope")
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.
buildscript {
ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.4.0'
repositories {
google()
jcenter()

Loading…
Cancel
Save