优化
This commit is contained in:
@@ -125,7 +125,10 @@ abstract class BaseBooksAdapter<VH : RecyclerView.ViewHolder>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemViewType(position: Int): Int {
|
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) {}
|
final override fun onBindViewHolder(holder: VH, position: Int) {}
|
||||||
@@ -135,7 +138,6 @@ abstract class BaseBooksAdapter<VH : RecyclerView.ViewHolder>(
|
|||||||
fun onItemClick(position: Int)
|
fun onItemClick(position: Int)
|
||||||
fun onItemLongClick(position: Int)
|
fun onItemLongClick(position: Int)
|
||||||
fun isUpdate(bookUrl: String): Boolean
|
fun isUpdate(bookUrl: String): Boolean
|
||||||
fun getItemType(position: Int): Int
|
|
||||||
fun getItems(): List<Any>
|
fun getItems(): List<Any>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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> {
|
override fun getItems(): List<Any> {
|
||||||
if (groupId != BookGroup.IdRoot) {
|
if (groupId != BookGroup.IdRoot) {
|
||||||
return books
|
return books
|
||||||
|
|||||||
Reference in New Issue
Block a user