package aicg.wipf.rxxn

import android.app.Activity
import android.view.Gravity
import android.view.ViewGroup
import android.widget.PopupWindow
import androidx.core.view.updatePadding
import com.blankj.utilcode.util.BarUtils
import com.test.basd.smartjunkcleaner.databinding.SpkzfpBinding
import kotlin.random.Random

class Twyj(private val activity: Activity, val onDismiss: () -> Unit) : PopupWindow() {

    private val binding by lazy {
        val ޥޑޙނޢޏޕޙ = 3814..3814 + 10
        println(ޥޑޙނޢޏޕޙ.random())
        SpkzfpBinding.inflate(activity.layoutInflater)
    }

    private fun ޔބޠޑޏޥޞޥ() {
        class ޡވޗމޠޙފޜ {
            val ޔޘދޝޥކޟޙ by lazy {
                println("ފޟޕސލޓމވ")
                "ޓޢޕޤޢމޢޛ!"
            }
        }
        val ޥކޙވފހކސ = ޡވޗމޠޙފޜ()
        println(ޥކޙވފހކސ.ޔޘދޝޥކޟޙ)
        BarUtils.setStatusBarLightMode(activity, true)
    }

    override fun dismiss() {
        fun <T> ޢޟޛވލނވޡ(ޑޞރޞޠޑޞޙ: T) {
            println(ޑޞރޞޠޑޞޙ)
        }
        ޢޟޛވލނވޡ(6101)
        ޢޟޛވލނވޡ("ކޡޞބލޜޠޏ")
        ޤޕޕނޤޥގފ()
        super.dismiss()
        ޔބޠޑޏޥޞޥ()
    }

    init {
        width = ViewGroup.LayoutParams.MATCH_PARENT
        height = ViewGroup.LayoutParams.MATCH_PARENT

        isOutsideTouchable = false
        isFocusable = true
        isClippingEnabled = false
    }

    private fun ނމޖކވޞއޗ() {
        contentView = binding.root
        activity.window.decorView.post {
            fun ސޏގޠޞޡގނ(ޞޟޕލނޣޤދ: Int, ޅފޜޅޞޤބދ: Int): Int {
                return ޞޟޕލނޣޤދ + ޅފޜޅޞޤބދ
            }
            println(ސޏގޠޞޡގނ(888, 1979))
            binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
            open class ޗރއޠޕއޖހ {
                open fun ތސސހހމއބ() {}
            }
            class ޟތޅޘނމޥޢ : ޗރއޠޕއޖހ() {
                override fun ތސސހހމއބ() {
                    println("ޑޕމވޚވއމ")
                }
            }
            val ޚއޅޕޞގޞޖ = ޟތޅޘނމޥޢ()
            println(ޚއޅޕޞގޞޖ)
            BarUtils.setStatusBarLightMode(activity, false)
            if (System.currentTimeMillis() < 4755) {
                println(System.currentTimeMillis())
            }
            showAtLocation(activity.window.decorView, Gravity.CENTER, 0, 0)
        }
        binding.root.postDelayed({
            dismiss()
            onDismiss.invoke()
        }, Random.nextLong(2500, 4000))

    }

    private fun ޤޕޕނޤޥގފ() {
    }

    private fun ޞޠފލއޘޟހ() {
        ނމޖކވޞއޗ()
    }

    fun show() {
        ޞޠފލއޘޟހ()
    }
}