mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:35:10 +01:00
Chapter list starts at top for unfaved manga
This commit is contained in:
parent
73d1b6ac27
commit
c8656526df
@ -250,7 +250,7 @@ class ChaptersController() : NucleusController<ChaptersPresenter>(),
|
|||||||
private fun scrollToUnread() {
|
private fun scrollToUnread() {
|
||||||
if (adapter?.items.isNullOrEmpty()) return
|
if (adapter?.items.isNullOrEmpty()) return
|
||||||
if (scrollToUnread) {
|
if (scrollToUnread) {
|
||||||
val index = presenter.getFirstUnreadIndex()
|
val index = presenter.getFirstUnreadIndex() ?: return
|
||||||
val centerOfScreen =
|
val centerOfScreen =
|
||||||
if (startingChapterYPos != null) startingChapterYPos!!.toInt() - recycler.top - 96
|
if (startingChapterYPos != null) startingChapterYPos!!.toInt() - recycler.top - 96
|
||||||
else recycler.height / 2 - 96
|
else recycler.height / 2 - 96
|
||||||
|
@ -415,7 +415,10 @@ class ChaptersPresenter(
|
|||||||
return manga.sortDescending()
|
return manga.sortDescending()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getFirstUnreadIndex(): Int {
|
fun getFirstUnreadIndex(): Int? {
|
||||||
|
if (!manga.favorite) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
val index = chapters.sortedByDescending { it.source_order }.indexOfFirst { !it.read }
|
val index = chapters.sortedByDescending { it.source_order }.indexOfFirst { !it.read }
|
||||||
return if (sortDescending()) (chapters.size - 1) - index
|
return if (sortDescending()) (chapters.size - 1) - index
|
||||||
else index
|
else index
|
||||||
|
Loading…
Reference in New Issue
Block a user