diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt index ab6e1b036..d817b5357 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt @@ -237,7 +237,7 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea override fun loadContentFinish(bookChapter: BookChapter, content: String) { launch { - val textChapter = ChapterProvider().getTextChapter(content_text_view, bookChapter, content) + val textChapter = ChapterProvider.getTextChapter(content_text_view, bookChapter, content) content_text_view.text = textChapter.pages[0].text } } 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 3832a42c6..c80c4bd2b 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 @@ -3,9 +3,9 @@ package io.legado.app.ui.widget.page import io.legado.app.data.entities.BookChapter -class ChapterProvider { - +object ChapterProvider { + @Synchronized fun getTextChapter(textView: ContentTextView, bookChapter: BookChapter, content: String): TextChapter { val textPages = arrayListOf() var surplusText = content