package com.base.filerecoveryrecyclebin.fragment

import android.animation.ValueAnimator
import android.content.Intent
import com.base.filerecoveryrecyclebin.activity.SettingActivity
import com.base.filerecoveryrecyclebin.activity.recovery.FileScanResultActivity
import com.base.filerecoveryrecyclebin.activity.repeat.RepeatAnimationActivity
import com.base.filerecoveryrecyclebin.activity.screenshot.ScreenShotAnimationActivity
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_AUDIOS
import com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_DOCUMENTS
import com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_PHOTOS
import com.base.filerecoveryrecyclebin.bean.ConstObject.SCAN_VIDEOS
import com.base.filerecoveryrecyclebin.databinding.FragmentHome3Binding
import com.base.filerecoveryrecyclebin.help.BaseFragment

class HomeFragment : BaseFragment<FragmentHome3Binding>() {

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

    override fun setView() {
        binding.lottie.repeatCount = ValueAnimator.INFINITE
        AdmobMaxHelper.admobMaxShowNativeAd(requireActivity(), binding.flAd, 0)
    }

    override fun setListener() {
        binding.flScan.setOnClickListener {
            startActivity(Intent(requireContext(), ScanJunkActivity::class.java))
//            sendNotification(requireContext(), ConstObject.ID_SCREENSHOT_CLEAN)
        }
        binding.cardRyPhotos.setOnClickListener {
            startActivity(Intent(requireContext(), FileScanResultActivity::class.java).apply {
                putExtra("ScanType", SCAN_PHOTOS)
            })
        }
        binding.cardRyVideos.setOnClickListener {
            startActivity(Intent(requireContext(), FileScanResultActivity::class.java).apply {
                putExtra("ScanType", SCAN_VIDEOS)
            })
        }
        binding.cardRyDocuments.setOnClickListener {
            startActivity(Intent(requireContext(), FileScanResultActivity::class.java).apply {
                putExtra("ScanType", SCAN_DOCUMENTS)
            })
        }
        binding.cardRyAudios.setOnClickListener {
            startActivity(Intent(requireContext(), FileScanResultActivity::class.java).apply {
                putExtra("ScanType", SCAN_AUDIOS)
            })
        }

        binding.cardScreenshot.setOnClickListener {
            startActivity(Intent(requireContext(), ScreenShotAnimationActivity::class.java))
        }
        binding.cardRepeatPhotos.setOnClickListener {
            startActivity(Intent(requireContext(), RepeatAnimationActivity::class.java))
        }
        binding.flSetting.setOnClickListener {
            startActivity(Intent(requireContext(), SettingActivity::class.java))
        }
    }


    override fun onPause() {
        super.onPause()
        binding.lottie.cancelAnimation()

    }

    override fun onResume() {
        super.onResume()
        binding.lottie.playAnimation()
    }

}