package pxds.etmo

import android.content.Intent
import android.graphics.Color
import androidx.activity.OnBackPressedCallback
import androidx.core.view.updatePadding
import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.SPUtils
import com.test.basd.supercleanermax.R
import com.test.basd.supercleanermax.databinding.KcsutcBinding
import fsir.tqqe.Ausa
import pxds.apch.ldfl.lijc.Xxkn
import pxds.dlpf.buoz.fico.Dsce.APP_MANAGER
import pxds.dlpf.buoz.fico.Dsce.BATTERY_INFO
import pxds.dlpf.buoz.fico.Dsce.EMPTY_FILE_CLEANER
import pxds.dlpf.buoz.fico.Dsce.JUNK_CLEANER
import pxds.dlpf.buoz.fico.Dsce.LARGE_FILE_CLEANER
import pxds.dlpf.buoz.fico.Dsce.NETWORK_TRAFFIC
import pxds.dlpf.buoz.fico.Dsce.NOTIFICATION_CLEANER
import pxds.dlpf.buoz.fico.Dsce.PHOTO_COMPRESS
import pxds.dlpf.buoz.fico.Dsce.RECENT_APP_USAGE
import pxds.dlpf.buoz.fico.Dsce.SIMILAR_PHOTOS
import pxds.hpls.xkxo.Obzz
import pxds.lmmd.zmwf.Bpfw
import pxds.lmmd.zmwf.Khko.setTrackedOnClickListener
import pxds.lmmd.zmwf.Khko.string
import pxds.lmmd.zmwf.Khko.toFormatSize

class Iqnb : Bpfw<KcsutcBinding>() {

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

    private lateinit var adapter: Obzz

    override fun initView() {
        BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
        binding.iwztrba.updatePadding(top = BarUtils.getStatusBarHeight())
        adapter = Obzz {
            when (it) {
                JUNK_CLEANER -> {
                    startActivity(Intent(this, Vryl::class.java))
                }

                RECENT_APP_USAGE -> {
                    startActivity(Intent(this, Ngma::class.java))
                }

                LARGE_FILE_CLEANER -> {
                    startActivity(Intent(this, Ozev::class.java))
                }

                NOTIFICATION_CLEANER -> {
                    startActivity(Intent(this, Xxkn::class.java))
                }

                NETWORK_TRAFFIC -> {
                    startActivity(Intent(this, Ffhe::class.java))
                }

                APP_MANAGER -> {
                    startActivity(Intent(this, Jmyh::class.java))
                }

                BATTERY_INFO -> {
                    startActivity(Intent(this, Jmut::class.java))
                }

                SIMILAR_PHOTOS -> {
                    startActivity(Intent(this, Fjda::class.java))
                }

                PHOTO_COMPRESS -> {
                    startActivity(Intent(this, Ausa::class.java))
                }

            }

            finish()
        }
        binding.zhzxzfx.adapter = adapter
        adapter.updateListPosition()
        adapter.notifyDataSetChanged()
        val wenBen = intent.getStringExtra(R.string.ޚޟބޙޞ_D.string())
        binding.xvpmznl.text = wenBen

        val from = intent.getStringExtra(R.string.ޣޟމޅކ_D.string())
        when (from) {
            JUNK_CLEANER -> {
                if (intent.getLongExtra(R.string.ޠޜޚސޙ_D.string(), 0L) > 0) {
                    binding.xvpmznl.text = "Cleaned up ${intent.getLongExtra(R.string.ޠޜޚސޙ_D.string(), 0L).toFormatSize(1)}"
                } else {
                    binding.xvpmznl.text = R.string.ހޖޣޒޏ_D.string()
                }
                SPUtils.getInstance().put(R.string.ޞލޙޤޠ_D.string(), System.currentTimeMillis())

            }

            RECENT_APP_USAGE -> {
                binding.xvpmznl.text = ""
            }

            LARGE_FILE_CLEANER -> {
                binding.xvpmznl.text = ""
            }

            NOTIFICATION_CLEANER -> {
                binding.xvpmznl.text = ""
            }

            NETWORK_TRAFFIC -> {
                binding.xvpmznl.text = ""
            }

            APP_MANAGER -> {
                binding.xvpmznl.text = ""
            }

            BATTERY_INFO -> {
                binding.xvpmznl.text = R.string.ލޖއމޅ_D.string()
                SPUtils.getInstance().put(R.string.ޑޑޘޒޞ_D.string(), System.currentTimeMillis())
            }

            EMPTY_FILE_CLEANER -> {
                binding.xvpmznl.text = ""
            }

            PHOTO_COMPRESS -> {
                binding.xvpmznl.text = R.string.ޖދޞށޏ_D.string((intent.getIntExtra("num", 0)).toString()) +
                            R.string.ހޟޘޖބ_D.string((intent.getLongExtra("size", 0L).toFormatSize(1)).toString())
            }
            else -> {}
        }
        from?.let {
            binding.xijyvon.text = it
            adapter.removeItem(it)
        }

        onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
            override fun handleOnBackPressed() {
                finishToMain()

            }

        })
        binding.kgxhrze.setTrackedOnClickListener {
            finishToMain()
        }

    }

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

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