|
|
@ -51,7 +51,8 @@ object ChapterProvider { |
|
|
|
book: Book, |
|
|
|
book: Book, |
|
|
|
bookChapter: BookChapter, |
|
|
|
bookChapter: BookChapter, |
|
|
|
contents: List<String>, |
|
|
|
contents: List<String>, |
|
|
|
chapterSize: Int |
|
|
|
chapterSize: Int, |
|
|
|
|
|
|
|
imageStyle: String? |
|
|
|
): TextChapter { |
|
|
|
): TextChapter { |
|
|
|
val textPages = arrayListOf<TextPage>() |
|
|
|
val textPages = arrayListOf<TextPage>() |
|
|
|
val pageLines = arrayListOf<Int>() |
|
|
|
val pageLines = arrayListOf<Int>() |
|
|
@ -69,7 +70,7 @@ object ChapterProvider { |
|
|
|
src?.let { |
|
|
|
src?.let { |
|
|
|
durY = |
|
|
|
durY = |
|
|
|
setTypeImage( |
|
|
|
setTypeImage( |
|
|
|
book, bookChapter, src, durY, textPages |
|
|
|
book, bookChapter, src, durY, textPages, imageStyle |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -116,26 +117,33 @@ object ChapterProvider { |
|
|
|
chapter: BookChapter, |
|
|
|
chapter: BookChapter, |
|
|
|
src: String, |
|
|
|
src: String, |
|
|
|
y: Float, |
|
|
|
y: Float, |
|
|
|
textPages: ArrayList<TextPage> |
|
|
|
textPages: ArrayList<TextPage>, |
|
|
|
|
|
|
|
imageStyle: String? |
|
|
|
): Float { |
|
|
|
): Float { |
|
|
|
var durY = y |
|
|
|
var durY = y |
|
|
|
ImageProvider.getImage(book, chapter.index, src)?.let { |
|
|
|
ImageProvider.getImage(book, chapter.index, src)?.let { |
|
|
|
var height = it.height |
|
|
|
var height = it.height |
|
|
|
var width = it.width |
|
|
|
var width = it.width |
|
|
|
|
|
|
|
when (imageStyle?.toUpperCase()) { |
|
|
|
|
|
|
|
"FULL" -> { |
|
|
|
|
|
|
|
width = visibleWidth |
|
|
|
|
|
|
|
height = it.width / width * it.height |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else -> { |
|
|
|
if (it.width > visibleWidth) { |
|
|
|
if (it.width > visibleWidth) { |
|
|
|
height = it.height * visibleWidth / it.width |
|
|
|
height = it.height * visibleWidth / it.width |
|
|
|
width = |
|
|
|
width = visibleWidth |
|
|
|
visibleWidth |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (height > visibleHeight) { |
|
|
|
if (height > visibleHeight) { |
|
|
|
width = width * visibleHeight / height |
|
|
|
width = width * visibleHeight / height |
|
|
|
height = |
|
|
|
height = visibleHeight |
|
|
|
visibleHeight |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (durY + height > visibleHeight) { |
|
|
|
if (durY + height > visibleHeight) { |
|
|
|
textPages.add(TextPage()) |
|
|
|
textPages.add(TextPage()) |
|
|
|
durY = 0f |
|
|
|
durY = 0f |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
val textLine = TextLine(isImage = true) |
|
|
|
val textLine = TextLine(isImage = true) |
|
|
|
textLine.lineTop = durY |
|
|
|
textLine.lineTop = durY |
|
|
|
durY += height |
|
|
|
durY += height |
|
|
|