From 621be37d198433a8a028dfe203dfe2149c106360 Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 10 May 2021 13:57:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B9=A6=E7=AD=BEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/toc/BookmarkAdapter.kt | 9 ++++++--- .../java/io/legado/app/ui/book/toc/BookmarkFragment.kt | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/toc/BookmarkAdapter.kt b/app/src/main/java/io/legado/app/ui/book/toc/BookmarkAdapter.kt index 73fe4fe93..43a6ac72d 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/BookmarkAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/BookmarkAdapter.kt @@ -27,14 +27,17 @@ class BookmarkAdapter(context: Context, val callback: Callback) : } override fun registerListener(holder: ItemViewHolder, binding: ItemBookmarkBinding) { - getItem(holder.layoutPosition)?.let { bookmark -> - binding.root.setOnClickListener { + binding.root.setOnClickListener { + getItem(holder.layoutPosition)?.let { bookmark -> callback.onClick(bookmark) } - binding.root.onLongClick { + } + binding.root.onLongClick { + getItem(holder.layoutPosition)?.let { bookmark -> callback.onLongClick(bookmark) } } + } interface Callback { diff --git a/app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt b/app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt index f2ed00882..976436e56 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/BookmarkFragment.kt @@ -1,6 +1,5 @@ package io.legado.app.ui.book.toc -import android.annotation.SuppressLint import android.app.Activity import android.content.Intent import android.os.Bundle @@ -74,7 +73,6 @@ class BookmarkFragment : VMBaseFragment(R.layout.fragment_ activity?.finish() } - @SuppressLint("InflateParams") override fun onLongClick(bookmark: Bookmark) { requireContext().alert(R.string.bookmark) { setMessage(bookmark.chapterName)