pull/1198/head
gedoor 3 years ago
parent e4cf02fca7
commit 3d34edf4e6
  1. 28
      app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterGrid.kt
  2. 34
      app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BooksAdapterList.kt

@ -54,27 +54,23 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) :
private fun onBindGroup(binding: ItemBookshelfGridGroupBinding, position: Int, bundle: Bundle) { private fun onBindGroup(binding: ItemBookshelfGridGroupBinding, position: Int, bundle: Bundle) {
binding.run { binding.run {
val item = callBack.getItem(position) val item = callBack.getItem(position) as BookGroup
if (item is BookGroup) { tvName.text = item.groupName
tvName.text = item.groupName
}
} }
} }
private fun onBindBook(binding: ItemBookshelfGridBinding, position: Int, bundle: Bundle) { private fun onBindBook(binding: ItemBookshelfGridBinding, position: Int, bundle: Bundle) {
binding.run { binding.run {
val item = callBack.getItem(position) val item = callBack.getItem(position) as Book
if (item is Book) { bundle.keySet().forEach {
bundle.keySet().forEach { when (it) {
when (it) { "name" -> tvName.text = item.name
"name" -> tvName.text = item.name "cover" -> ivCover.load(
"cover" -> ivCover.load( item.getDisplayCover(),
item.getDisplayCover(), item.name,
item.name, item.author
item.author )
) "refresh" -> upRefresh(this, item)
"refresh" -> upRefresh(this, item)
}
} }
} }
} }

@ -53,30 +53,26 @@ class BooksAdapterList(context: Context, callBack: CallBack) :
private fun onBindGroup(binding: ItemBookshelfListGroupBinding, position: Int, bundle: Bundle) { private fun onBindGroup(binding: ItemBookshelfListGroupBinding, position: Int, bundle: Bundle) {
binding.run { binding.run {
val item = callBack.getItem(position) val item = callBack.getItem(position) as BookGroup
if (item is BookGroup) { tvName.text = item.groupName
tvName.text = item.groupName
}
} }
} }
private fun onBindBook(binding: ItemBookshelfListBinding, position: Int, bundle: Bundle) { private fun onBindBook(binding: ItemBookshelfListBinding, position: Int, bundle: Bundle) {
binding.run { binding.run {
val item = callBack.getItem(position) val item = callBack.getItem(position) as Book
if (item is Book) { tvRead.text = item.durChapterTitle
tvRead.text = item.durChapterTitle tvLast.text = item.latestChapterTitle
tvLast.text = item.latestChapterTitle bundle.keySet().forEach {
bundle.keySet().forEach { when (it) {
when (it) { "name" -> tvName.text = item.name
"name" -> tvName.text = item.name "author" -> tvAuthor.text = item.author
"author" -> tvAuthor.text = item.author "cover" -> ivCover.load(
"cover" -> ivCover.load( item.getDisplayCover(),
item.getDisplayCover(), item.name,
item.name, item.author
item.author )
) "refresh" -> upRefresh(this, item)
"refresh" -> upRefresh(this, item)
}
} }
} }
} }

Loading…
Cancel
Save