package com.cheng.bole.ui.fragment.mine.about

import android.annotation.SuppressLint
import com.example.base.extensions.onClick
import com.example.base.ui.BaseFragment
import com.example.base.utils.AppUtils
import com.cheng.bole.databinding.FragmentAboutBinding
import com.cheng.bole.ui.dialog.PopupDialog
import com.cheng.bole.utils.ChannelUtils
import com.cheng.bole.utils.UrlHelper
import org.jetbrains.anko.sdk27.listeners.onLongClick

class AboutFragment : BaseFragment<FragmentAboutBinding, AboutViewModel>() {
    @SuppressLint("SetTextI18n")
    override fun initView() {
        super.initView()
        mTitleBar?.background = null

        binding.tvVersionName.text = "版本号：${AppUtils.getAppVersionName()}"

        if (ChannelUtils.getChannel() == "huawei") {
            binding.tvAppName.text = AppUtils.getAppName()
        }
    }

    override fun initListener() {
        super.initListener()
        binding.ivIco.onLongClick {
            PopupDialog.showAboutTip(requireContext(),binding.ivIco)
            false
        }
        binding.tvAgreement.onClick {
            UrlHelper.startUserAgreement(requireContext())
        }
        binding.tvPolicy.onClick {
            UrlHelper.startPrivacyPolicy(requireContext())
        }
    }
}