横屏双页完

pull/1352/head
gedoor 3 years ago
parent 88f757c21c
commit 73a14a6d0a
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  2. 17
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt

@ -141,7 +141,7 @@ class ReadMenu @JvmOverloads constructor(
callBack.openSourceEditActivity()
}
tvChapterUrl.setOnClickListener {
context.openUrl(binding.tvChapterUrl.text.toString())
context.sendToClip(binding.tvChapterUrl.text.toString())
}
//登录
tvLogin.setOnClickListener {

@ -26,6 +26,8 @@ import java.util.*
*/
@Suppress("DEPRECATION")
object ChapterProvider {
private const val srcReplaceChar = ""
@JvmStatic
private var viewWidth = 0
@ -71,7 +73,8 @@ object ChapterProvider {
@JvmStatic
val contentPaint: TextPaint = TextPaint()
private const val srcReplaceChar = ""
var isHorizontal = false
init {
upStyle()
@ -163,7 +166,7 @@ object ChapterProvider {
return TextChapter(
bookChapter.index, displayTitle,
bookChapter.getAbsoluteURL().substringBefore(",{"), //getAbsoluteURL已经格式过
bookChapter.getAbsoluteURL(),
textPages, chapterSize,
bookChapter.isVip, bookChapter.isPay
)
@ -190,9 +193,6 @@ object ChapterProvider {
Book.imgStyleFull -> {
width = visibleWidth
height = it.height * visibleWidth / it.width
}
Book.imgStyleText -> {
}
else -> {
if (it.width > visibleWidth) {
@ -529,6 +529,7 @@ object ChapterProvider {
if (width > 0 && height > 0 && (width != viewWidth || height != viewHeight)) {
viewWidth = width
viewHeight = height
isHorizontal = width > height
upVisibleSize()
postEvent(EventBus.UP_CONFIG, true)
}
@ -541,7 +542,11 @@ object ChapterProvider {
if (viewWidth > 0 && viewHeight > 0) {
paddingLeft = ReadBookConfig.paddingLeft.dp
paddingTop = ReadBookConfig.paddingTop.dp
visibleWidth = viewWidth - paddingLeft - ReadBookConfig.paddingRight.dp
visibleWidth = if (isHorizontal) {
viewWidth / 2 - paddingLeft - ReadBookConfig.paddingRight.dp
} else {
viewWidth - paddingLeft - ReadBookConfig.paddingRight.dp
}
visibleHeight = viewHeight - paddingTop - ReadBookConfig.paddingBottom.dp
visibleRight = paddingLeft + visibleWidth
visibleBottom = paddingTop + visibleHeight

Loading…
Cancel
Save