|
|
@ -29,8 +29,7 @@ class TextPageFactory(dataSource: DataSource) : PageFactory<TextPage>(dataSource |
|
|
|
|
|
|
|
|
|
|
|
override fun moveToNext(): Boolean = with(dataSource) { |
|
|
|
override fun moveToNext(): Boolean = with(dataSource) { |
|
|
|
return if (hasNext()) { |
|
|
|
return if (hasNext()) { |
|
|
|
if (getCurrentChapter()?.isLastIndex(pageIndex) == true |
|
|
|
if (getCurrentChapter()?.isLastIndex(pageIndex) == true) { |
|
|
|
) { |
|
|
|
|
|
|
|
ReadBook.moveToNextChapter(false) |
|
|
|
ReadBook.moveToNextChapter(false) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setPageIndex(pageIndex.plus(1)) |
|
|
|
setPageIndex(pageIndex.plus(1)) |
|
|
@ -40,7 +39,7 @@ class TextPageFactory(dataSource: DataSource) : PageFactory<TextPage>(dataSource |
|
|
|
false |
|
|
|
false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun moveToPrevious(): Boolean = with(dataSource) { |
|
|
|
override fun moveToPrev(): Boolean = with(dataSource) { |
|
|
|
return if (hasPrev()) { |
|
|
|
return if (hasPrev()) { |
|
|
|
if (pageIndex <= 0) { |
|
|
|
if (pageIndex <= 0) { |
|
|
|
ReadBook.moveToPrevChapter(false) |
|
|
|
ReadBook.moveToPrevChapter(false) |
|
|
@ -54,26 +53,26 @@ class TextPageFactory(dataSource: DataSource) : PageFactory<TextPage>(dataSource |
|
|
|
|
|
|
|
|
|
|
|
override val currentPage: TextPage? |
|
|
|
override val currentPage: TextPage? |
|
|
|
get() = with(dataSource) { |
|
|
|
get() = with(dataSource) { |
|
|
|
return getCurrentChapter()?.page(pageIndex) |
|
|
|
return getCurrentChapter()?.page(pageIndex) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override val nextPage: TextPage? |
|
|
|
override val nextPage: TextPage? |
|
|
|
get() = with(dataSource) { |
|
|
|
get() = with(dataSource) { |
|
|
|
getCurrentChapter()?.let { |
|
|
|
getCurrentChapter()?.let { |
|
|
|
if (pageIndex < it.pageSize() - 1) { |
|
|
|
if (pageIndex < it.pageSize() - 1) { |
|
|
|
return getCurrentChapter()?.page(pageIndex + 1)?.removePageAloudSpan() |
|
|
|
return getCurrentChapter()?.page(pageIndex + 1)?.removePageAloudSpan() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return getNextChapter()?.page(0)?.removePageAloudSpan() |
|
|
|
} |
|
|
|
} |
|
|
|
return getNextChapter()?.page(0)?.removePageAloudSpan() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override val prevPage: TextPage? |
|
|
|
override val prevPage: TextPage? |
|
|
|
get() = with(dataSource) { |
|
|
|
get() = with(dataSource) { |
|
|
|
if (pageIndex > 0) { |
|
|
|
if (pageIndex > 0) { |
|
|
|
return getCurrentChapter()?.page(pageIndex - 1)?.removePageAloudSpan() |
|
|
|
return getCurrentChapter()?.page(pageIndex - 1)?.removePageAloudSpan() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return getPreviousChapter()?.lastPage()?.removePageAloudSpan() |
|
|
|
} |
|
|
|
} |
|
|
|
return getPreviousChapter()?.lastPage()?.removePageAloudSpan() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|