|
|
@ -16,7 +16,6 @@ import io.legado.app.utils.getPrefInt |
|
|
|
|
|
|
|
|
|
|
|
class PageView(context: Context, attrs: AttributeSet) : |
|
|
|
class PageView(context: Context, attrs: AttributeSet) : |
|
|
|
FrameLayout(context, attrs), |
|
|
|
FrameLayout(context, attrs), |
|
|
|
ContentView.CallBack, |
|
|
|
|
|
|
|
DataSource { |
|
|
|
DataSource { |
|
|
|
|
|
|
|
|
|
|
|
var callBack: CallBack |
|
|
|
var callBack: CallBack |
|
|
@ -39,7 +38,6 @@ class PageView(context: Context, attrs: AttributeSet) : |
|
|
|
setWillNotDraw(false) |
|
|
|
setWillNotDraw(false) |
|
|
|
pageFactory = TextPageFactory(this) |
|
|
|
pageFactory = TextPageFactory(this) |
|
|
|
upPageAnim(context.getPrefInt(PreferKey.pageAnim)) |
|
|
|
upPageAnim(context.getPrefInt(PreferKey.pageAnim)) |
|
|
|
curPage.callBack = this |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { |
|
|
|
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { |
|
|
@ -199,25 +197,6 @@ class PageView(context: Context, attrs: AttributeSet) : |
|
|
|
return ReadBook.durChapterIndex > 0 |
|
|
|
return ReadBook.durChapterIndex > 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun scrollToLine(line: Int) { |
|
|
|
|
|
|
|
if (isScrollDelegate) { |
|
|
|
|
|
|
|
ReadBook.textChapter()?.let { |
|
|
|
|
|
|
|
val pageIndex = it.getPageIndex(line) |
|
|
|
|
|
|
|
curPage.setPageIndex(pageIndex) |
|
|
|
|
|
|
|
callBack.setPageIndex(pageIndex) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun scrollToLast() { |
|
|
|
|
|
|
|
if (isScrollDelegate) { |
|
|
|
|
|
|
|
ReadBook.textChapter()?.let { |
|
|
|
|
|
|
|
callBack.setPageIndex(it.lastIndex()) |
|
|
|
|
|
|
|
curPage.setPageIndex(it.lastIndex()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface CallBack { |
|
|
|
interface CallBack { |
|
|
|
|
|
|
|
|
|
|
|
val isInitFinish: Boolean |
|
|
|
val isInitFinish: Boolean |
|
|
|