优化
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user