Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView,
- state: RecyclerView.State?) {
- val position = parent.getChildAdapterPosition(view)
- val adapter = parent.adapter
- if (adapter is EpoxyControllerAdapter) {
- val model = adapter.getModelAtPosition(position)
- //if you are using Epoxy's annotations
- when (model::class.java.superclass) {
- PhotoModel::class.java -> outRect.set(5, 5, 5, 5)
- CollectionModel::class.java -> outRect.set(10, 10, 10, 10)
- else -> outRect.setEmpty()
- }
- //if you are not using Epoxy's annotations
- /*when (model::class) {
- PhotoModel::class -> outRect.set(5, 5, 5, 5)
- CollectionModel::class-> outRect.set(10, 10, 10, 10)
- else -> outRect.setEmpty()
- }*/
- } else {
- outRect.setEmpty()
- }
- }
Add Comment
Please, Sign In to add comment