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)