<commit_before>package net.squanchy.schedule.view

import android.content.Context
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.LinearSmoothScroller
import android.support.v7.widget.RecyclerView
import android.util.AttributeSet
import net.squanchy.R
import net.squanchy.schedule.domain.view.Event
import net.squanchy.support.view.CardSpacingItemDecorator
import net.squanchy.support.view.setAdapterIfNone

class ScheduleDayPageView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet,
    defStyle: Int = 0
) : RecyclerView(context, attrs, defStyle) {

    private lateinit var adapter: EventsAdapter

    override fun onFinishInflate() {
        super.onFinishInflate()

        val layoutManager = SnappingLinearLayoutManager(context)
        setLayoutManager(layoutManager)
        adapter = EventsAdapter(context)

        val horizontalSpacing = resources.getDimensionPixelSize(R.dimen.card_horizontal_margin)
        val verticalSpacing = resources.getDimensionPixelSize(R.dimen.card_vertical_margin)
        addItemDecoration(CardSpacingItemDecorator(horizontalSpacing, verticalSpacing))
    }

    fun updateWith(newData: List<Event>, listener: (Event) -> Unit) {
        setAdapterIfNone(adapter.apply { eventClickListener = listener })
        adapter.submitList(newData)
    }

    private var userHasScrolled: Boolean = false

    override fun onScrolled(dx: Int, dy: Int) {
        userHasScrolled = true
        super.onScrolled(dx, dy)
    }

    fun autoscrollToEvent(eventPosition: Int, animate: Boolean) {<commit_msg>Extract listener setting to its own line for clarity<commit_after>package net.squanchy.schedule.view

import android.content.Context
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.LinearSmoothScroller
import android.support.v7.widget.RecyclerView
import android.util.AttributeSet
import net.squanchy.R
import net.squanchy.schedule.domain.view.Event
import net.squanchy.support.view.CardSpacingItemDecorator
import net.squanchy.support.view.setAdapterIfNone

class ScheduleDayPageView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet,
    defStyle: Int = 0
) : RecyclerView(context, attrs, defStyle) {

    private lateinit var adapter: EventsAdapter

    override fun onFinishInflate() {
        super.onFinishInflate()

        val layoutManager = SnappingLinearLayoutManager(context)
        setLayoutManager(layoutManager)
        adapter = EventsAdapter(context)

        val horizontalSpacing = resources.getDimensionPixelSize(R.dimen.card_horizontal_margin)
        val verticalSpacing = resources.getDimensionPixelSize(R.dimen.card_vertical_margin)
        addItemDecoration(CardSpacingItemDecorator(horizontalSpacing, verticalSpacing))
    }

    fun updateWith(newData: List<Event>, listener: (Event) -> Unit) {
        adapter.eventClickListener = listener
        setAdapterIfNone(adapter)
        adapter.submitList(newData)
    }

    private var userHasScrolled: Boolean = false

    override fun onScrolled(dx: Int, dy: Int) {
        userHasScrolled = true
        super.onScrolled(dx, dy)
    }

    fun autoscrollToEvent(eventPosition: Int, animate: Boolean) {
{'fraction_non_alphanumeric': 0.0778498609823911, 'fraction_numerical': 0.002471424158171146, 'mean_word_length': 4.299509001636661, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '258360', 'n_tokens_mistral': 946, 'n_tokens_neox': 902, 'n_words': 182}