package com.base.datarecovery.fragment

import android.content.Intent
import com.base.datarecovery.activity.photomanager.PhotoManagerAnimationActivity
import com.base.datarecovery.activity.privacyspace.PrivacyPinOneActivity
import com.base.datarecovery.activity.privacyspace.PrivacySpaceActivity
import com.base.datarecovery.activity.recovery.FileScanResultActivity
import com.base.datarecovery.ads.AdmobMaxHelper
import com.base.datarecovery.bean.ConstObject
import com.base.datarecovery.databinding.FragmentRecoveryBinding
import com.base.datarecovery.help.BaseFragment


class RecoveryFragment : BaseFragment<FragmentRecoveryBinding>() {

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


    override fun setView() {
    }

    override fun setListener() {
        super.setListener()
        binding.flRyPhoto.setOnClickListener {
            startActivity(Intent(requireContext(), FileScanResultActivity::class.java).apply {
                putExtra("ScanType", ConstObject.SCAN_PHOTOS)
            })
        }
        binding.flRyVideo.setOnClickListener {
            startActivity(Intent(requireContext(), FileScanResultActivity::class.java).apply {
                putExtra("ScanType", ConstObject.SCAN_VIDEOS)
            })
        }
        binding.cardRyDocument.setOnClickListener {
            startActivity(Intent(requireContext(), FileScanResultActivity::class.java).apply {
                putExtra("ScanType", ConstObject.SCAN_DOCUMENTS)
            })
        }
        binding.cardRyAudio.setOnClickListener {
            startActivity(Intent(requireContext(), FileScanResultActivity::class.java).apply {
                putExtra("ScanType", ConstObject.SCAN_AUDIOS)
            })
        }
        binding.cardPrivacySpace.setOnClickListener {
            if (ConstObject.privacyPinPassword.isNotEmpty()) {
                startActivity(Intent(requireContext(), PrivacyPinOneActivity::class.java))
            } else {
                startActivity(Intent(requireContext(), PrivacySpaceActivity::class.java).apply {

                })
            }
        }
        binding.cardPhotosManager.setOnClickListener {
            startActivity(Intent(requireContext(), PhotoManagerAnimationActivity::class.java))
        }

    }

    override fun onResume() {
        super.onResume()
        AdmobMaxHelper.admobMaxShowNativeAd(requireActivity(), binding.flAd, 2)
    }

}