package com.base.pdfviewerscannerwhite.ui.set

import android.content.Intent
import android.net.Uri
import androidx.activity.addCallback
import com.base.pdfviewerscannerwhite.databinding.ActivitySetBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity
import com.base.pdfviewerscannerwhite.helper.ConfigHelper
import com.base.pdfviewerscannerwhite.ui.view.RateDialog.showRateDialog

class SetActivity : BaseActivity<ActivitySetBinding>() {

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


    override fun initView() {
    }

    override fun initListener() {
        super.initListener()
        onBackPressedDispatcher.addCallback {
            finishToMain()
        }
        binding.flFanhui.setOnClickListener {
            onBackPressedDispatcher.onBackPressed()
        }
        binding.llRate.setOnClickListener {
            showRateDialog(true)
        }
        binding.llFeedback.setOnClickListener {
            startActivity(Intent(this, FeedbackActivity::class.java))
        }
        binding.llPrivacy.setOnClickListener {
            val intent = Intent(
                Intent.ACTION_VIEW,
                Uri.parse(ConfigHelper.privacyPolicy)
            )
            startActivity(intent)

        }
        binding.llTerm.setOnClickListener {
            val intent = Intent(
                Intent.ACTION_VIEW,
                Uri.parse(ConfigHelper.termService)
            )
            startActivity(intent)
        }
    }

}