|
|
@ -10,49 +10,57 @@ private var toast: Toast? = null |
|
|
|
|
|
|
|
|
|
|
|
fun Context.toastOnUi(message: Int) { |
|
|
|
fun Context.toastOnUi(message: Int) { |
|
|
|
runOnUI { |
|
|
|
runOnUI { |
|
|
|
if (toast == null) { |
|
|
|
kotlin.runCatching { |
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT) |
|
|
|
if (toast == null) { |
|
|
|
} else { |
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT) |
|
|
|
toast?.setText(message) |
|
|
|
} else { |
|
|
|
toast?.duration = Toast.LENGTH_SHORT |
|
|
|
toast?.setText(message) |
|
|
|
|
|
|
|
toast?.duration = Toast.LENGTH_SHORT |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
toast?.show() |
|
|
|
} |
|
|
|
} |
|
|
|
toast?.show() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun Context.toastOnUi(message: CharSequence?) { |
|
|
|
fun Context.toastOnUi(message: CharSequence?) { |
|
|
|
runOnUI { |
|
|
|
runOnUI { |
|
|
|
if (toast == null) { |
|
|
|
kotlin.runCatching { |
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT) |
|
|
|
if (toast == null) { |
|
|
|
} else { |
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_SHORT) |
|
|
|
toast?.setText(message) |
|
|
|
} else { |
|
|
|
toast?.duration = Toast.LENGTH_SHORT |
|
|
|
toast?.setText(message) |
|
|
|
|
|
|
|
toast?.duration = Toast.LENGTH_SHORT |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
toast?.show() |
|
|
|
} |
|
|
|
} |
|
|
|
toast?.show() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun Context.longToastOnUi(message: Int) { |
|
|
|
fun Context.longToastOnUi(message: Int) { |
|
|
|
runOnUI { |
|
|
|
runOnUI { |
|
|
|
if (toast == null) { |
|
|
|
kotlin.runCatching { |
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_LONG) |
|
|
|
if (toast == null) { |
|
|
|
} else { |
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_LONG) |
|
|
|
toast?.setText(message) |
|
|
|
} else { |
|
|
|
toast?.duration = Toast.LENGTH_LONG |
|
|
|
toast?.setText(message) |
|
|
|
|
|
|
|
toast?.duration = Toast.LENGTH_LONG |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
toast?.show() |
|
|
|
} |
|
|
|
} |
|
|
|
toast?.show() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun Context.longToastOnUi(message: CharSequence?) { |
|
|
|
fun Context.longToastOnUi(message: CharSequence?) { |
|
|
|
runOnUI { |
|
|
|
runOnUI { |
|
|
|
if (toast == null) { |
|
|
|
kotlin.runCatching { |
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_LONG) |
|
|
|
if (toast == null) { |
|
|
|
} else { |
|
|
|
toast = Toast.makeText(this, message, Toast.LENGTH_LONG) |
|
|
|
toast?.setText(message) |
|
|
|
} else { |
|
|
|
toast?.duration = Toast.LENGTH_LONG |
|
|
|
toast?.setText(message) |
|
|
|
|
|
|
|
toast?.duration = Toast.LENGTH_LONG |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
toast?.show() |
|
|
|
} |
|
|
|
} |
|
|
|
toast?.show() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|