mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
书架管理点击书名阅读
This commit is contained in:
parent
df95c09d8b
commit
b98f7bceb3
@ -89,6 +89,11 @@ class BookAdapter(context: Context, val callBack: CallBack) :
|
||||
callBack.upSelectCount()
|
||||
}
|
||||
}
|
||||
tvName.setOnClickListener {
|
||||
getItem(holder.layoutPosition)?.let {
|
||||
callBack.readBook(it)
|
||||
}
|
||||
}
|
||||
tvDelete.setOnClickListener {
|
||||
getItem(holder.layoutPosition)?.let {
|
||||
callBack.deleteBook(it)
|
||||
@ -221,9 +226,15 @@ class BookAdapter(context: Context, val callBack: CallBack) :
|
||||
|
||||
interface CallBack {
|
||||
val groupList: List<BookGroup>
|
||||
|
||||
fun upSelectCount()
|
||||
|
||||
fun updateBook(vararg book: Book)
|
||||
|
||||
fun deleteBook(book: Book)
|
||||
|
||||
fun selectGroup(requestCode: Int, groupId: Long)
|
||||
|
||||
fun readBook(book: Book)
|
||||
}
|
||||
}
|
@ -22,14 +22,17 @@ import io.legado.app.data.entities.BookGroup
|
||||
import io.legado.app.data.entities.BookSource
|
||||
import io.legado.app.databinding.ActivityArrangeBookBinding
|
||||
import io.legado.app.help.book.contains
|
||||
import io.legado.app.help.book.isAudio
|
||||
import io.legado.app.help.book.isLocal
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.help.config.LocalConfig
|
||||
import io.legado.app.lib.dialogs.alert
|
||||
import io.legado.app.lib.theme.primaryColor
|
||||
import io.legado.app.lib.theme.primaryTextColor
|
||||
import io.legado.app.ui.book.audio.AudioPlayActivity
|
||||
import io.legado.app.ui.book.group.GroupManageDialog
|
||||
import io.legado.app.ui.book.group.GroupSelectDialog
|
||||
import io.legado.app.ui.book.read.ReadBookActivity
|
||||
import io.legado.app.ui.widget.SelectActionBar
|
||||
import io.legado.app.ui.widget.dialog.WaitDialog
|
||||
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
|
||||
@ -359,6 +362,19 @@ class BookshelfManageActivity :
|
||||
}
|
||||
}
|
||||
|
||||
override fun readBook(book: Book) {
|
||||
when {
|
||||
book.isAudio ->
|
||||
startActivity<AudioPlayActivity> {
|
||||
putExtra("bookUrl", book.bookUrl)
|
||||
}
|
||||
|
||||
else -> startActivity<ReadBookActivity> {
|
||||
putExtra("bookUrl", book.bookUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun sourceOnClick(source: BookSource) {
|
||||
viewModel.changeSource(adapter.selection, source)
|
||||
viewModel.batchChangeSourceState.value = true
|
||||
|
Loading…
Reference in New Issue
Block a user