This commit is contained in:
Horis
2025-04-09 20:06:37 +08:00
parent fda149811b
commit 2ab7239b26
2 changed files with 4 additions and 12 deletions

View File

@@ -125,7 +125,10 @@ abstract class BaseBooksAdapter<VH : RecyclerView.ViewHolder>(
}
override fun getItemViewType(position: Int): Int {
return callBack.getItemType(position)
if (getItem(position) is BookGroup) {
return 1
}
return 0
}
final override fun onBindViewHolder(holder: VH, position: Int) {}
@@ -135,7 +138,6 @@ abstract class BaseBooksAdapter<VH : RecyclerView.ViewHolder>(
fun onItemClick(position: Int)
fun onItemLongClick(position: Int)
fun isUpdate(bookUrl: String): Boolean
fun getItemType(position: Int): Int
fun getItems(): List<Any>
}
}

View File

@@ -254,16 +254,6 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
}
}
override fun getItemType(position: Int): Int {
if (groupId != BookGroup.IdRoot) {
return 0
}
if (position < bookGroups.size) {
return 1
}
return 0
}
override fun getItems(): List<Any> {
if (groupId != BookGroup.IdRoot) {
return books