package com.base.filerecoveryrecyclebin.fragment

import android.animation.ValueAnimator
import android.content.Intent
import com.base.filerecoveryrecyclebin.activity.SettingActivity
import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
import com.base.filerecoveryrecyclebin.activity.photomanager.PhotoManagerActivity
import com.base.filerecoveryrecyclebin.activity.photomanager.PhotoManagerAnimationActivity
import com.base.filerecoveryrecyclebin.activity.recovery.FileScanResultActivity
import com.base.filerecoveryrecyclebin.activity.vip.VipActivity
import com.base.filerecoveryrecyclebin.activity.whatsapp.WhatsAppCleanerAnimationActivity
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.tvTitle.text = "Dumpster"
        binding.lottie.repeatCount = ValueAnimator.INFINITE
    }

    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.cardPhotoManager.setOnClickListener {
            startActivity(Intent(requireContext(), PhotoManagerAnimationActivity::class.java))
        }

        binding.cardWhatsapp.setOnClickListener {
            startActivity(Intent(requireContext(), WhatsAppCleanerAnimationActivity::class.java))
        }
        binding.flSetting.setOnClickListener {
            startActivity(Intent(requireContext(), SettingActivity::class.java))
        }
        binding.ivVip.setOnClickListener {
            startActivity(Intent(requireContext(), VipActivity::class.java))
        }
    }


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

    }

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

}