|
|
@ -48,8 +48,6 @@ class CurlView : GLSurfaceView, View.OnTouchListener, CurlRenderer.Observer { |
|
|
|
private var mPageLeft: CurlMesh |
|
|
|
private var mPageLeft: CurlMesh |
|
|
|
private var mPageRight: CurlMesh |
|
|
|
private var mPageRight: CurlMesh |
|
|
|
|
|
|
|
|
|
|
|
private var mPageProvider: PageProvider? = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val mPointerPos = PointerPosition() |
|
|
|
private val mPointerPos = PointerPosition() |
|
|
|
|
|
|
|
|
|
|
|
private var mRenderer: CurlRenderer = CurlRenderer(this) |
|
|
|
private var mRenderer: CurlRenderer = CurlRenderer(this) |
|
|
@ -59,6 +57,14 @@ class CurlView : GLSurfaceView, View.OnTouchListener, CurlRenderer.Observer { |
|
|
|
// One page is the default. |
|
|
|
// One page is the default. |
|
|
|
private var mViewMode = SHOW_ONE_PAGE |
|
|
|
private var mViewMode = SHOW_ONE_PAGE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mPageProvider: PageProvider? = null |
|
|
|
|
|
|
|
set(value) { |
|
|
|
|
|
|
|
field = value |
|
|
|
|
|
|
|
mCurrentIndex = 0 |
|
|
|
|
|
|
|
updatePages() |
|
|
|
|
|
|
|
requestRender() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get current page index. Page indices are zero based values presenting |
|
|
|
* Get current page index. Page indices are zero based values presenting |
|
|
|
* page being shown on right side of the book. |
|
|
|
* page being shown on right side of the book. |
|
|
@ -407,16 +413,6 @@ class CurlView : GLSurfaceView, View.OnTouchListener, CurlRenderer.Observer { |
|
|
|
mRenderer.setMargins(left, top, right, bottom) |
|
|
|
mRenderer.setMargins(left, top, right, bottom) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Update/set page provider. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
fun setPageProvider(pageProvider: PageProvider) { |
|
|
|
|
|
|
|
mPageProvider = pageProvider |
|
|
|
|
|
|
|
mCurrentIndex = 0 |
|
|
|
|
|
|
|
updatePages() |
|
|
|
|
|
|
|
requestRender() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Setter for whether left side page is rendered. This is useful mostly for |
|
|
|
* Setter for whether left side page is rendered. This is useful mostly for |
|
|
|
* situations where right (main) page is aligned to left side of screen and |
|
|
|
* situations where right (main) page is aligned to left side of screen and |
|
|
@ -645,7 +641,7 @@ class CurlView : GLSurfaceView, View.OnTouchListener, CurlRenderer.Observer { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Updates bitmaps for page meshes. |
|
|
|
* Updates bitmaps for page meshes. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun updatePages() { |
|
|
|
fun updatePages() { |
|
|
|
if (mPageProvider == null || mPageBitmapWidth <= 0 |
|
|
|
if (mPageProvider == null || mPageBitmapWidth <= 0 |
|
|
|
|| mPageBitmapHeight <= 0 |
|
|
|
|| mPageBitmapHeight <= 0 |
|
|
|
) { |
|
|
|
) { |
|
|
|