1 package com.airbnb.lottie.samples 2 3 import androidx.viewpager.widget.ViewPager 4 5 internal open class OnPageChangeListenerAdapter( 6 private val onPageScrollStateChanged: ((state: Int) -> Unit)? = null, 7 private val onPageScrolled: 8 ((position: Int, positionOffset: Float, positionOffsetPixels: Int) -> Unit)? = null, 9 private val onPageSelected: ((position: Int) -> Unit)? = null 10 ): ViewPager.OnPageChangeListener { onPageScrollStateChangednull11 override fun onPageScrollStateChanged(state: Int) = 12 onPageScrollStateChanged?.invoke(state) ?: Unit 13 14 override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) = 15 onPageScrolled?.invoke(position, positionOffset, positionOffsetPixels) ?: Unit 16 17 override fun onPageSelected(position: Int) = onPageSelected?.invoke(position) ?: Unit 18 }