Merge pull request #1574 from Xwite/master

校验设置可在校验书源时更改;更新SelectActionBar.kt
This commit is contained in:
kunfei
2022-02-01 23:05:33 +08:00
committed by GitHub
12 changed files with 15 additions and 18 deletions
@@ -80,6 +80,7 @@ data class BookChapter(
chineseConvert: Boolean = true,
): String {
var displayTitle = title.replace(AppPattern.rnRegex, "")
val mDisplayTitle = displayTitle
if (useReplace && replaceRules != null) {
replaceRules.forEach { item ->
if (item.pattern.isNotEmpty()) {
@@ -95,6 +96,7 @@ data class BookChapter(
}
}
}
if (displayTitle.isBlank()) displayTitle = mDisplayTitle
if (chineseConvert) {
when (AppConfig.chineseConverterType) {
1 -> displayTitle = ChineseUtils.t2s(displayTitle)
@@ -77,10 +77,6 @@ class ContentProcessor private constructor(
//重新分段
mContent = ContentHelp.reSegment(mContent, chapter.title)
}
if (includeTitle) {
//重新添加标题
mContent = chapter.getDisplayTitle() + "\n" + mContent
}
if (useReplace && book.getUseReplaceRule()) {
//替换
mContent = replaceContent(mContent)
@@ -96,6 +92,10 @@ class ContentProcessor private constructor(
appCtx.toastOnUi("简繁转换出错")
}
}
if (includeTitle) {
//重新添加标题
mContent = chapter.getDisplayTitle(getReplaceRules()) + "\n" + mContent
}
val contents = arrayListOf<String>()
mContent.split("\n").forEach { str ->
val paragraph = str.trim {
@@ -131,4 +131,4 @@ class ContentProcessor private constructor(
return mContent
}
}
}
@@ -6,7 +6,6 @@ import io.legado.app.constant.IntentAction
import io.legado.app.data.entities.BookSource
import io.legado.app.service.CheckSourceService
import io.legado.app.utils.startService
import io.legado.app.utils.toastOnUi
import io.legado.app.help.CacheManager
import splitties.init.appCtx
@@ -26,10 +25,6 @@ object CheckSource {
}
fun start(context: Context, sources: List<BookSource>) {
if (sources.isEmpty()) {
context.toastOnUi(R.string.non_select)
return
}
val selectedIds: ArrayList<String> = arrayListOf()
sources.map {
selectedIds.add(it.bookSourceUrl)
@@ -27,6 +27,7 @@ import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.model.CheckSource
import io.legado.app.model.Debug
import io.legado.app.ui.association.ImportBookSourceDialog
import io.legado.app.ui.config.CheckSourceConfig
import io.legado.app.ui.book.local.rule.TxtTocRuleActivity
import io.legado.app.ui.book.source.debug.BookSourceDebugActivity
import io.legado.app.ui.book.source.edit.BookSourceEditActivity
@@ -361,7 +362,11 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
CheckSource.start(this@BookSourceActivity, adapter.selection)
checkMessageRefreshJob().start()
}
noButton()
neutralButton(R.string.check_source_config) {
checkSource()
showDialogFragment<CheckSourceConfig>()
}
cancelButton()
}
}
@@ -100,6 +100,8 @@ class SelectActionBar @JvmOverloads constructor(
btnRevertSelection.isClickable = isClickable
btnSelectActionMain.isEnabled = isClickable
btnSelectActionMain.isClickable = isClickable
ivMenuMore.isEnabled = isClickable
ivMenuMore.isClickable = isClickable
}
interface CallBack {