Skip to content

Instantly share code, notes, and snippets.

View nelletto's full-sized avatar

Ion Catalin Dragomir nelletto

View GitHub Profile
@nelletto
nelletto / SectionAdapter.kt
Last active January 29, 2019 15:00 — forked from raphaelbussa/SectionAdapter.kt
SectionAdapter
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
abstract class SectionAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private val headerPositions: MutableMap<Int, Int> = mutableMapOf()
private val itemPositions: MutableMap<Int, Int> = mutableMapOf()
private val sectionItemPositions: MutableMap<Int, Int> = mutableMapOf()
private var listSize = 0
private var headerSize = 0