<commit_before>package org.ccci.gto.android.common.recyclerview.adapter

import android.view.ViewGroup
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.LifecycleOwner
import androidx.recyclerview.widget.RecyclerView
import com.karumi.weak.weak

abstract class SimpleDataBindingAdapter<B : ViewDataBinding>(lifecycleOwner: LifecycleOwner? = null) :
    RecyclerView.Adapter<DataBindingViewHolder<B>>() {
    private val lifecycleOwner: LifecycleOwner? by weak(lifecycleOwner)

    // region Lifecycle

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
        onCreateViewDataBinding(parent, viewType)
            .also { it.lifecycleOwner = lifecycleOwner }
            .let { DataBindingViewHolder(it) }

    override fun onBindViewHolder(holder: DataBindingViewHolder<B>, position: Int) {
        onBindViewDataBinding(holder.binding, position)
        holder.binding.executePendingBindings()
    }

    protected abstract fun onCreateViewDataBinding(parent: ViewGroup, viewType: Int): B
    protected abstract fun onBindViewDataBinding(binding: B, position: Int)
    override fun onViewRecycled(holder: DataBindingViewHolder<B>) = onViewDataBindingRecycled(holder.binding)
    protected open fun onViewDataBindingRecycled(binding: B) = Unit

    // end Lifecycle
}<commit_msg>no need to specify the type here<commit_after>package org.ccci.gto.android.common.recyclerview.adapter

import android.view.ViewGroup
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.LifecycleOwner
import androidx.recyclerview.widget.RecyclerView
import com.karumi.weak.weak

abstract class SimpleDataBindingAdapter<B : ViewDataBinding>(lifecycleOwner: LifecycleOwner? = null) :
    RecyclerView.Adapter<DataBindingViewHolder<B>>() {
    private val lifecycleOwner by weak(lifecycleOwner)

    // region Lifecycle

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
        onCreateViewDataBinding(parent, viewType)
            .also { it.lifecycleOwner = lifecycleOwner }
            .let { DataBindingViewHolder(it) }

    override fun onBindViewHolder(holder: DataBindingViewHolder<B>, position: Int) {
        onBindViewDataBinding(holder.binding, position)
        holder.binding.executePendingBindings()
    }

    protected abstract fun onCreateViewDataBinding(parent: ViewGroup, viewType: Int): B
    protected abstract fun onBindViewDataBinding(binding: B, position: Int)
    override fun onViewRecycled(holder: DataBindingViewHolder<B>) = onViewDataBindingRecycled(holder.binding)
    protected open fun onViewDataBindingRecycled(binding: B) = Unit

    // end Lifecycle
}
{'fraction_non_alphanumeric': 0.0801209372637944, 'fraction_numerical': 0.0, 'mean_word_length': 4.8822222222222225, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4447588', 'n_tokens_mistral': 753, 'n_tokens_neox': 726, 'n_words': 159}