package rowedto.jockeyedto.sheetedto.balsamedto.formaledto.orientationedto

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.TrailedtoBinding
import rowedto.jockeyedto.sheetedto.raceedto.pavementedto.Spareedto


class Tractionedto(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 {
        TrailedtoBinding.inflate(activity.layoutInflater)
    }
    fun show() {
        contentView = binding.root
        activity.window.decorView.post {
            binding.root.updatePadding(top = Spareedto.getStatusBarHeight())
            Spareedto.setStatusBarLightMode(activity, false)
            showAtLocation(activity.window.decorView, Gravity.CENTER, 0, 0)
        }
        binding.rubedto.setOnClickListener {
            dismiss()
        }
        binding.tripedto.setOnClickListener {
            onDismiss.invoke()
            dismiss()

        }

    }


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