Merge pull request #1603 from Xwite/test

优化
pull/1604/head
kunfei 3 years ago committed by GitHub
commit edf38653f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt
  2. 4
      app/src/main/java/io/legado/app/ui/config/CheckSourceConfig.kt
  3. 1
      app/src/main/res/layout/dialog_check_source_config.xml

@ -114,6 +114,10 @@ object ChapterProvider {
var durY = 0f
textPages.add(TextPage())
contents.forEachIndexed { index, content ->
val isTitle = index == 0
val isTitleWithNoContent = isTitle && contents.size == 1
val isVolumeTitle = isTitle && bookChapter.isVolume
val textPaint = if (isTitle) titlePaint else contentPaint
if (book.getImageStyle() == Book.imgStyleText) {
var text = content.replace(srcReplaceChar, "")
val srcList = LinkedList<String>()
@ -128,10 +132,6 @@ object ChapterProvider {
}
matcher.appendTail(sb)
text = sb.toString()
val isTitle = index == 0
val isTitleWithNoContent = isTitle && contents.size == 1
val isVolumeTitle = isTitle && bookChapter.isVolume
val textPaint = if (isTitle) titlePaint else contentPaint
if (!(isTitle && ReadBookConfig.titleMode == 2)) {
setTypeText(
absStartX, durY, text, textPages, stringBuilder,
@ -147,10 +147,6 @@ object ChapterProvider {
while (matcher.find()) {
val text = content.substring(start, matcher.start())
if (text.isNotBlank()) {
val isTitle = index == 0
val isTitleWithNoContent = isTitle && contents.size == 1
val isVolumeTitle = isTitle && bookChapter.isVolume
val textPaint = if (isTitle) titlePaint else contentPaint
if (!(isTitle && ReadBookConfig.titleMode == 2)) {
setTypeText(
absStartX, durY, text, textPages, stringBuilder,
@ -170,10 +166,6 @@ object ChapterProvider {
if (start < content.length) {
val text = content.substring(start, content.length)
if (text.isNotBlank()) {
val isTitle = index == 0
val isTitleWithNoContent = isTitle && contents.size == 1
val isVolumeTitle = isTitle && bookChapter.isVolume
val textPaint = if (isTitle) titlePaint else contentPaint
if (!(isTitle && ReadBookConfig.titleMode == 2)) {
setTypeText(
absStartX, durY, text, textPages, stringBuilder,

@ -19,7 +19,7 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config
private val binding by viewBinding(DialogCheckSourceConfigBinding::bind)
//允许的最小超时时间,秒
private val minTimeout = 60L
private val minTimeout = 0L
override fun onStart() {
super.onStart()
@ -80,7 +80,7 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config
toastOnUi("${getString(R.string.timeout)}${getString(R.string.cannot_empty)}")
return@onClick
}
text.toLong() < minTimeout -> {
text.toLong() <= minTimeout -> {
toastOnUi(
"${getString(R.string.timeout)}${getString(R.string.less_than)}${minTimeout}${
getString(

@ -27,6 +27,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/check_source_timeout"
android:digits="1234567890"
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
</io.legado.app.ui.widget.text.TextInputLayout>

Loading…
Cancel
Save