mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
Some checks failed
Test Build / prepare (push) Has been cancelled
Test Build / build (app, release) (push) Has been cancelled
Test Build / build (app, releaseA) (push) Has been cancelled
Test Build / prerelease (push) Has been cancelled
Test Build / lanzou (push) Has been cancelled
Test Build / test_Branch (push) Has been cancelled
Test Build / telegram (push) Has been cancelled
Some checks failed
Test Build / prepare (push) Has been cancelled
Test Build / build (app, release) (push) Has been cancelled
Test Build / build (app, releaseA) (push) Has been cancelled
Test Build / prerelease (push) Has been cancelled
Test Build / lanzou (push) Has been cancelled
Test Build / test_Branch (push) Has been cancelled
Test Build / telegram (push) Has been cancelled
This commit is contained in:
@@ -135,8 +135,8 @@ abstract class BaseBooksAdapter<VH : RecyclerView.ViewHolder>(
|
||||
|
||||
|
||||
interface CallBack {
|
||||
fun onItemClick(position: Int)
|
||||
fun onItemLongClick(position: Int)
|
||||
fun onItemClick(item: Any)
|
||||
fun onItemLongClick(item: Any)
|
||||
fun isUpdate(bookUrl: String): Boolean
|
||||
fun getItems(): List<Any>
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) :
|
||||
) {
|
||||
when (holder) {
|
||||
is BookViewHolder -> (getItem(position) as? Book)?.let {
|
||||
holder.registerListener(position)
|
||||
holder.registerListener(it)
|
||||
holder.onBind(it, position, payloads)
|
||||
}
|
||||
|
||||
is GroupViewHolder -> (getItem(position) as? BookGroup)?.let {
|
||||
holder.registerListener(position)
|
||||
holder.registerListener(it)
|
||||
holder.onBind(it, position, payloads)
|
||||
}
|
||||
}
|
||||
@@ -78,12 +78,12 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) :
|
||||
}
|
||||
}
|
||||
|
||||
fun registerListener(position: Int) {
|
||||
fun registerListener(item: Any) {
|
||||
binding.root.setOnClickListener {
|
||||
callBack.onItemClick(position)
|
||||
callBack.onItemClick(item)
|
||||
}
|
||||
binding.root.onLongClick {
|
||||
callBack.onItemLongClick(position)
|
||||
callBack.onItemLongClick(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,12 +128,12 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) :
|
||||
}
|
||||
}
|
||||
|
||||
fun registerListener(position: Int) {
|
||||
fun registerListener(item: Any) {
|
||||
binding.root.setOnClickListener {
|
||||
callBack.onItemClick(position)
|
||||
callBack.onItemClick(item)
|
||||
}
|
||||
binding.root.onLongClick {
|
||||
callBack.onItemLongClick(position)
|
||||
callBack.onItemLongClick(item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ class BooksAdapterList(context: Context, callBack: CallBack) :
|
||||
) {
|
||||
when (holder) {
|
||||
is BookViewHolder -> (getItem(position) as? Book)?.let {
|
||||
holder.registerListener(position)
|
||||
holder.registerListener(it)
|
||||
holder.onBind(it, position, payloads)
|
||||
}
|
||||
|
||||
is GroupViewHolder -> (getItem(position) as? BookGroup)?.let {
|
||||
holder.registerListener(position)
|
||||
holder.registerListener(it)
|
||||
holder.onBind(it, position, payloads)
|
||||
}
|
||||
}
|
||||
@@ -87,12 +87,12 @@ class BooksAdapterList(context: Context, callBack: CallBack) :
|
||||
}
|
||||
}
|
||||
|
||||
fun registerListener(position: Int) {
|
||||
fun registerListener(item: Any) {
|
||||
binding.root.setOnClickListener {
|
||||
callBack.onItemClick(position)
|
||||
callBack.onItemClick(item)
|
||||
}
|
||||
binding.root.onLongClick {
|
||||
callBack.onItemLongClick(position)
|
||||
callBack.onItemLongClick(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,12 +144,12 @@ class BooksAdapterList(context: Context, callBack: CallBack) :
|
||||
}
|
||||
}
|
||||
|
||||
fun registerListener(position: Int) {
|
||||
fun registerListener(item: Any) {
|
||||
binding.root.setOnClickListener {
|
||||
callBack.onItemClick(position)
|
||||
callBack.onItemClick(item)
|
||||
}
|
||||
binding.root.onLongClick {
|
||||
callBack.onItemLongClick(position)
|
||||
callBack.onItemLongClick(item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,8 +211,8 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemClick(position: Int) {
|
||||
when (val item = booksAdapter.getItem(position)) {
|
||||
override fun onItemClick(item: Any) {
|
||||
when (item) {
|
||||
is Book -> when {
|
||||
item.isAudio ->
|
||||
startActivity<AudioPlayActivity> {
|
||||
@@ -231,8 +231,8 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemLongClick(position: Int) {
|
||||
when (val item = booksAdapter.getItem(position)) {
|
||||
override fun onItemLongClick(item: Any) {
|
||||
when (item) {
|
||||
is Book -> startActivity<BookInfoActivity> {
|
||||
putExtra("name", item.name)
|
||||
putExtra("author", item.author)
|
||||
|
||||
Reference in New Issue
Block a user