pull/1606/head
kunfei 3 years ago
parent 7169c62369
commit b813947d50
  1. 2
      app/src/main/java/io/legado/app/data/entities/BookChapter.kt
  2. 16
      app/src/main/java/io/legado/app/help/ContentProcessor.kt

@ -74,7 +74,7 @@ data class BookChapter(
@Suppress("unused")
fun getDisplayTitle(
replaceRules: Array<ReplaceRule>? = null,
replaceRules: List<ReplaceRule>? = null,
useReplace: Boolean = true,
chineseConvert: Boolean = true,
): String {

@ -9,6 +9,7 @@ import io.legado.app.data.entities.ReplaceRule
import io.legado.app.utils.toastOnUi
import splitties.init.appCtx
import java.lang.ref.WeakReference
import java.util.concurrent.CopyOnWriteArrayList
import java.util.regex.Pattern
class ContentProcessor private constructor(
@ -37,14 +38,13 @@ class ContentProcessor private constructor(
}
private val titleReplaceRules = arrayListOf<ReplaceRule>()
private val contentReplaceRules = arrayListOf<ReplaceRule>()
private val titleReplaceRules = CopyOnWriteArrayList<ReplaceRule>()
private val contentReplaceRules = CopyOnWriteArrayList<ReplaceRule>()
init {
upReplaceRules()
}
@Synchronized
fun upReplaceRules() {
titleReplaceRules.run {
clear()
@ -56,14 +56,12 @@ class ContentProcessor private constructor(
}
}
@Synchronized
fun getTitleReplaceRules(): Array<ReplaceRule> {
return titleReplaceRules.toTypedArray()
fun getTitleReplaceRules(): List<ReplaceRule> {
return titleReplaceRules
}
@Synchronized
fun getContentReplaceRules(): Array<ReplaceRule> {
return contentReplaceRules.toTypedArray()
fun getContentReplaceRules(): List<ReplaceRule> {
return contentReplaceRules
}
fun getContent(

Loading…
Cancel
Save