pull/37/head
kunfei 5 years ago
parent f75450e9f5
commit 9517a66c4f
  1. 5
      app/src/main/java/io/legado/app/ui/widget/page/curl/CurlView.kt
  2. 4
      app/src/main/java/io/legado/app/ui/widget/page/delegate/SimulationPageDelegate.kt

@ -1,6 +1,7 @@
package io.legado.app.ui.widget.page.curl package io.legado.app.ui.widget.page.curl
import android.content.Context import android.content.Context
import android.graphics.PixelFormat
import android.graphics.PointF import android.graphics.PointF
import android.opengl.GLSurfaceView import android.opengl.GLSurfaceView
import android.util.AttributeSet import android.util.AttributeSet
@ -114,6 +115,10 @@ class CurlView : GLSurfaceView, View.OnTouchListener, CurlRenderer.Observer {
* Initialize method. * Initialize method.
*/ */
init { init {
setEGLConfigChooser(8, 8, 8, 8, 16, 0)
holder.setFormat(PixelFormat.TRANSLUCENT)
setZOrderOnTop(true)
setRenderer(mRenderer) setRenderer(mRenderer)
renderMode = RENDERMODE_WHEN_DIRTY renderMode = RENDERMODE_WHEN_DIRTY
setOnTouchListener(this) setOnTouchListener(this)

@ -15,7 +15,7 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi
pageView.addView(pageView.curlView) pageView.addView(pageView.curlView)
pageView.curlView?.mPageProvider = PageProvider() pageView.curlView?.mPageProvider = PageProvider()
pageView.curlView?.setSizeChangedObserver(SizeChangedObserver()) pageView.curlView?.setSizeChangedObserver(SizeChangedObserver())
pageView.curlView?.currentIndex = 1 pageView.curlView?.currentIndex = 0
} }
} }
@ -54,7 +54,7 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi
// 定义书籍尺寸的变化监听器 // 定义书籍尺寸的变化监听器
private inner class SizeChangedObserver : CurlView.SizeChangedObserver { private inner class SizeChangedObserver : CurlView.SizeChangedObserver {
override fun onSizeChanged(w: Int, h: Int) { override fun onSizeChanged(width: Int, height: Int) {
pageView.curlView?.setViewMode(CurlView.SHOW_ONE_PAGE) pageView.curlView?.setViewMode(CurlView.SHOW_ONE_PAGE)
pageView.curlView?.setMargins(0f, 0f, 0f, 0f) pageView.curlView?.setMargins(0f, 0f, 0f, 0f)
} }

Loading…
Cancel
Save