package com.base.locationsharewhite.ui.views

import android.app.AlertDialog
import android.content.Context
import android.view.Gravity
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.base.locationsharewhite.R
import com.base.locationsharewhite.databinding.DialogMapTypeBinding

object DialogView {

    fun Context.showMapTypeDialog() {
        val dialog = AlertDialog.Builder(this).create()
        val binding = DialogMapTypeBinding.inflate(LayoutInflater.from(this))
        dialog.setView(binding.root)
        dialog.setCanceledOnTouchOutside(true)

        dialog.show()

        val params = dialog.window?.attributes
        params?.width = resources.getDimensionPixelOffset(R.dimen.dp_375)
        params?.height = LinearLayout.LayoutParams.WRAP_CONTENT
        params?.gravity = Gravity.CENTER
        dialog.window?.attributes = params
        dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)

    }
}