diff --git a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt index cb946d145..e1e3f8620 100644 --- a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt @@ -23,7 +23,7 @@ import io.legado.app.help.MediaHelp import io.legado.app.receiver.MediaButtonReceiver import io.legado.app.service.help.ReadBook import io.legado.app.ui.book.read.ReadBookActivity -import io.legado.app.ui.book.read.page.TextChapter +import io.legado.app.ui.book.read.page.entities.TextChapter import io.legado.app.utils.getPrefBoolean import io.legado.app.utils.postEvent diff --git a/app/src/main/java/io/legado/app/service/help/ReadBook.kt b/app/src/main/java/io/legado/app/service/help/ReadBook.kt index 1f62d785a..4548c102b 100644 --- a/app/src/main/java/io/legado/app/service/help/ReadBook.kt +++ b/app/src/main/java/io/legado/app/service/help/ReadBook.kt @@ -12,7 +12,7 @@ import io.legado.app.help.coroutine.Coroutine import io.legado.app.model.WebBook import io.legado.app.service.BaseReadAloudService import io.legado.app.ui.book.read.page.ChapterProvider -import io.legado.app.ui.book.read.page.TextChapter +import io.legado.app.ui.book.read.page.entities.TextChapter import kotlinx.coroutines.* import kotlinx.coroutines.Dispatchers.Main diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt index 63cc6748d..cdc79aa7d 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt @@ -9,6 +9,8 @@ import androidx.core.text.HtmlCompat.FROM_HTML_MODE_COMPACT import io.legado.app.App import io.legado.app.data.entities.BookChapter import io.legado.app.lib.theme.accentColor +import io.legado.app.ui.book.read.page.entities.TextChapter +import io.legado.app.ui.book.read.page.entities.TextPage object ChapterProvider { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt index 480e8ecdc..14594d4e9 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt @@ -11,6 +11,7 @@ import io.legado.app.R import io.legado.app.constant.AppConst.TIME_FORMAT import io.legado.app.constant.PreferKey import io.legado.app.help.ReadBookConfig +import io.legado.app.ui.book.read.page.entities.TextPage import io.legado.app.utils.* import kotlinx.android.synthetic.main.view_book_page.view.* import org.jetbrains.anko.sdk27.listeners.onScrollChange diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/DataSource.kt b/app/src/main/java/io/legado/app/ui/book/read/page/DataSource.kt index 7c93e52c2..ed223a4cf 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/DataSource.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/DataSource.kt @@ -1,5 +1,7 @@ package io.legado.app.ui.book.read.page +import io.legado.app.ui.book.read.page.entities.TextChapter + interface DataSource { val isScrollDelegate: Boolean diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt index 777ef0733..315c8ddbd 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt @@ -10,6 +10,7 @@ import io.legado.app.constant.PreferKey import io.legado.app.help.ReadBookConfig import io.legado.app.service.help.ReadBook import io.legado.app.ui.book.read.page.delegate.* +import io.legado.app.ui.book.read.page.entities.TextChapter import io.legado.app.utils.activity import io.legado.app.utils.getPrefInt diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/TextPageFactory.kt b/app/src/main/java/io/legado/app/ui/book/read/page/TextPageFactory.kt index 8423d04ab..03a222b94 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/TextPageFactory.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/TextPageFactory.kt @@ -1,6 +1,7 @@ package io.legado.app.ui.book.read.page import io.legado.app.service.help.ReadBook +import io.legado.app.ui.book.read.page.entities.TextPage class TextPageFactory(dataSource: DataSource) : PageFactory(dataSource) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/TextChapter.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChapter.kt similarity index 98% rename from app/src/main/java/io/legado/app/ui/book/read/page/TextChapter.kt rename to app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChapter.kt index 8eebb8908..2acf5cb94 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/TextChapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChapter.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.book.read.page +package io.legado.app.ui.book.read.page.entities import android.text.SpannableStringBuilder import kotlin.math.min diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChar.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChar.kt new file mode 100644 index 000000000..54f8729c7 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextChar.kt @@ -0,0 +1,11 @@ +package io.legado.app.ui.book.read.page.entities + +import android.graphics.Point + +data class TextChar( + val charData: Char, + var selected: Boolean = false, + var isReadAloud: Boolean = false, + val leftBottomPosition: Point, + val rightTopPosition: Point +) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt new file mode 100644 index 000000000..81c8fe089 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextLine.kt @@ -0,0 +1,6 @@ +package io.legado.app.ui.book.read.page.entities + +data class TextLine( + val textChars: List, + val lineBottom: Int +) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/TextPage.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt similarity index 91% rename from app/src/main/java/io/legado/app/ui/book/read/page/TextPage.kt rename to app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt index 4950bf68a..9a77e26c5 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/TextPage.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt @@ -1,9 +1,10 @@ -package io.legado.app.ui.book.read.page +package io.legado.app.ui.book.read.page.entities import android.text.Spannable import android.text.SpannableStringBuilder import io.legado.app.App import io.legado.app.R +import io.legado.app.ui.book.read.page.ChapterProvider data class TextPage( val index: Int,