diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryAdapter.kt index 7768a39659..6c47e30cdd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryAdapter.kt @@ -210,7 +210,6 @@ class LibraryCategoryAdapter(val controller: LibraryController) : fun startReading(position: Int) fun onItemReleased(position: Int) fun canDrag(): Boolean - fun openCategoriesBackdrop() fun updateCategory(catId: Int): Boolean fun sortCategory(catId: Int, sortBy: Int) fun selectAll(position: Int) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index ce8f71f797..e935205fc2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -600,26 +600,6 @@ class LibraryController( return adapter.headerItems.firstOrNull() as? LibraryHeaderItem } - private fun getCategoryOrder(): Int? { - val position = - (recycler.layoutManager as LinearLayoutManager).findFirstCompletelyVisibleItemPosition() - var order = when (val item = adapter.getItem(position)) { - is LibraryHeaderItem -> item.category.order - is LibraryItem -> item.header.category.order - else -> null - } - if (order == null) { - val fPosition = - (recycler.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition() - order = when (val item = adapter.getItem(fPosition)) { - is LibraryHeaderItem -> item.category.order - is LibraryItem -> item.header.category.order - else -> null - } - } - return order - } - override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { return inflater.inflate(R.layout.library_list_controller, container, false) } @@ -1155,8 +1135,6 @@ class LibraryController( } } - override fun openCategoriesBackdrop() = showCategories(true) - override fun updateCategory(position: Int): Boolean { val category = (adapter.getItem(position) as? LibraryHeaderItem)?.category ?: return false val inQueue = LibraryUpdateService.categoryInQueue(category.id) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt index 3336a902e6..8679f82da8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderHolder.kt @@ -43,10 +43,11 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd category_header_layout.setOnClickListener { toggleCategory() } updateButton.setOnClickListener { addCategoryToUpdate() } sectionText.setOnLongClickListener { + val category = (adapter.getItem(adapterPosition) as? LibraryHeaderItem)?.category adapter.libraryListener.manageCategory(adapterPosition) - true + category?.isDynamic == false } - sectionText.setOnClickListener { adapter.libraryListener.openCategoriesBackdrop() } + sectionText.setOnClickListener { toggleCategory() } sortText.setOnClickListener { it.post { showCatSortOptions() } } checkboxImage.setOnClickListener { selectAll() } updateButton.drawable.mutate() @@ -86,6 +87,14 @@ class LibraryHeaderHolder(val view: View, private val adapter: LibraryCategoryAd } val category = item.category + if (category.isDynamic) { + category_header_layout.background = null + sectionText.background = null + } else { + category_header_layout.setBackgroundResource(R.drawable.list_item_selector) + sectionText.setBackgroundResource(R.drawable.square_ripple) + } + if (category.isAlone) sectionText.text = "" else sectionText.text = category.name if (category.sourceId != null) {