Skip to content

Instantly share code, notes, and snippets.

import android.content.Context
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.recyclerasyncloadingexample.databinding.LargeItemCellBinding
import com.example.recyclerasyncloadingexample.databinding.SmallItemCellBinding
class RecyclerViewAsyncAdapter internal constructor(private val items: List<TestItem>) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder =
import android.content.Context
import android.view.View
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.FrameLayout
import androidx.asynclayoutinflater.view.AsyncLayoutInflater
open class AsyncCell(context: Context) : FrameLayout(context, null, 0, 0) {
init {
layoutParams = LayoutParams(MATCH_PARENT, WRAP_CONTENT)