package com.base.locationsharewhite.ui.howuse

import android.graphics.Color
import androidx.core.view.updatePadding
import androidx.viewpager2.widget.MarginPageTransformer
import com.base.locationsharewhite.R
import com.base.locationsharewhite.bean.BannerBean
import com.base.locationsharewhite.databinding.ActivityHowUseShareBinding
import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.utils.BarUtils
import com.youth.banner.util.BannerUtils

class HowUseShareActivity : BaseActivity<ActivityHowUseShareBinding>() {

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

    private lateinit var adapter: ImageBannerAdapter
    override fun initView() {
        BarUtils.setStatusBarLightMode(this, true)
        BarUtils.setStatusBarColor(this, Color.WHITE)
        binding.root.updatePadding(top = BarUtils.getStatusBarHeight())

        initBanner()
    }

    private fun initBanner() {
        adapter = ImageBannerAdapter(
            listOf(
                BannerBean(R.mipmap.how_share_tu1),
                BannerBean(R.mipmap.how_share_tu2)
            )
        )
        binding.banner.setAdapter(adapter)
        binding.banner.isAutoLoop(false)

        binding.banner.addBannerLifecycleObserver(this)
        binding.banner.setIndicator(binding.indicator, false)
        binding.banner.setPageTransformer(MarginPageTransformer(BannerUtils.dp2px(10f)))
        binding.indicator.indicatorConfig.height = resources.getDimensionPixelSize(R.dimen.dp_5)
        binding.indicator.indicatorConfig.selectedWidth = resources.getDimensionPixelSize(R.dimen.dp_25)
        binding.indicator.indicatorConfig.normalWidth = resources.getDimensionPixelSize(R.dimen.dp_5)

    }

    fun step1ui() {
        binding.tvStep.text = resources.getString(R.string.how_share_location_step_1)
        binding.banner
    }

    fun step2ui() {
        binding.tvStep.text = resources.getString(R.string.how_share_location_step_2)
    }
}