|  |  | @ -3,19 +3,19 @@ package io.legado.app.ui.widget.page | 
			
		
	
		
		
			
				
					
					|  |  |  | class TextPageFactory(dataSource: DataSource) : PageFactory<TextPage>(dataSource) { |  |  |  | class TextPageFactory(dataSource: DataSource) : PageFactory<TextPage>(dataSource) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     override fun hasPrev(): Boolean = with(dataSource) { |  |  |  |     override fun hasPrev(): Boolean = with(dataSource) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return if (isScrollDelegate()) { |  |  |  |         return if (isScrollDelegate) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             hasPrevChapter() |  |  |  |             hasPrevChapter() | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             hasPrevChapter() || pageIndex() > 0 |  |  |  |             hasPrevChapter() || pageIndex > 0 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     override fun hasNext(): Boolean = with(dataSource) { |  |  |  |     override fun hasNext(): Boolean = with(dataSource) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return if (isScrollDelegate()) { |  |  |  |         return if (isScrollDelegate) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             hasNextChapter() |  |  |  |             hasNextChapter() | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             hasNextChapter() |  |  |  |             hasNextChapter() | 
			
		
	
		
		
			
				
					
					|  |  |  |                     || getCurrentChapter()?.isLastIndex(pageIndex()) != true |  |  |  |                     || getCurrentChapter()?.isLastIndex(pageIndex) != true | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -40,12 +40,12 @@ 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 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 || isScrollDelegate() |  |  |  |                 || isScrollDelegate | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             ) { |  |  |  |             ) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 moveToNextChapter() |  |  |  |                 moveToNextChapter() | 
			
		
	
		
		
			
				
					
					|  |  |  |             } else { |  |  |  |             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 setPageIndex(pageIndex().plus(1)) |  |  |  |                 setPageIndex(pageIndex.plus(1)) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             true |  |  |  |             true | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else |  |  |  |         } else | 
			
		
	
	
		
		
			
				
					|  |  | @ -54,10 +54,10 @@ class TextPageFactory(dataSource: DataSource) : PageFactory<TextPage>(dataSource | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     override fun moveToPrevious(): Boolean = with(dataSource) { |  |  |  |     override fun moveToPrevious(): Boolean = with(dataSource) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return if (hasPrev()) { |  |  |  |         return if (hasPrev()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (pageIndex() <= 0 || isScrollDelegate()) { |  |  |  |             if (pageIndex <= 0 || isScrollDelegate) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 moveToPrevChapter() |  |  |  |                 moveToPrevChapter() | 
			
		
	
		
		
			
				
					
					|  |  |  |             } else { |  |  |  |             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 setPageIndex(pageIndex().minus(1)) |  |  |  |                 setPageIndex(pageIndex.minus(1)) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             true |  |  |  |             true | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else |  |  |  |         } else | 
			
		
	
	
		
		
			
				
					|  |  | @ -65,39 +65,39 @@ class TextPageFactory(dataSource: DataSource) : PageFactory<TextPage>(dataSource | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     override fun currentPage(): TextPage? = with(dataSource) { |  |  |  |     override fun currentPage(): TextPage? = with(dataSource) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return if (isScrollDelegate()) { |  |  |  |         return if (isScrollDelegate) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             getCurrentChapter()?.scrollPage() |  |  |  |             getCurrentChapter()?.scrollPage() | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             getCurrentChapter()?.page(pageIndex()) |  |  |  |             getCurrentChapter()?.page(pageIndex) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         } ?: TextPage(index = pageIndex(), title = "index:${pageIndex()}") |  |  |  |         } ?: TextPage(index = pageIndex, title = "index:${pageIndex}") | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     override fun nextPage(): TextPage? = with(dataSource) { |  |  |  |     override fun nextPage(): TextPage? = with(dataSource) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (isScrollDelegate()) { |  |  |  |         if (isScrollDelegate) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             return getNextChapter()?.scrollPage() |  |  |  |             return getNextChapter()?.scrollPage() | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ?: TextPage(index = pageIndex() + 1, title = "index:${pageIndex() + 1}") |  |  |  |                 ?: TextPage(index = pageIndex + 1, title = "index:${pageIndex + 1}") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         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() | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     ?: TextPage(index = pageIndex() + 1, title = "index:${pageIndex() + 1}") |  |  |  |                     ?: TextPage(index = pageIndex + 1, title = "index:${pageIndex + 1}") | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         return getNextChapter()?.page(0)?.removePageAloudSpan() |  |  |  |         return getNextChapter()?.page(0)?.removePageAloudSpan() | 
			
		
	
		
		
			
				
					
					|  |  |  |             ?: TextPage(index = pageIndex() + 1, title = "index:${pageIndex() + 1}") |  |  |  |             ?: TextPage(index = pageIndex + 1, title = "index:${pageIndex + 1}") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     override fun previousPage(): TextPage? = with(dataSource) { |  |  |  |     override fun previousPage(): TextPage? = with(dataSource) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (isScrollDelegate()) { |  |  |  |         if (isScrollDelegate) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             return getPreviousChapter()?.scrollPage() |  |  |  |             return getPreviousChapter()?.scrollPage() | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ?: TextPage(index = pageIndex() + 1, title = "index:${pageIndex() + 1}") |  |  |  |                 ?: TextPage(index = pageIndex + 1, title = "index:${pageIndex + 1}") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (pageIndex() > 0) { |  |  |  |         if (pageIndex > 0) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             return getCurrentChapter()?.page(pageIndex() - 1)?.removePageAloudSpan() |  |  |  |             return getCurrentChapter()?.page(pageIndex - 1)?.removePageAloudSpan() | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ?: TextPage(index = pageIndex() - 1, title = "index:${pageIndex() - 1}") |  |  |  |                 ?: TextPage(index = pageIndex - 1, title = "index:${pageIndex - 1}") | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         return getPreviousChapter()?.lastPage()?.removePageAloudSpan() |  |  |  |         return getPreviousChapter()?.lastPage()?.removePageAloudSpan() | 
			
		
	
		
		
			
				
					
					|  |  |  |             ?: TextPage(index = pageIndex() - 1, title = "index:${pageIndex() - 1}") |  |  |  |             ?: TextPage(index = pageIndex - 1, title = "index:${pageIndex - 1}") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |