package com.mints.goodmoney.ui.activitys

import android.os.Bundle
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.library.utils.ConstantUtil
import kotlinx.android.synthetic.main.activity_aboutus.*
import kotlinx.android.synthetic.main.header_layout.*

/**
 * 描述：关于我们
 * 作者：孟崔广
 * 时间：2020/9/23 18:39
 */
class AboutusActivity : BaseActivity()
        , View.OnClickListener {

    override fun getContentViewLayoutID() = R.layout.activity_aboutus

    override fun isApplyKitKatTranslucency() = false

    override fun initViewsAndEvents() {
        tvAboutasVersion.text = getString(R.string.app_name) + " v" + ConstantUtil.getVersionName(context)
        tv_title.text = "关于我们"
        iv_left_icon.visibility = View.VISIBLE
        iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)

        initListener()
    }

    override fun onClick(v: View?) {

        when (v?.id) {
            R.id.iv_left_icon -> finish()
            R.id.tvAboutasService -> {
                val bundle = Bundle()
                bundle.putString(WebActivity.WEB_TITLE, getString(R.string.register_name))
                bundle.putString(WebActivity.WEB_URL, Constant.REGISTER_URL)
                readyGo(WebActivity::class.java, bundle)
            }
            R.id.tvAboutasPolicy -> {
                val bundle = Bundle()
                bundle.putString(WebActivity.WEB_TITLE, getString(R.string.privacy_name))
                bundle.putString(WebActivity.WEB_URL, Constant.PRIVACY_URL)
                readyGo(WebActivity::class.java, bundle)
            }
        }
    }

    private fun initListener() {
        iv_left_icon.setOnClickListener(this)
        tvAboutasService.setOnClickListener(this)
        tvAboutasPolicy.setOnClickListener(this)
    }
}
