vararg引数を別のvarags引数に渡す際は spread 演算子が必要
This commit is contained in:
parent
be659255d8
commit
2273f7f94c
|
@ -95,7 +95,7 @@ object DlgConfirm {
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun AppCompatActivity.confirm(@StringRes messageId: Int, vararg args: Any?) =
|
suspend fun AppCompatActivity.confirm(@StringRes messageId: Int, vararg args: Any?) =
|
||||||
confirm(getString(messageId, args))
|
confirm(getString(messageId, *args))
|
||||||
|
|
||||||
suspend fun AppCompatActivity.confirm(message: String) {
|
suspend fun AppCompatActivity.confirm(message: String) {
|
||||||
suspendCancellableCoroutine<Unit> { cont ->
|
suspendCancellableCoroutine<Unit> { cont ->
|
||||||
|
|
|
@ -43,19 +43,19 @@ class LogCategory(category: String) {
|
||||||
private fun msg(priority: Int, res: Resources, @StringRes stringId: Int, args: Array<out Any?>) =
|
private fun msg(priority: Int, res: Resources, @StringRes stringId: Int, args: Array<out Any?>) =
|
||||||
msg(priority, res.getString(stringId, *args))
|
msg(priority, res.getString(stringId, *args))
|
||||||
|
|
||||||
fun e(res: Resources, @StringRes stringId: Int, vararg args: Any) =
|
fun e(res: Resources, @StringRes stringId: Int, vararg args: Any?) =
|
||||||
msg(Log.ERROR, res, stringId, args)
|
msg(Log.ERROR, res, stringId, args)
|
||||||
|
|
||||||
fun w(res: Resources, @StringRes stringId: Int, vararg args: Any) =
|
fun w(res: Resources, @StringRes stringId: Int, vararg args: Any?) =
|
||||||
msg(Log.WARN, res, stringId, args)
|
msg(Log.WARN, res, stringId, args)
|
||||||
|
|
||||||
fun i(res: Resources, @StringRes stringId: Int, vararg args: Any) =
|
fun i(res: Resources, @StringRes stringId: Int, vararg args: Any?) =
|
||||||
msg(Log.INFO, res, stringId, args)
|
msg(Log.INFO, res, stringId, args)
|
||||||
|
|
||||||
fun d(res: Resources, @StringRes stringId: Int, vararg args: Any) =
|
fun d(res: Resources, @StringRes stringId: Int, vararg args: Any?) =
|
||||||
msg(Log.DEBUG, res, stringId, args)
|
msg(Log.DEBUG, res, stringId, args)
|
||||||
|
|
||||||
fun v(res: Resources, @StringRes stringId: Int, vararg args: Any) =
|
fun v(res: Resources, @StringRes stringId: Int, vararg args: Any?) =
|
||||||
msg(Log.VERBOSE, res, stringId, args)
|
msg(Log.VERBOSE, res, stringId, args)
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
|
@ -88,4 +88,4 @@ fun AppCompatActivity.showError(ex: Throwable, caption: String? = null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.errorString(@StringRes stringId: Int, vararg args: Any?): Nothing =
|
fun Context.errorString(@StringRes stringId: Int, vararg args: Any?): Nothing =
|
||||||
error(getString(stringId, args))
|
error(getString(stringId, *args))
|
||||||
|
|
Loading…
Reference in New Issue