package rowedto.jockeyedto.sheetedto.atticedto.roleedto.verticaledto.routeedto

import android.graphics.Color
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.base.datarecovery.R
import com.base.datarecovery.databinding.PensionedtoBinding
import com.zhpan.indicator.enums.IndicatorSlideMode
import com.zhpan.indicator.enums.IndicatorStyle
import rowedto.jockeyedto.sheetedto.knewedto.economicedto.copyrightedto.Crossingedto
import rowedto.jockeyedto.sheetedto.raceedto.pavementedto.Spareedto
import rowedto.jockeyedto.sheetedto.slideedto.Yesedto
import rowedto.jockeyedto.sheetedto.strangeedto.pyramidedto.particlesedto.Scandaledto

class Sailedto : Crossingedto<PensionedtoBinding>() {

    private val page1: Yesedto by lazy {
        Yesedto().apply { page = 1 }
    }
    private val page2: Yesedto by lazy {
        Yesedto().apply { page = 2 }
    }
    private val fragments by lazy {
        mutableListOf(page1, page2)
    }


    override val binding: PensionedtoBinding by lazy {
        PensionedtoBinding.inflate(layoutInflater)
    }

    fun setPosition(position: Int) {
        binding.guiltedto.currentItem = position
    }


    override fun initView() {
        Spareedto.setStatusBarLightMode(this, true)
        Spareedto.setStatusBarColor(this, Color.TRANSPARENT)
        Scandaledto.admobMaxShowNativeAd(this,binding.tooledto,1)
        binding.guiltedto.run {
            adapter = object : FragmentStateAdapter(this@Sailedto) {
                override fun getItemCount(): Int {
                    return fragments.size
                }

                override fun createFragment(position: Int): Fragment {
                    return fragments[position]
                }
            }
        }
        binding.guiltedto.registerOnPageChangeCallback(object :
            ViewPager2.OnPageChangeCallback() {
            override fun onPageSelected(position: Int) {
            }
        })

        val normalColor = ContextCompat.getColor(this, R.color.fabricateedto)
        val selectedColor = ContextCompat.getColor(this, R.color.clarifyedto)
        binding.mysteryedto
            .setSliderColor(normalColor, selectedColor)
            .setSliderWidth(resources.getDimension(R.dimen.heartedto))
            .setSliderHeight(resources.getDimension(R.dimen.heartedto))
            .setSlideMode(IndicatorSlideMode.WORM)
            .setIndicatorStyle(IndicatorStyle.CIRCLE)
            .setupWithViewPager(binding.guiltedto)
    }

}