横屏双页

pull/1352/head
gedoor 3 years ago
parent ae1fa45eb6
commit 3166f1a27c
  1. 1
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt
  3. 1
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  4. 1
      app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt
  5. 8
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt

@ -269,6 +269,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
} }
R.id.menu_page_anim -> showPageAnimConfig { R.id.menu_page_anim -> showPageAnimConfig {
binding.readView.upPageAnim() binding.readView.upPageAnim()
ReadBook.loadContent(false)
} }
R.id.menu_book_info -> ReadBook.book?.let { R.id.menu_book_info -> ReadBook.book?.let {
startActivity<BookInfoActivity> { startActivity<BookInfoActivity> {

@ -11,6 +11,7 @@ import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.bottomBackground
import io.legado.app.lib.theme.getPrimaryTextColor import io.legado.app.lib.theme.getPrimaryTextColor
import io.legado.app.model.ReadAloud import io.legado.app.model.ReadAloud
import io.legado.app.model.ReadBook
import io.legado.app.service.BaseReadAloudService import io.legado.app.service.BaseReadAloudService
import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.book.read.ReadBookBaseActivity import io.legado.app.ui.book.read.ReadBookBaseActivity
@ -102,6 +103,7 @@ class AutoReadDialog : BaseDialogFragment() {
binding.llSetting.setOnClickListener { binding.llSetting.setOnClickListener {
(activity as ReadBookBaseActivity).showPageAnimConfig { (activity as ReadBookBaseActivity).showPageAnimConfig {
(activity as ReadBookActivity).upPageAnim() (activity as ReadBookActivity).upPageAnim()
ReadBook.loadContent(false)
} }
} }
binding.llCatalog.setOnClickListener { callBack?.openChapterList() } binding.llCatalog.setOnClickListener { callBack?.openChapterList() }

@ -132,6 +132,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
ReadBook.book?.setPageAnim(-1) ReadBook.book?.setPageAnim(-1)
ReadBookConfig.pageAnim = binding.rgPageAnim.getIndexById(checkedId) ReadBookConfig.pageAnim = binding.rgPageAnim.getIndexById(checkedId)
callBack?.upPageAnim() callBack?.upPageAnim()
ReadBook.loadContent(false)
} }
cbShareLayout.onCheckedChangeListener = { _, isChecked -> cbShareLayout.onCheckedChangeListener = { _, isChecked ->
ReadBookConfig.shareLayout = isChecked ReadBookConfig.shareLayout = isChecked

@ -469,6 +469,7 @@ class ReadView(context: Context, attrs: AttributeSet) :
fun upPageAnim() { fun upPageAnim() {
isScroll = ReadBook.pageAnim() == 3 isScroll = ReadBook.pageAnim() == 3
ChapterProvider.upLayout()
when (ReadBook.pageAnim()) { when (ReadBook.pageAnim()) {
0 -> if (pageDelegate !is CoverPageDelegate) { 0 -> if (pageDelegate !is CoverPageDelegate) {
pageDelegate = CoverPageDelegate(this) pageDelegate = CoverPageDelegate(this)

@ -497,7 +497,7 @@ object ChapterProvider {
paragraphSpacing = ReadBookConfig.paragraphSpacing paragraphSpacing = ReadBookConfig.paragraphSpacing
titleTopSpacing = ReadBookConfig.titleTopSpacing.dp titleTopSpacing = ReadBookConfig.titleTopSpacing.dp
titleBottomSpacing = ReadBookConfig.titleBottomSpacing.dp titleBottomSpacing = ReadBookConfig.titleBottomSpacing.dp
upVisibleSize() upLayout()
} }
private fun getTypeface(fontPath: String): Typeface { private fun getTypeface(fontPath: String): Typeface {
@ -567,8 +567,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
doublePage = width > height upLayout()
upVisibleSize()
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)
} }
} }
@ -576,7 +575,8 @@ object ChapterProvider {
/** /**
* 更新绘制尺寸 * 更新绘制尺寸
*/ */
private fun upVisibleSize() { fun upLayout() {
doublePage = viewWidth > viewHeight && ReadBook.pageAnim() != 3
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

Loading…
Cancel
Save