package com.xyzshell.myphoneinfo.dialog

import android.app.Dialog
import android.graphics.Color
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.graphics.drawable.toDrawable
import androidx.fragment.app.DialogFragment
import com.xyzshell.myphoneinfo.R
import com.xyzshell.myphoneinfo.databinding.FragmentShowLoadBinding

class ShowLoadFragment : DialogFragment() {
    private lateinit var binding:FragmentShowLoadBinding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = FragmentShowLoadBinding.inflate(inflater, container, false)
        binding.ok.setOnClickListener{
            dismiss()
        }
        return binding.root
    }

    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        val dialog=super.onCreateDialog(savedInstanceState)
        // 设置宽度匹配父容器
        dialog.window?.apply {
            setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
            setBackgroundDrawable(Color.TRANSPARENT.toDrawable())
        }
        return dialog
    }

}