|
|
|
@ -10,6 +10,7 @@ private var toast: Toast? = null |
|
|
|
|
|
|
|
|
|
fun Context.toastOnUi(message: Int) { |
|
|
|
|
runOnUI { |
|
|
|
|
kotlin.runCatching { |
|
|
|
|
if (toast == null) { |
|
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT) |
|
|
|
|
} else { |
|
|
|
@ -19,9 +20,11 @@ fun Context.toastOnUi(message: Int) { |
|
|
|
|
toast?.show() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun Context.toastOnUi(message: CharSequence?) { |
|
|
|
|
runOnUI { |
|
|
|
|
kotlin.runCatching { |
|
|
|
|
if (toast == null) { |
|
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT) |
|
|
|
|
} else { |
|
|
|
@ -31,9 +34,11 @@ fun Context.toastOnUi(message: CharSequence?) { |
|
|
|
|
toast?.show() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun Context.longToastOnUi(message: Int) { |
|
|
|
|
runOnUI { |
|
|
|
|
kotlin.runCatching { |
|
|
|
|
if (toast == null) { |
|
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_LONG) |
|
|
|
|
} else { |
|
|
|
@ -43,9 +48,11 @@ fun Context.longToastOnUi(message: Int) { |
|
|
|
|
toast?.show() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun Context.longToastOnUi(message: CharSequence?) { |
|
|
|
|
runOnUI { |
|
|
|
|
kotlin.runCatching { |
|
|
|
|
if (toast == null) { |
|
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_LONG) |
|
|
|
|
} else { |
|
|
|
@ -55,6 +62,7 @@ fun Context.longToastOnUi(message: CharSequence?) { |
|
|
|
|
toast?.show() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun Fragment.toastOnUi(message: Int) = requireActivity().toastOnUi(message) |
|
|
|
|