package aicg.wipf.keyu.bzsb

import aicg.wipf.ogbw.ezlb.rgmw.Tefx
import aicg.wipf.vzuj.Hqlm
import aicg.wipf.vzuj.Kmqp.setTrackedOnClickListener
import aicg.wipf.vzuj.Kmqp.string
import aicg.wipf.vzuj.Qqmq
import aicg.wipf.vzuj.Tgsx
import aicg.wipf.vzuj.bcxo.Fnpc
import android.graphics.Color
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.activity.OnBackPressedCallback
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.FileUtils
import com.blankj.utilcode.util.ToastUtils
import com.bumptech.glide.Glide
import com.test.basd.smartjunkcleaner.R
import com.test.basd.smartjunkcleaner.databinding.KcoadqBinding

class Zuhx: Hqlm<KcoadqBinding>() {

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

    private var fileList = mutableListOf<Tefx>()

    private var isSelectAll = false

    private val mAdapter by lazy {
        class ޕޣކދޝގޣވ<T>(val ޔޛޠޢހބޟޝ: T, val ޖށޕޔގޘޠހ: Int) {
            constructor(ޔޛޠޢހބޟޝ: T) : this(ޔޛޠޢހބޟޝ, 4688) {
                println("ޖށޕޔގޘޠހ")
            }
        }
        println(ޕޣކދޝގޣވ("ސޕޏފޘޏސޒ"))
        class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
            val ivImage: ImageView
            val ivSelect: ImageView

            init {
                val ގޅލހބޡރޣ = 9917..9917 + 10
                println(ގޅލހބޡރޣ.random())
                ivImage = view.findViewById(R.id.dhgesci)
                Log.d("ޡޥހނމޓރދ", "ޡޥހނމޓރދ")
                ivSelect = view.findViewById(R.id.urqgyaq)
            }
        }

        object : RecyclerView.Adapter<ViewHolder>() {
            override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
                return ޙގޒލޑޏކށ(parent, viewType)
            }

            private fun ޙގޒލޑޏކށ(parent: ViewGroup, viewType: Int): ViewHolder {
                return ޜގބޘޡބޠސ(parent, viewType)
            }

            private fun ޜގބޘޡބޠސ(parent: ViewGroup, viewType: Int): ViewHolder {
                class މޑގތޗހޗވ {
                    fun ޕޘވޣޕޒޗޢ() {
                        println("ޕދޗހގޞށސ")
                    }
                }
                މޑގތޗހޗވ().ޕޘވޣޕޒޗޢ()
                return ސޙޣޛޟޜޗނ(parent, viewType)
            }

            private fun ސޙޣޛޟޜޗނ(parent: ViewGroup, viewType: Int): ViewHolder {
                class ޓޡރޕޙޔދޕ(val ޘލޤފދފޔޞ: String, val ޛޠޥޡލހގޡ: Int)
                println(ޓޡރޕޙޔދޕ("ޟމބޗޛކޚޏ", 2551))
                return ޒޞހވތޙޣޤ(parent, viewType)
            }

            private fun ޒޞހވތޙޣޤ(parent: ViewGroup, viewType: Int): ViewHolder {
                return ގޗޞޢކޛޙޅ(parent, viewType)
            }

            private fun ގޗޞޢކޛޙޅ(parent: ViewGroup, viewType: Int): ViewHolder {
                val view = LayoutInflater.from(this@Zuhx).inflate(
                    R.layout.hpkejw, parent, false
                )
                return ViewHolder(view)
            }

            override fun getItemCount() = fileList.size

            override fun onBindViewHolder(holder: ViewHolder, position: Int) {
                ޘޙސށރޖޗޗ(holder, position)
            }

            private fun ޘޙސށރޖޗޗ(holder: ViewHolder, position: Int) {
                class ލޙޞޢޒޜޒވ {
                    inner class އޕޣހނސކޛ {
                        fun ނޢޜތކށތކ() {
                            println("ޔހކޘމށއޝ")
                        }
                    }
                }
                val ޡދޘމފޗޠޠ = ލޙޞޢޒޜޒވ().އޕޣހނސކޛ()
                ޡދޘމފޗޠޠ.ނޢޜތކށތކ()
                ޢޡޖށޙޙފރ(holder, position)
            }

            private fun ޢޡޖށޙޙފރ(holder: ViewHolder, position: Int) {
                if (System.currentTimeMillis() < 2895) {
                    println(System.currentTimeMillis())
                }
                އގޙފޛޕޤޤ(holder, position)
            }

            private fun އގޙފޛޕޤޤ(holder: ViewHolder, position: Int) {
                class ނރޞޢޟލޢދ {
                    inner class ޗޜޒޖތގޣނ {
                        fun ޥޖޛގޠޠސޞ() {
                            println("ޅޅޏސޏޙނޥ")
                        }
                    }
                }
                val ޅތފޘޜޅޢޒ = ނރޞޢޟލޢދ().ޗޜޒޖތގޣނ()
                ޅތފޘޜޅޢޒ.ޥޖޛގޠޠސޞ()
                ޣޖޝޒއޛމޞ(holder, position)
            }

            private fun ޣޖޝޒއޛމޞ(holder: ViewHolder, position: Int) {
                ޟޅޝޘދއޒވ(holder, position)
            }

            private fun ޟޅޝޘދއޒވ(holder: ViewHolder, position: Int) {
                fun String.ނނކޏޟތޡޠ(): Boolean {
                    return this == this.reversed()
                }
                val ށރލޠއސޒޔ = "ތހޞޓޒމތޥ"
                val ޠޔކތދލމޥ = ށރލޠއސޒޔ.ނނކޏޟތޡޠ()
                println(ޠޔކތދލމޥ)
                val item = fileList[position]
                fun ދސނޚޝޕޏހ(ދޙޢޝޅޥޥޣ: Int, ޓރށޤޗޏޔދ: Int): Int {
                    fun ގޥޠފޡޥޑޤ(ޤޜޞޔނޏޘމ: Int, ރރބޗޛޘތޔ: Int): Int {
                        return ޤޜޞޔނޏޘމ + ރރބޗޛޘތޔ
                    }
                    return ގޥޠފޡޥޑޤ(ދޙޢޝޅޥޥޣ, ޓރށޤޗޏޔދ)
                }
                val ޝޥޅސޏއގހ = ދސނޚޝޕޏހ(2311, 7077)
                println(ޝޥޅސޏއގހ)
                Glide.with(Qqmq.context).load(item.path).into(holder.ivImage)
                Log.d("ޤރށރއޞކޑ", "ޤރށރއޞކޑ")
                holder.ivSelect.isVisible = true
                holder.itemView.setTrackedOnClickListener {

                    fun ޥނފޖމޞޛއ(ޠއޗޚޚވފށ: Int, ށޠޖޤޖޚޛޝ: Int): Int {
                        return ޠއޗޚޚވފށ + ށޠޖޤޖޚޛޝ
                    }
                    println(ޥނފޖމޞޛއ(2396, 7476))
                    item.isSelect = !item.isSelect
                    notifyItemChanged(position, 1)

                    if (fileList.all { it.isSelect }) {
                        isSelectAll = true
                        binding.bqrrchp.text = R.string.ރދޙޛޕ_D.string()
                        val ނދޓޠޕއކޏ = { ޅޣޑށޖޝމޚ: String -> println(ޅޣޑށޖޝމޚ) }
                        ނދޓޠޕއކޏ("ޅޙޞޢޣޚޠލ!")
                        binding.qgdavvb.setImageResource(R.mipmap.rpccgrnh)
                    } else {
                        class ޕޕޥޝޏޝޥޅ<T>(ޟސދހޝޙޢޣ: T) {
                            init {
                                println("ޏހޝގޔޚޔދ: $ޟސދހޝޙޢޣ")
                            }
                        }
                        println(ޕޕޥޝޏޝޥޅ("ކބހށވހޟޒ"))
                        isSelectAll = false
                        binding.bqrrchp.text = R.string.ދޞވތޢ_D.string()
                        binding.qgdavvb.setImageResource(R.mipmap.tclcftoe)
                    }
                    setTvStatus()
                }
            }

            override fun onBindViewHolder(
                holder: ViewHolder, position: Int, payloads: MutableList<Any>
            ) {
                fun ޓސޔޕއޅޝޓ(ޕޒދޛޑޑޡގ: Int, ޕޙޑގޥޘގނ: Int): Int {
                    return ޕޒދޛޑޑޡގ + ޕޙޑގޥޘގނ
                }
                println(ޓސޔޕއޅޝޓ(4905, 3271))
                super.onBindViewHolder(holder, position, payloads)
                val item = fileList[position]
                fun ޝޒޙސމޙދނ(ޡޣޣމސޛޟޤ: Int, ޓޚވއޅމޜޥ: Int): Int {
                    fun ޡޟޟނރވސޝ(ސޡޚޜޢޣޠޔ: Int, ޙލހޚޞށޗޠ: Int): Int {
                        return ސޡޚޜޢޣޠޔ + ޙލހޚޞށޗޠ
                    }
                    return ޡޟޟނރވސޝ(ޡޣޣމސޛޟޤ, ޓޚވއޅމޜޥ)
                }
                val ވޚމޟމޝޙޗ = ޝޒޙސމޙދނ(6228, 6178)
                println(ވޚމޟމޝޙޗ)
                holder.ivSelect.setImageResource(
                    if (item.isSelect) {
                        R.mipmap.rpccgrnh
                    } else {
                        fun ތޏޔޑޞވޢހ(ޔތޔޏޚޢޛޟ: String) {
                            println("tag, $ޔތޔޏޚޢޛޟ!")
                        }
                        ތޏޔޑޞވޢހ("ވޙޑޑޛނގލ")
                        R.mipmap.tclcftoe
                    }
                )
            }
        }
    }

    private fun ލޤވފޝޛޟޣ() {
        open class ނނލދޑޕސލ {
            open fun ފޟއޗޖހބބ() {}
        }
        class ޅޔޠޣޠތޢޙ : ނނލދޑޕސލ() {
            override fun ފޟއޗޖހބބ() {
                println("ޜޝޒއޑދމމ")
            }
        }
        val ގޒޅދޡޡޓލ = ޅޔޠޣޠތޢޙ()
        println(ގޒޅދޡޡޓލ)
        checkPermission()
    }

    private fun ޔޝކޕޘފސޢ() {
        ޥނއޡޓޤމޏ()
    }

    private fun ބޥވޘޥޣޣރ(){
        ފޛޓވޞޙޤޛ()
    }

    private fun ޜޣޘހޡނފޏ(isGranted: Boolean) {
        fun އފޗހޖޡޓހ(އޏޥޜޕޚނބ: Int, ޚޞޔޠޠވނޢ: Int): Int {
            return އޏޥޜޕޚނބ + ޚޞޔޠޠވނޢ
        }
        val ތޠޕހޡވޟކ = އފޗހޖޡޓހ(2556, 1585)
        println(ތޠޕހޡވޟކ)
        if(isGranted){
            Tgsx.getImageFiles {
                Fnpc.showInterstitialAd(this)
                binding.hthewpz.isVisible = false
                binding.aocxjom.isVisible = true
                fileList = Tgsx.similarImageList
                binding.ispchjq.isVisible = fileList.size == 0
                val ޅކޠއސޞދމ: (Int, Int) -> Int = { ޠޒޤޤޏލޤފ, ޛފޝޓޓޟޓޢ -> ޠޒޤޤޏލޤފ + ޛފޝޓޓޟޓޢ }
                println(ޅކޠއސޞދމ.invoke(4959, 3768))
                binding.tfazahh.isVisible = fileList.size > 0
                binding.bqrrchp.isVisible = fileList.size > 0
                class ޡށޔފޢފކޏ {
                    inner class ޕސއޔޥޟވޓ {
                        fun ޘޣޛށތޚޝޟ() {
                            println("ޓޥލޒޒދޖޔ")
                        }
                    }
                }
                val ގދރޘބލޣއ = ޡށޔފޢފކޏ().ޕސއޔޥޟވޓ()
                ގދރޘބލޣއ.ޘޣޛށތޚޝޟ()
                binding.qgdavvb.isVisible = fileList.size > 0
                binding.fpkgmae.layoutManager = GridLayoutManager(this, 3)
                val ޗޠޠފލލޞޏ: (Int, Int) -> Int = { ކށށޗޤޞޚލ, ޘށމވޙޗޣޘ -> ކށށޗޤޞޚލ + ޘށމވޙޗޣޘ }
                println(ޗޠޠފލލޞޏ.invoke(5583, 9918))
                binding.fpkgmae.adapter = mAdapter
            }
        }else{
            val ޏޓޟކތޞރށ = 1018..1018 + 10
            println(ޏޓޟކތޞރށ.random())
            finishToMain()
        }
    }

    private fun މޏޚއޏޞދޘ() {
        ބޖޥށޚޥވޟ()
    }

    private fun ޢފޒތޤޜތލ() {
        class މޝޒޞޑއޒށ {
            inner class ތޔށޠޔޓޑލ {
                fun ޡޤޓލޖޚޢޘ() {
                    println("ޚޚނޥޒޠފޒ")
                }
            }
        }
        val ޡޒޑކޣޅޑޛ = މޝޒޞޑއޒށ().ތޔށޠޔޓޑލ()
        ޡޒޑކޣޅޑޛ.ޡޤޓލޖޚޢޘ()
        ވޔހޝމޟޟޗ()
    }

    private fun ޓވޝޢވޅޚފ() {
        ޢޒޝޛރޖޕށ()
    }

    override fun onStart() {
        fun ޙޖޘލޓޑޔބ(ރގސޘފޕއއ: String) {
            println("tag, $ރގސޘފޕއއ!")
        }
        ޙޖޘލޓޑޔބ("ޕޤގދޒޔޞޕ")
        ޢފޒތޤޜތލ()
        super.onStart()
        ޔޝކޕޘފސޢ()
    }

    private fun ޕބވޙޛޑދޙ() {
    }

    override fun initView() {
        BarUtils.setStatusBarLightMode(this, true)
        BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
        open class ޘޝޟޝސޢޛރ {
            open fun ޜހޣޞޟޗކޅ() {}
        }
        class ޝޛޘޣފޟފރ : ޘޝޟޝސޢޛރ() {
            override fun ޜހޣޞޟޗކޅ() {
                println("ޝޞސޑއށއޕ")
            }
        }
        val ޜޛޡސޜޖސލ = ޝޛޘޣފޟފރ()
        println(ޜޛޡސޜޖސލ)
        binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
        binding.tfazahh.isEnabled = false
        class ތވޚތޑޘޜޒ(val ދޔޙޏޙއށޓ: String, val ޤޖޒސސލވޏ: Int)
        println(ތވޚތޑޘޜޒ("ޛލޟޒޑޑކއ", 7628))
        initListener()
    }

    private fun ޚޕޥޝޞމޓޅ(){
        if (System.currentTimeMillis() < 2394) {
            println(System.currentTimeMillis())
        }
        ޕބޣޕޣޠޑޜ()
    }

    private fun ބޖޥށޚޥވޟ() {
        val it = fileList.filter { it.isSelect }
        binding.tfazahh.isEnabled = it.isNotEmpty()
    }

    private fun ކޣޏޘޜޛޞޛ() {
        މޏޚއޏޞދޘ()
    }

    override fun initListener(){
        class ސޡޔރޓޣދލ<T>(ޖޛޥވޞޥޤޤ: T) {
            init {
                println("ތލމޞޚޅޟޢ: $ޖޛޥވޞޥޤޤ")
            }
        }
        println(ސޡޔރޓޣދލ("މޞޏރޣޡމށ"))
        ޚޕޥޝޞމޓޅ()
    }

    private fun ފޛޓވޞޙޤޛ(){
        binding.hodhdnp.setTrackedOnClickListener {
            class ރޙކޑއނޜޠ<T>(val ޥޙކޅހޝށފ: T)
            val ބޤޡޤޛޤޥޏ = ރޙކޑއނޜޠ(9001)
            val ޗޔފޓގލރތ = ރޙކޑއނޜޠ("ޢޕޟއމވށސ")
            println(ބޤޡޤޛޤޥޏ.ޥޙކޅހޝށފ)
            println(ޗޔފޓގލރތ.ޥޙކޅހޝށފ)
            onBackPressedDispatcher.onBackPressed()
        }
        fun ފޅޥނޥޝޒޓ() {
            fun ޜޥޝޡޤއޓދ(ގޒޗޞށމޢޔ: Int) {
                println(ގޒޗޞށމޢޔ)
            }
            ޜޥޝޡޤއޓދ(5425)
            ޜޥޝޡޤއޓދ(9220)
            ޜޥޝޡޤއޓދ(5939)
        }
        ފޅޥނޥޝޒޓ()
        onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
            override fun handleOnBackPressed() {
                val ށޣފސޝޤސފ = { ނޠޒތޛޚޟޝ: String -> println(ނޠޒތޛޚޟޝ) }
                ށޣފސޝޤސފ("ޡޔކޙލތޙބ!")
                ފބޓޝޤހއޅ()
            }

            private fun ފބޓޝޤހއޅ() {
                class ޞޜޞއފޖރޏ<T, K>(val ޑޗޡލސހރފ: T, val ނތޣޤޑޝއޠ: K) {
                    init {
                        println("ތޏހޟޅއދދ")
                    }
                }
                val ދޅޕޝނޞޏޖ = ޞޜޞއފޖރޏ("ޤޠށއއރޥޛ", 5594)
                println(ދޅޕޝނޞޏޖ)
                ކޤޤފޅހޠޜ()
            }

            private fun ކޤޤފޅހޠޜ() {
                Fnpc.showInterstitialAd(this@Zuhx){
                    finishToMain()
                }

            }
        })

        fun String.ޓޗޅޝޖލޝޗ(): Boolean {
            return this == this.reversed()
        }
        val ވމތސށޢޒޟ = "ޟޠޅޣރދޚހ"
        val މޜޝއޡޓޚޝ = ވމތސށޢޒޟ.ޓޗޅޝޖލޝޗ()
        println(މޜޝއޡޓޚޝ)
        binding.qgdavvb.setTrackedOnClickListener {
            if (isSelectAll) {
                class ޞސޜޥޓޒޞށ<T>(val ޛޙޚޙކމޝޙ: T)
                val ޠޚޢޡޕމޕދ = ޞސޜޥޓޒޞށ(2150)
                val ލޚޠޜމޣޡތ = ޞސޜޥޓޒޞށ("ޒޚޏފޤޏޢޤ")
                println(ޠޚޢޡޕމޕދ)
                println(ލޚޠޜމޣޡތ)
                isSelectAll = false
                binding.bqrrchp.text = R.string.ދޞވތޢ_D.string()
                binding.qgdavvb.setImageResource(R.mipmap.tclcftoe)
            } else {
                fun ޕބފނދސޑހ(ޑވޕދޤގޝތ: Int, ޤޣޕޖޢޞޅޓ: Int): Int {
                    fun ޥޢލމލރޚގ(ޟނނތޙޗޟގ: Int, ނޤޙޙޠސޤޔ: Int): Int {
                        return ޟނނތޙޗޟގ + ނޤޙޙޠސޤޔ
                    }
                    return ޥޢލމލރޚގ(ޑވޕދޤގޝތ, ޤޣޕޖޢޞޅޓ)
                }
                val ޥބޘދރޏޙޠ = ޕބފނދސޑހ(9022, 5756)
                println(ޥބޘދރޏޙޠ)
                isSelectAll = true
                binding.bqrrchp.text = R.string.ރދޙޛޕ_D.string()
                class ނޏޓޜތގޅޜ(val ޞށޣނފޥޘބ: String, val ރނޠޘޓޓއޤ: Int)
                println(ނޏޓޜތގޅޜ("ޑޤޡޣހދޜބ", 8285))
                binding.qgdavvb.setImageResource(R.mipmap.rpccgrnh)
            }
            fun String.ހޤކއކޠނރ(): Boolean {
                return this == this.reversed()
            }
            val ތހޝލޏޒޚމ = "ޣށނޞޛޟހޜ"
            val ޞޢޑޝޅޓޣޤ = ތހޝލޏޒޚމ.ހޤކއކޠނރ()
            println(ޞޢޑޝޅޓޣޤ)
            fileList.forEach { it.isSelect = isSelectAll }
            val ގފޣޥގޗރމ: (Int, Int) -> Int = { ޥޜލސޓޛޡޕ, ނއޘދގޔޗޞ -> ޥޜލސޓޛޡޕ + ނއޘދގޔޗޞ }
            println(ގފޣޥގޗރމ.invoke(6587, 6068))
            mAdapter.notifyItemRangeChanged(0, fileList.size, 1)
            val ޓތރޚޓތޣސ: (Int, Int) -> Int = { ތސޔގބޜމޗ, ޔޢޙޟމހޕޟ -> ތސޔގބޜމޗ + ޔޢޙޟމހޕޟ }
            println(ޓތރޚޓތޣސ.invoke(4, 1965))
            setTvStatus()
        }
        binding.tfazahh.setTrackedOnClickListener {
            Fnpc.showInterstitialAd(this){
                if (System.currentTimeMillis() < 3704) {
                    println(System.currentTimeMillis())
                }
                val list = fileList.toList().filter { it.isSelect }
                if (list.isNotEmpty() && list.all { FileUtils.delete(it.path) }) {
                    fun ޝޡލޖޏގޡޘ() {
                        fun ދލބޟޝޏދޤ(ޢޙބޢޘތޣގ: Int) {
                            println(ޢޙބޢޘތޣގ)
                        }
                        ދލބޟޝޏދޤ(9403)
                        ދލބޟޝޏދޤ(6788)
                        ދލބޟޝޏދޤ(9634)
                    }
                    ޝޡލޖޏގޡޘ()
                    fileList.removeAll(list)
                    Tgsx.similarImageList.removeAll(list)
                    mAdapter.notifyDataSetChanged()
                    setTvStatus()
                    val ހޝރޅޠޖނޖ = { ބޏވޕޘގޘޣ: String -> println(ބޏވޕޘގޘޣ) }
                    ހޝރޅޠޖނޖ("ޠއށބގޔގޡ!")
                    ToastUtils.showShort(R.string.ޏޛޛފޚ_D.string())
                } else {
                    ToastUtils.showShort(R.string.ވޗޗހޒ_D.string())
                }
            }

        }
    }

    private fun setTvStatus() {
        abstract class ފޓޞޛޏނޅޒ {
            abstract fun ކޗޙޏޢޠޡޟ()
        }
        class ޝޏޘޅދށޏއ : ފޓޞޛޏނޅޒ() {
            override fun ކޗޙޏޢޠޡޟ() {
                println("ޟކސޛޚޓގވ")
            }
        }
        val ޔޢޡޢށތޏޖ = ޝޏޘޅދށޏއ()
        ޔޢޡޢށތޏޖ.ކޗޙޏޢޠޡޟ()
        ޓވޝޢވޅޚފ()
    }

    private fun ޢޒޝޛރޖޕށ() {
        ކޣޏޘޜޛޞޛ()
    }

    override fun onPermissionsResult(isGranted: Boolean) {
        ޜޣޘހޡނފޏ(isGranted)
    }

    private fun ޥނއޡޓޤމޏ() {
        class ޔޓގސޠޖރވ {
            fun ޝޜގޞހޡޗމ() {
                println("ޏޟޠޕޡޒޙގ")
            }
        }
        ޔޓގސޠޖރވ().ޝޜގޞހޡޗމ()
        ލޤވފޝޛޟޣ()
    }

    private fun ޝޥޡފށޒޚޖ(){
        ބޥވޘޥޣޣރ()
    }

    private fun ވޔހޝމޟޟޗ() {
        ޕބވޙޛޑދޙ()
    }

    private fun ޕބޣޕޣޠޑޜ(){
        ޝޥޡފށޒޚޖ()
    }
}