| | |
| | | import androidx.fragment.app.Fragment |
| | | import androidx.fragment.app.FragmentManager |
| | | import cn.sinata.xldutils.R |
| | | import org.jetbrains.anko.dip |
| | | |
| | | /** |
| | | * 扩展方法:允许DialogFragment使用 commitAllowingStateLoss 弹窗 |
| | |
| | | toast.view = toastLayout |
| | | toast.show() |
| | | } |
| | | |
| | | fun Context.whiteToast(message: CharSequence,longTime:Boolean=false) { |
| | | val toast = Toast(this) |
| | | toast.duration = if (longTime)Toast.LENGTH_LONG else Toast.LENGTH_SHORT |
| | | toast.setGravity(Gravity.CENTER, 0, dip(100)) |
| | | val toastLayout = LayoutInflater.from(this).inflate(R.layout.layout_white_toast, null) |
| | | val txtToast: TextView = toastLayout.findViewById(R.id.txt_toast) |
| | | txtToast.text = message |
| | | toast.view = toastLayout |
| | | toast.show() |
| | | } |