package importantedto.appliededto.surgeonedto.promiseedto.forthedto

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.StrikebreakeredtoBinding
import com.zhpan.indicator.enums.IndicatorSlideMode
import com.zhpan.indicator.enums.IndicatorStyle
import importantedto.afteredto.constitutionaledto.Murderedto
import importantedto.candidateedto.Correctedto
import importantedto.gallonedto.Transcendedto

class Appearanceedto : Murderedto<StrikebreakeredtoBinding>() {

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


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

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


    override fun initView() {
        Transcendedto.setStatusBarLightMode(this, true)
        Transcendedto.setStatusBarColor(this, Color.TRANSPARENT)

        binding.relatededto.run {
            adapter = object : FragmentStateAdapter(this@Appearanceedto) {
                override fun getItemCount(): Int {
                    return fragments.size
                }

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

        val normalColor = ContextCompat.getColor(this, R.color.lawedto)
        val selectedColor = ContextCompat.getColor(this, R.color.boatedto)
        binding.applicationedto
            .setSliderColor(normalColor, selectedColor)
            .setSliderWidth(resources.getDimension(R.dimen.unanimousedto))
            .setSliderHeight(resources.getDimension(R.dimen.unanimousedto))
            .setSlideMode(IndicatorSlideMode.WORM)
            .setIndicatorStyle(IndicatorStyle.CIRCLE)
            .setupWithViewPager(binding.relatededto)
    }

}