From 259f5a38c2a8f5be8d97644a0ae3c0022ab413a9 Mon Sep 17 00:00:00 2001 From: jisungbin Date: Mon, 8 Nov 2021 20:21:59 +0900 Subject: [PATCH] Refactoring - 10 --- .../common/extension/Activity.kt | 17 ----------------- .../common/extension/{UI.kt => toast.kt} | 8 ++++---- .../sungbin/gitmessengerbot/core/bot/api/UI.kt | 2 +- 3 files changed, 5 insertions(+), 22 deletions(-) delete mode 100644 common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/Activity.kt rename common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/{UI.kt => toast.kt} (71%) diff --git a/common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/Activity.kt b/common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/Activity.kt deleted file mode 100644 index 8db40e2f..00000000 --- a/common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/Activity.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * GitMessengerBot © 2021 지성빈 & 구환. all rights reserved. - * GitMessengerBot license is under the GPL-3.0. - * - * [Activity.kt] created by Ji Sungbin on 21. 8. 30. 오후 5:05 - * - * Please see: https://github.com/GitMessengerBot/GitMessengerBot-Android/blob/master/LICENSE. - */ - -package io.github.jisungbin.gitmessengerbot.common.extension - -import android.app.Activity -import android.widget.Toast - -fun Activity.toast(message: String, length: Int = Toast.LENGTH_SHORT) { - toast(this, message, length) -} diff --git a/common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/UI.kt b/common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/toast.kt similarity index 71% rename from common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/UI.kt rename to common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/toast.kt index adc70b76..f9b2b888 100644 --- a/common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/UI.kt +++ b/common/src/main/kotlin/io/github/jisungbin/gitmessengerbot/common/extension/toast.kt @@ -2,7 +2,7 @@ * GitMessengerBot © 2021 지성빈 & 구환. all rights reserved. * GitMessengerBot license is under the GPL-3.0. * - * [UI.kt] created by Ji Sungbin on 21. 8. 30. 오후 5:06 + * [toast.kt] created by Ji Sungbin on 21. 8. 30. 오후 5:06 * * Please see: https://github.com/GitMessengerBot/GitMessengerBot-Android/blob/master/LICENSE. */ @@ -13,9 +13,9 @@ import android.app.Activity import android.content.Context import android.widget.Toast -fun toast(activity: Activity, message: String, length: Int = Toast.LENGTH_SHORT) { - activity.runOnUiThread { - toast(activity, message, length) +fun Activity.toast(message: String, length: Int = Toast.LENGTH_SHORT) { + runOnUiThread { + toast(this, message, length) } } diff --git a/core/src/main/kotlin/io/github/sungbin/gitmessengerbot/core/bot/api/UI.kt b/core/src/main/kotlin/io/github/sungbin/gitmessengerbot/core/bot/api/UI.kt index d2030bce..d74cdacb 100644 --- a/core/src/main/kotlin/io/github/sungbin/gitmessengerbot/core/bot/api/UI.kt +++ b/core/src/main/kotlin/io/github/sungbin/gitmessengerbot/core/bot/api/UI.kt @@ -2,7 +2,7 @@ * GitMessengerBot © 2021 지성빈 & 구환. all rights reserved. * GitMessengerBot license is under the GPL-3.0. * - * [UI.kt] created by Ji Sungbin on 21. 7. 10. 오전 11:35. + * [toast.kt] created by Ji Sungbin on 21. 7. 10. 오전 11:35. * * Please see: https://github.com/GitMessengerBot/GitMessengerBot-Android/blob/master/LICENSE. */