Chapter list starts at top for unfaved manga
This commit is contained in:
parent
73d1b6ac27
commit
c8656526df
2 changed files with 5 additions and 2 deletions
|
@ -250,7 +250,7 @@ class ChaptersController() : NucleusController<ChaptersPresenter>(),
|
|||
private fun scrollToUnread() {
|
||||
if (adapter?.items.isNullOrEmpty()) return
|
||||
if (scrollToUnread) {
|
||||
val index = presenter.getFirstUnreadIndex()
|
||||
val index = presenter.getFirstUnreadIndex() ?: return
|
||||
val centerOfScreen =
|
||||
if (startingChapterYPos != null) startingChapterYPos!!.toInt() - recycler.top - 96
|
||||
else recycler.height / 2 - 96
|
||||
|
|
|
@ -415,7 +415,10 @@ class ChaptersPresenter(
|
|||
return manga.sortDescending()
|
||||
}
|
||||
|
||||
fun getFirstUnreadIndex(): Int {
|
||||
fun getFirstUnreadIndex(): Int? {
|
||||
if (!manga.favorite) {
|
||||
return null
|
||||
}
|
||||
val index = chapters.sortedByDescending { it.source_order }.indexOfFirst { !it.read }
|
||||
return if (sortDescending()) (chapters.size - 1) - index
|
||||
else index
|
||||
|
|
Reference in a new issue