From a4b71f4d11ca87b422462bdc0c065cfc34c71144 Mon Sep 17 00:00:00 2001 From: len Date: Tue, 6 Sep 2016 21:22:56 +0200 Subject: [PATCH] Minor UI fixes --- .../java/eu/kanade/tachiyomi/ui/library/LibraryAdapter.kt | 8 +++++--- .../eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryAdapter.kt index c416c8e456..fe4433eadf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryAdapter.kt @@ -77,10 +77,12 @@ class LibraryAdapter(private val fragment: LibraryFragment) : RecyclerViewPagerA } /** - * Returns the position of the item. Always assume the position has changed. + * Returns the position of the view. */ - override fun getItemPosition(`object`: Any?): Int { - return POSITION_NONE + override fun getItemPosition(obj: Any?): Int { + val view = obj as? LibraryCategoryView ?: return POSITION_NONE + val index = categories.indexOfFirst { it.id == view.category.id } + return if (index == -1) POSITION_NONE else index } } \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt index fd042ef45f..67fa76c7ba 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt @@ -41,7 +41,8 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att /** * Category for this view. */ - private lateinit var category: Category + lateinit var category: Category + private set /** * Recycler view of the list of manga.