替换不再阻塞

pull/1295/head
gedoor 3 years ago
parent 1b3dfd6c9f
commit 21a3fb70f9
  1. 8
      app/src/main/java/io/legado/app/help/ContentProcessor.kt

@ -34,7 +34,7 @@ class ContentProcessor private constructor(
} }
private var replaceRules = arrayListOf<ReplaceRule>() private val replaceRules = arrayListOf<ReplaceRule>()
init { init {
upReplaceRules() upReplaceRules()
@ -47,6 +47,10 @@ class ContentProcessor private constructor(
} }
@Synchronized @Synchronized
fun getReplaceRules(): Array<ReplaceRule> {
return replaceRules.toTypedArray()
}
fun getContent( fun getContent(
book: Book, book: Book,
title: String, //已经经过简繁转换 title: String, //已经经过简繁转换
@ -56,7 +60,7 @@ class ContentProcessor private constructor(
): List<String> { ): List<String> {
var content1 = content var content1 = content
if (useReplace) { if (useReplace) {
replaceRules.forEach { item -> getReplaceRules().forEach { item ->
if (item.pattern.isNotEmpty()) { if (item.pattern.isNotEmpty()) {
try { try {
content1 = if (item.isRegex) { content1 = if (item.isRegex) {

Loading…
Cancel
Save