mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 05:15:10 +01:00
Using library header category instead of finding the category in presenter
even though the header category also finds it in the presenter
This commit is contained in:
parent
eed9e0c765
commit
c9e3882077
@ -516,7 +516,7 @@ class LibraryController(
|
|||||||
(recycler.layoutManager as LinearLayoutManager).findFirstCompletelyVisibleItemPosition()
|
(recycler.layoutManager as LinearLayoutManager).findFirstCompletelyVisibleItemPosition()
|
||||||
var order = when (val item = adapter.getItem(position)) {
|
var order = when (val item = adapter.getItem(position)) {
|
||||||
is LibraryHeaderItem -> item.category.order
|
is LibraryHeaderItem -> item.category.order
|
||||||
is LibraryItem -> presenter.categories.find { it.id == item.manga.category }?.order
|
is LibraryItem -> item.header.category.order
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
@ -524,7 +524,7 @@ class LibraryController(
|
|||||||
(recycler.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
|
(recycler.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
|
||||||
order = when (val item = adapter.getItem(fPosition)) {
|
order = when (val item = adapter.getItem(fPosition)) {
|
||||||
is LibraryHeaderItem -> item.category.order
|
is LibraryHeaderItem -> item.category.order
|
||||||
is LibraryItem -> presenter.categories.find { it.id == item.manga.category }?.order
|
is LibraryItem -> item.header.category.order
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class LibraryPresenter(
|
|||||||
val showAll = showAllCategories || preferences.hideCategories().getOrDefault() ||
|
val showAll = showAllCategories || preferences.hideCategories().getOrDefault() ||
|
||||||
categories.size == 1
|
categories.size == 1
|
||||||
if (!showAll) {
|
if (!showAll) {
|
||||||
sectionedLibraryItems = items.groupBy { it.manga.category }.toMutableMap()
|
sectionedLibraryItems = items.groupBy { it.header.category.id ?: 0 }.toMutableMap()
|
||||||
if (currentCategory == -1) currentCategory = categories.find {
|
if (currentCategory == -1) currentCategory = categories.find {
|
||||||
it.order == preferences.lastUsedCategory().getOrDefault()
|
it.order == preferences.lastUsedCategory().getOrDefault()
|
||||||
}?.id ?: 0
|
}?.id ?: 0
|
||||||
@ -408,9 +408,10 @@ class LibraryPresenter(
|
|||||||
i2: LibraryItem,
|
i2: LibraryItem,
|
||||||
lastReadManga: Map<Long, Int>
|
lastReadManga: Map<Long, Int>
|
||||||
): Int {
|
): Int {
|
||||||
return if (i1.manga.category == i2.manga.category) {
|
return if (i1.header.category.id == i2.header.category.id) {
|
||||||
val category = allCategories.find { it.id == i1.manga.category } ?: return 0
|
val category = i1.header.category
|
||||||
if (category.mangaOrder.isNullOrEmpty() && category.mangaSort == null) {
|
if (!category.isDynamic &&
|
||||||
|
category.mangaOrder.isNullOrEmpty() && category.mangaSort == null) {
|
||||||
category.changeSortTo(preferences.librarySortingMode().getOrDefault())
|
category.changeSortTo(preferences.librarySortingMode().getOrDefault())
|
||||||
if (category.id == 0) preferences.defaultMangaOrder()
|
if (category.id == 0) preferences.defaultMangaOrder()
|
||||||
.set(category.mangaSort.toString())
|
.set(category.mangaSort.toString())
|
||||||
@ -465,8 +466,8 @@ class LibraryPresenter(
|
|||||||
sortAlphabetical(i1, i2)
|
sortAlphabetical(i1, i2)
|
||||||
} else compare
|
} else compare
|
||||||
} else {
|
} else {
|
||||||
val category = allCategories.find { it.id == i1.manga.category }?.order ?: -1
|
val category = i1.header.category.order
|
||||||
val category2 = allCategories.find { it.id == i2.manga.category }?.order ?: -1
|
val category2 = i2.header.category.order
|
||||||
category.compareTo(category2)
|
category.compareTo(category2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user