pull/32/head
kunfei 5 years ago
parent f916b66f20
commit 46d7914ca3
  1. 9
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt
  2. 5
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.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<Book, BookshelfAdapter.MyViewHolder>(DIFF_CALLBACK) {
@ -58,12 +60,17 @@ class BookshelfAdapter : PagedListAdapter<Book, BookshelfAdapter.MyViewHolder>(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()
}
}

@ -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<BookshelfViewModel>(R.layout.fragment_b
context?.startActivity<ReadActivity>()
}
override fun openBookInfo(book: Book) {
context?.startActivity<ChapterListActivity>(Pair("bookUrl", book.bookUrl))
}
override fun search() {
}

Loading…
Cancel
Save