From df5395f9a352a1086010b55e66f5bc7c02c857b4 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 16 Feb 2020 18:05:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/main/explore/ExploreAdapter.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt index 9bd403e33..2cf926d34 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt @@ -71,13 +71,14 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca override fun registerListener(holder: ItemViewHolder) { holder.itemView.apply { ll_title.onClick { + val position = holder.layoutPosition val oldEx = exIndex - exIndex = if (exIndex == holder.layoutPosition) -1 else holder.layoutPosition + exIndex = if (exIndex == position) -1 else position notifyItemChanged(oldEx, false) if (exIndex != -1) { - notifyItemChanged(holder.layoutPosition, false) + notifyItemChanged(position, false) } - callBack.scrollTo(holder.layoutPosition) + callBack.scrollTo(position) } ll_title.onLongClick { showMenu(ll_title, holder.layoutPosition)