package com.adealink.weparty.wallet.coin

import androidx.appcompat.widget.LinearLayoutCompat
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.updateLayoutParams
import com.adealink.frame.aab.util.getCompatDimension
import com.adealink.frame.mvvm.view.viewBinding
import com.adealink.frame.router.Router
import com.adealink.frame.router.annotation.RouterUri
import com.adealink.frame.util.onClick
import com.adealink.frame.util.statusBarHeight
import com.adealink.weparty.commonui.BaseActivity
import com.adealink.weparty.module.wallet.Wallet
import com.adealink.weparty.wallet.databinding.ActivityCoinBinding
import com.adealink.weparty.R as APP_R

@RouterUri(
        path = [Wallet.Coin.PATH],
        desc = "金币首页"
        )
        class CoinActivity : BaseActivity() {

            private val binding by viewBinding(ActivityCoinBinding::inflate)

            override fun onBeforeCreate() {
        super.onBeforeCreate()
        Router.bind(this)
    }

    override fun initViews() {
        super.initViews()
        setContentView(binding.root)
        val statusBarHeight = this@CoinActivity.statusBarHeight()
        binding.topBar.root.updateLayoutParams<ConstraintLayout.LayoutParams> {
            height = statusBarHeight
        }
        binding.vCoinCard.root.updateLayoutParams<LinearLayoutCompat.LayoutParams> {
            height = statusBarHeight + getCompatDimension(APP_R.dimen.common_top_bar_height).toInt()
        }
        binding.topBar.btnBack.onClick {
            finish()
        }
    }

    override fun initComponents() {
        super.initComponents()

    }

    override fun onResume() {
        super.onResume()
    }

    private fun goDetail() {
        Router.build(this, Wallet.Detail.PATH).start()
    }

}