package com.zxbw.modulemain.activity

import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import com.zxbw.modulemain.R
import com.zxbw.modulemain.adapter.RechargeAdapter
import com.zxbw.modulemain.contract.RechargeContract
import com.zxbw.modulemain.presenter.RechargePresenter
import com.zxbw.modulemain.view.DialogUtils
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.net.model.qy.RightsDetailEntity
import com.zxhl.cms.utils.OnRecycleItemClickListener
import kotlinx.android.synthetic.main.activity_layout_recharge.*

//话费充值页面
class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<RightsDetailEntity>,
    RechargeContract.View {
    private var mAdapter: RechargeAdapter? = null
    private var mPresenter: RechargePresenter? = null
    override fun onClick(v: View?) {
        when (v) {
            id_tv_select_coupons -> {
                DialogUtils.showFetchAllCard(this, object : DialogUtils.OnFetchCardListener {
                    override fun onSelectCoupons() {
                    }
                })
            }
        }
    }

    override fun before() {
        super.before()
        setStatusBarBackground(AppContext.get().resources.getColor(R.color.transparent))
    }

    override fun layoutID(): Int {
        return R.layout.activity_layout_recharge
    }

    override fun init() {
        val user = SettingPreference.getUserInfoData()
        mPresenter = RechargePresenter(this)
        mAdapter = RechargeAdapter(this, this)
        id_rl_recharge?.layoutManager = GridLayoutManager(this, 3)
        id_rl_recharge?.adapter = mAdapter
        mPresenter?.getFetchCard(user.nickname)
    }

    override fun onItemClick(view: View?, position: Int, data: RightsDetailEntity?) {

    }

    override fun setData() {

    }
}