package com.common.bluetooth.utils

import android.content.Context
import android.view.LayoutInflater
import android.widget.TextView
import android.widget.Toast
import com.common.bluetooth.R

/**
 * toast工具类
 */
class ToastUtil {

    companion object {
        /**
         * 展示自定义背景和信息的toast
         */
        fun showCustomToast(context: Context, msg: String) {
            val view = LayoutInflater.from(context).inflate(R.layout.my_toast_layout, null, false)
            val textView = view.findViewById<TextView>(R.id.tv_toast_msg)
            textView.text = msg
            var toast: Toast = Toast(context)
            toast.duration = Toast.LENGTH_SHORT
            toast.view = view
            toast.show()
        }

    }
}