daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Jan 19th, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView,
  2.       state: RecyclerView.State?) {
  3.     val position = parent.getChildAdapterPosition(view)
  4.     val adapter = parent.adapter
  5.     if (adapter is EpoxyControllerAdapter) {
  6.       val model = adapter.getModelAtPosition(position)
  7.       //if you are using Epoxy's annotations
  8.       when (model::class.java.superclass) {
  9.         PhotoModel::class.java -> outRect.set(5, 5, 5, 5)
  10.         CollectionModel::class.java -> outRect.set(10, 10, 10, 10)
  11.         else -> outRect.setEmpty()
  12.       }
  13.       //if you are not using Epoxy's annotations
  14.       /*when (model::class) {
  15.         PhotoModel::class -> outRect.set(5, 5, 5, 5)
  16.         CollectionModel::class-> outRect.set(10, 10, 10, 10)
  17.         else -> outRect.setEmpty()
  18.       }*/
  19.     } else {
  20.       outRect.setEmpty()
  21.     }
  22.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top