diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt index 64e9ab388..9f533e2c8 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt @@ -12,6 +12,8 @@ import io.legado.app.help.ImageLoader import io.legado.app.lib.theme.ThemeStore import kotlinx.android.synthetic.main.item_bookshelf_list.view.* import kotlinx.android.synthetic.main.item_relace_rule.view.tv_name +import org.jetbrains.anko.sdk27.listeners.onClick +import org.jetbrains.anko.sdk27.listeners.onLongClick class BookshelfAdapter : PagedListAdapter(DIFF_CALLBACK) { @@ -58,12 +60,17 @@ class BookshelfAdapter : PagedListAdapter(D .centerCrop() .setAsDrawable(iv_cover) } - itemView.setOnClickListener { callBack?.open(book) } + itemView.onClick { callBack?.open(book) } + itemView.onLongClick { + callBack?.openBookInfo(book) + true + } } } interface CallBack { fun open(book: Book) + fun openBookInfo(book: Book) fun search() } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt index 5efb1801a..30cb4e293 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt @@ -24,6 +24,7 @@ import io.legado.app.lib.dialogs.yesButton import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor import io.legado.app.ui.bookshelf.BookshelfActivity +import io.legado.app.ui.chapterlist.ChapterListActivity import io.legado.app.ui.read.ReadActivity import io.legado.app.ui.search.SearchActivity import io.legado.app.utils.applyTint @@ -108,6 +109,10 @@ class BookshelfFragment : VMBaseFragment(R.layout.fragment_b context?.startActivity() } + override fun openBookInfo(book: Book) { + context?.startActivity(Pair("bookUrl", book.bookUrl)) + } + override fun search() { }