Fix fast scroll when using a single category

No longer shows the refresh button for single category
This commit is contained in:
Jay 2020-04-13 20:34:19 -04:00
parent 14c2ac6067
commit 69214984e4
2 changed files with 7 additions and 2 deletions

View File

@ -96,13 +96,17 @@ class LibraryCategoryAdapter(val libraryListener: LibraryListener) :
val preferences: PreferencesHelper by injectLazy()
val db: DatabaseHelper by injectLazy()
if (position == itemCount - 1) return "-"
val sorting = if (preferences.hideCategories().getOrDefault())
preferences.hideCategories().getOrDefault()
else (headerItems.firstOrNull() as? LibraryHeaderItem)?.category?.sortingMode()
?: LibrarySort.DRAG_AND_DROP
return when (val item: IFlexible<*>? = getItem(position)) {
is LibraryHeaderItem ->
if (preferences.hideCategories().getOrDefault() || item.category.id == 0) null
else item.category.name.first().toString() +
"\u200B".repeat(max(0, item.category.order))
is LibraryItem -> {
when (preferences.librarySortingMode().getOrDefault()) {
when (sorting) {
LibrarySort.DRAG_AND_DROP -> {
val category = db.getCategoriesForManga(item.manga).executeAsBlocking()
.firstOrNull()

View File

@ -28,6 +28,7 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visInvisIf
import eu.kanade.tachiyomi.util.view.visible
import kotlinx.android.synthetic.main.library_category_header_item.view.*
@ -142,7 +143,7 @@ class LibraryHeaderItem(
else -> {
catProgress.gone()
checkboxImage.gone()
updateButton.visible()
updateButton.visInvisIf(!(category.isFirst == true && category.isLast == true))
}
}
}