|
|
@ -7,8 +7,10 @@ import android.util.AttributeSet |
|
|
|
import android.view.MotionEvent |
|
|
|
import android.view.MotionEvent |
|
|
|
import android.widget.FrameLayout |
|
|
|
import android.widget.FrameLayout |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
|
|
|
|
import io.legado.app.ui.widget.page.delegate.CoverPageDelegate |
|
|
|
import io.legado.app.ui.widget.page.delegate.PageDelegate |
|
|
|
import io.legado.app.ui.widget.page.delegate.PageDelegate |
|
|
|
import io.legado.app.ui.widget.page.delegate.SlidePageDelegate |
|
|
|
import io.legado.app.ui.widget.page.delegate.SlidePageDelegate |
|
|
|
|
|
|
|
import io.legado.app.utils.getPrefInt |
|
|
|
|
|
|
|
|
|
|
|
class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs), PageDelegate.PageInterface { |
|
|
|
class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs), PageDelegate.PageInterface { |
|
|
|
|
|
|
|
|
|
|
@ -30,7 +32,7 @@ class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, att |
|
|
|
upBg() |
|
|
|
upBg() |
|
|
|
setWillNotDraw(false) |
|
|
|
setWillNotDraw(false) |
|
|
|
|
|
|
|
|
|
|
|
pageDelegate = SlidePageDelegate(this) |
|
|
|
upPageAnim() |
|
|
|
|
|
|
|
|
|
|
|
setPageFactory(TextPageFactory.create(object : DataSource { |
|
|
|
setPageFactory(TextPageFactory.create(object : DataSource { |
|
|
|
override fun pageIndex(): Int { |
|
|
|
override fun pageIndex(): Int { |
|
|
@ -138,6 +140,13 @@ class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, att |
|
|
|
upContent() |
|
|
|
upContent() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun upPageAnim() { |
|
|
|
|
|
|
|
pageDelegate = when (context.getPrefInt("pageAnim")) { |
|
|
|
|
|
|
|
1 -> SlidePageDelegate(this) |
|
|
|
|
|
|
|
else -> CoverPageDelegate(this) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun upContent() { |
|
|
|
fun upContent() { |
|
|
|
pageFactory?.let { |
|
|
|
pageFactory?.let { |
|
|
|
prevPage?.setContent(it.previousPage()) |
|
|
|
prevPage?.setContent(it.previousPage()) |
|
|
|