package rowedto.jockeyedto.sheetedto.slideedto

import android.annotation.SuppressLint
import android.content.Intent
import com.base.datarecovery.R
import com.base.datarecovery.databinding.MatureedtoBinding
import rowedto.jockeyedto.sheetedto.atticedto.Moneyedto
import rowedto.jockeyedto.sheetedto.atticedto.roleedto.verticaledto.routeedto.Sailedto
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.isGuide
import rowedto.jockeyedto.sheetedto.knewedto.economicedto.copyrightedto.Aloofedto
import rowedto.jockeyedto.sheetedto.raceedto.pavementedto.Stewardedto
import rowedto.jockeyedto.sheetedto.strangeedto.pyramidedto.particlesedto.Scandaledto

class Yesedto constructor() : Aloofedto<MatureedtoBinding>() {

    var page: Int = 1

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


    @SuppressLint("SetTextI18n")
    override fun setView() {
        if (page == 1) {
            binding.shiftedto.setImageResource(R.mipmap.retireedto)
            binding.attractedto.text = "All Free"
            binding.recordingedto.text = "Next"
//            binding.canaledto.visibility = View.VISIBLE
        } else {
            binding.shiftedto.setImageResource(R.mipmap.gallonedto)
            binding.attractedto.text = "Effective recovery"
            binding.recordingedto.text = "Start"
//            binding.canaledto.visibility = View.GONE
        }
    }

    override fun setListener() {
        super.setListener()
        binding.recordingedto.setOnClickListener {
            if (page == 1) {
                (requireActivity() as Sailedto).setPosition(1)
            } else {
                jumpMain()
            }
        }
        binding.canaledto.setOnClickListener {
            jumpMain()
        }
    }

    private fun jumpMain() {
        val showAd = Stewardedto.getInstance().getString("isShowGuideAd", "0")?.toInt()
        if (showAd == 1) {
            Scandaledto.admobMaxShowInterstitialAd(requireActivity(),false) {
                startActivity(Intent(requireContext(), Moneyedto::class.java))
                requireActivity().finish()
                isGuide = true
            }
        } else {
            startActivity(Intent(requireContext(), Moneyedto::class.java))
            requireActivity().finish()
            isGuide = true
        }
    }
}