package com.test.basd.supercleanermax.fragment

import android.content.Intent
import com.blankj.utilcode.util.SPUtils
import com.test.basd.supercleanermax.activity.AppManagerActivity
import com.test.basd.supercleanermax.activity.BatteryInfoActivity
import com.test.basd.supercleanermax.activity.LargeFileCleanActivity
import com.test.basd.supercleanermax.activity.NetWorkActivity
import com.test.basd.supercleanermax.activity.RecentAppActivity
import com.test.basd.supercleanermax.activity.RepeaterdPhotoActivity
import com.test.basd.supercleanermax.activity.ScanJunkActivity
import com.test.basd.supercleanermax.activity.SpeakerCleanerActivity
import com.test.basd.supercleanermax.activity.photocompress.photo.StartCompressionPhotoActivity
import com.test.basd.supercleanermax.adapter.ToolsAdapter
import com.test.basd.supercleanermax.databinding.FragmentLayoutToolsBinding
import com.test.basd.supercleanermax.helps.BaseFragment
import com.test.basd.supercleanermax.helps.ConfigHelper
import com.test.basd.supercleanermax.helps.KotlinExt.toFormatSize
import com.test.basd.supercleanermax.notificationclean.NotificationCleanActivity
import com.test.basd.supercleanermax.notificationclean.NotificationGuestActivity
import com.test.basd.supercleanermax.view.AFunOb
import com.test.basd.supercleanermax.view.AFunOb.APP_MANAGER
import com.test.basd.supercleanermax.view.AFunOb.BATTERY_INFO
import com.test.basd.supercleanermax.view.AFunOb.LARGE_FILE_CLEANER
import com.test.basd.supercleanermax.view.AFunOb.NETWORK_TRAFFIC
import com.test.basd.supercleanermax.view.AFunOb.NOTIFICATION_CLEANER
import com.test.basd.supercleanermax.view.AFunOb.PHOTO_COMPRESS
import com.test.basd.supercleanermax.view.AFunOb.RECENT_APP_USAGE
import com.test.basd.supercleanermax.view.AFunOb.SIMILAR_PHOTOS
import com.test.basd.supercleanermax.view.AFunOb.SPEAK_CLEANER

class ToolsFragment : BaseFragment<FragmentLayoutToolsBinding>() {
    private lateinit var adapter: ToolsAdapter

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

    override fun setView() {
        adapter = ToolsAdapter(requireActivity()) { kName ->
            when (kName) {
                AFunOb.JUNK_CLEANER -> {
                    startActivity(Intent(requireContext(), ScanJunkActivity::class.java))
                }

                RECENT_APP_USAGE -> {
                    startActivity(Intent(requireActivity(), RecentAppActivity::class.java))
                }

                LARGE_FILE_CLEANER -> {
                    startActivity(Intent(requireContext(), LargeFileCleanActivity::class.java))
                }

                NOTIFICATION_CLEANER -> {
                    startActivity(Intent(requireActivity(), NotificationGuestActivity::class.java))
                }

                NETWORK_TRAFFIC -> {
                    startActivity(Intent(requireContext(), NetWorkActivity::class.java))
                }

                APP_MANAGER -> {
                    startActivity(Intent(requireContext(), AppManagerActivity::class.java))
                }

                SIMILAR_PHOTOS -> {
                    startActivity(Intent(requireContext(), RepeaterdPhotoActivity::class.java))
                }

                SPEAK_CLEANER -> {
                    startActivity(Intent(requireContext(), SpeakerCleanerActivity::class.java))
                }

                PHOTO_COMPRESS -> {
                    startActivity(Intent(requireActivity(), StartCompressionPhotoActivity::class.java))
                }

                BATTERY_INFO -> {
                    startActivity(Intent(requireActivity(), BatteryInfoActivity::class.java))
                }

            }
        }
        binding.rvTools.adapter = adapter

    }

    override fun onResume() {
        super.onResume()
        val split = ConfigHelper.junkSizeClean.toFormatSize(1).split(' ')
    }
}