横屏双页完

pull/1352/head
gedoor 4 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() callBack.openSourceEditActivity()
} }
tvChapterUrl.setOnClickListener { tvChapterUrl.setOnClickListener {
context.openUrl(binding.tvChapterUrl.text.toString()) context.sendToClip(binding.tvChapterUrl.text.toString())
} }
//登录 //登录
tvLogin.setOnClickListener { tvLogin.setOnClickListener {

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

Loading…
Cancel
Save