package importantedto.maidedto.witnessedto.nationalismedto

import android.app.Activity
import android.view.Gravity
import android.view.ViewGroup
import android.widget.PopupWindow
import androidx.core.view.updatePadding
import com.base.datarecovery.databinding.AppealedtoBinding
import importantedto.gallonedto.Transcendedto


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

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

        isOutsideTouchable = false
        isFocusable = true
        isClippingEnabled = false
    }

    private val binding by lazy {
        AppealedtoBinding.inflate(activity.layoutInflater)
    }
    fun show() {
        contentView = binding.root
        activity.window.decorView.post {
            binding.root.updatePadding(top = Transcendedto.getStatusBarHeight())
            Transcendedto.setStatusBarLightMode(activity, false)
            showAtLocation(activity.window.decorView, Gravity.CENTER, 0, 0)
        }
        binding.welfareedto.setOnClickListener {
            dismiss()
        }
        binding.confrontedto.setOnClickListener {
            onDismiss.invoke()
            dismiss()

        }

    }


    override fun dismiss() {
        super.dismiss()
        Transcendedto.setStatusBarLightMode(activity, true)
    }
}