package com.ux.video.file.filerecovery.settings

import android.content.Context
import android.view.LayoutInflater
import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.net.toUri
import com.ux.video.file.filerecovery.R
import com.ux.video.file.filerecovery.base.BaseActivity
import com.ux.video.file.filerecovery.databinding.ActivitySetUpBinding
import com.ux.video.file.filerecovery.utils.Common

class SetupActivity : BaseActivity<ActivitySetUpBinding>() {
    override fun inflateBinding(inflater: LayoutInflater): ActivitySetUpBinding = ActivitySetUpBinding.inflate(layoutInflater)

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

    override fun initData() {
        super.initData()
        binding.run {
            imageViewBack.setOnClickListener { finish() }
            layoutShareApp.setOnClickListener {
                Common.shareApp(this@SetupActivity)
            }
            layoutPrivacyPolicy.setOnClickListener {
                openWebPage(this@SetupActivity,getString(R.string.privacy_policy_url ))
            }
        }
    }
    fun openWebPage(context: Context, url: String) {
        val customTabsIntent = CustomTabsIntent.Builder()
            .setShowTitle(true)
            .build()

        customTabsIntent.launchUrl(context, url.toUri())
    }

}