pull/1592/head
kunfei 3 years ago
parent f744e19f36
commit 7095198d63
  1. 7
      app/src/main/java/io/legado/app/data/entities/BookChapter.kt

@ -80,7 +80,6 @@ data class BookChapter(
chineseConvert: Boolean = true,
): String {
var displayTitle = title.replace(AppPattern.rnRegex, "")
val mDisplayTitle = displayTitle
if (chineseConvert) {
when (AppConfig.chineseConverterType) {
1 -> displayTitle = ChineseUtils.t2s(displayTitle)
@ -91,18 +90,20 @@ data class BookChapter(
replaceRules.forEach { item ->
if (item.pattern.isNotEmpty()) {
try {
displayTitle = if (item.isRegex) {
val mDisplayTitle = if (item.isRegex) {
displayTitle.replace(item.pattern.toRegex(), item.replacement)
} else {
displayTitle.replace(item.pattern, item.replacement)
}
if (mDisplayTitle.isNotBlank()) {
displayTitle = mDisplayTitle
}
} catch (e: Exception) {
appCtx.toastOnUi("${item.name}替换出错")
}
}
}
}
if (displayTitle.isBlank()) displayTitle = mDisplayTitle
return when {
!isVip -> displayTitle
isPay -> appCtx.getString(R.string.payed_title, displayTitle)

Loading…
Cancel
Save