From 900318da6d82b4d5218d58a27d18983dca3e11f8 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 27 Aug 2019 22:51:29 +0800 Subject: [PATCH] up --- .../app/ui/widget/page/ChapterProvider.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/page/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/widget/page/ChapterProvider.kt index c69462355..84d987037 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/ChapterProvider.kt @@ -24,14 +24,15 @@ object ChapterProvider { while (surplusText.isNotEmpty()) { val spannableStringBuilder = SpannableStringBuilder(surplusText) if (pageIndex == 0) { - var end = surplusText.indexOf("\n") - if (end == -1) end = surplusText.length - spannableStringBuilder.setSpan( - titleSpan, - 0, - end, - Spannable.SPAN_INCLUSIVE_EXCLUSIVE - ) + val end = surplusText.indexOf("\n") + if (end > 0) { + spannableStringBuilder.setSpan( + titleSpan, + 0, + end, + Spannable.SPAN_INCLUSIVE_EXCLUSIVE + ) + } } textView.text = spannableStringBuilder pageLengths.add(textView.getCharNum())