From f6a260edc3d5b80f4ba1bd92e6e4392325376f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Mon, 3 Jun 2024 20:16:30 +0900 Subject: [PATCH 1/2] :sparkles: :: Create makeToast function --- core/ui/src/main/java/com/msg/ui/makeToast.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 core/ui/src/main/java/com/msg/ui/makeToast.kt diff --git a/core/ui/src/main/java/com/msg/ui/makeToast.kt b/core/ui/src/main/java/com/msg/ui/makeToast.kt new file mode 100644 index 00000000..6e6e66b0 --- /dev/null +++ b/core/ui/src/main/java/com/msg/ui/makeToast.kt @@ -0,0 +1,8 @@ +package com.msg.ui + +import android.content.Context +import android.widget.Toast + +fun makeToast(context: Context, message: String, duration: Int = Toast.LENGTH_SHORT) { + Toast.makeText(context, message, duration).show() +} \ No newline at end of file From 5c01cf289dcb690eedb60542b65f8a3caad644bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=84=9C?= Date: Mon, 3 Jun 2024 20:17:27 +0900 Subject: [PATCH 2/2] :sparkles: :: Apply makeToast function --- .../java/com/msg/certification/AddCertificationScreen.kt | 6 +++--- .../main/java/com/bitgoeul/email/EmailSendInformScreen.kt | 6 +++--- .../main/java/com/bitgoeul/email/InputNewPasswordScreen.kt | 4 ++-- .../login/src/main/java/com/bitgoeul/login/LoginScreen.kt | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/feature/certification/src/main/java/com/msg/certification/AddCertificationScreen.kt b/feature/certification/src/main/java/com/msg/certification/AddCertificationScreen.kt index b42a9778..91b29b5c 100644 --- a/feature/certification/src/main/java/com/msg/certification/AddCertificationScreen.kt +++ b/feature/certification/src/main/java/com/msg/certification/AddCertificationScreen.kt @@ -1,6 +1,5 @@ package com.msg.certification -import android.widget.Toast import androidx.activity.ComponentActivity import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement @@ -23,6 +22,7 @@ import com.msg.design_system.component.button.BitgoeulButton import com.msg.design_system.component.topbar.DetailSettingTopBar import com.msg.design_system.theme.color.BitgoeulColor import com.msg.ui.DevicePreviews +import com.msg.ui.makeToast import com.msg.ui.util.toKoreanFormat import java.time.LocalDate @@ -99,9 +99,9 @@ internal fun AddCertificationScreen( text = "자격증 등록", onClicked = { if (name.value.isBlank()) { - Toast.makeText(context, "자격증 이름을 입력해주세요", Toast.LENGTH_SHORT).show() + makeToast(context, "자격증 이름을 입력해주세요") } else if (date.value == null) { - Toast.makeText(context, "취득일을 입력해주세요", Toast.LENGTH_SHORT).show() + makeToast(context, "취득일을 입력해주세요") } else { onAddClicked(name.value, date.value!!) } diff --git a/feature/email/src/main/java/com/bitgoeul/email/EmailSendInformScreen.kt b/feature/email/src/main/java/com/bitgoeul/email/EmailSendInformScreen.kt index 0e43e978..d776d5f1 100644 --- a/feature/email/src/main/java/com/bitgoeul/email/EmailSendInformScreen.kt +++ b/feature/email/src/main/java/com/bitgoeul/email/EmailSendInformScreen.kt @@ -1,7 +1,6 @@ package com.bitgoeul.email import android.util.Log -import android.widget.Toast import androidx.activity.ComponentActivity import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column @@ -29,6 +28,7 @@ import com.msg.design_system.component.icon.GoBackIcon import com.msg.design_system.component.topbar.GoBackTopBar import com.msg.design_system.theme.BitgoeulAndroidTheme import com.msg.model.remote.response.email.GetEmailAuthenticateStatusResponse +import com.msg.ui.makeToast import kotlinx.coroutines.launch @Composable @@ -51,10 +51,10 @@ internal fun EmailSendInformRoute( onSuccess = { response -> if (response.isAuthentication) { onMoveNewPasswordClicked() - Toast.makeText(context, "이메일 인증에 성공했습니다.", Toast.LENGTH_SHORT).show() + makeToast(context, "이메일 인증에 성공했습니다.") } if (!response.isAuthentication) { - Toast.makeText(context, "이메일 인증에 실패했습니다.", Toast.LENGTH_SHORT).show() + makeToast(context, "이메일 인증에 실패했습니다.") } } ) diff --git a/feature/email/src/main/java/com/bitgoeul/email/InputNewPasswordScreen.kt b/feature/email/src/main/java/com/bitgoeul/email/InputNewPasswordScreen.kt index 86da6fdc..0116001b 100644 --- a/feature/email/src/main/java/com/bitgoeul/email/InputNewPasswordScreen.kt +++ b/feature/email/src/main/java/com/bitgoeul/email/InputNewPasswordScreen.kt @@ -1,6 +1,5 @@ package com.bitgoeul.email -import android.widget.Toast import androidx.activity.ComponentActivity import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column @@ -27,6 +26,7 @@ import com.msg.design_system.component.icon.GoBackIcon import com.msg.design_system.component.textfield.DefaultTextField import com.msg.design_system.component.topbar.GoBackTopBar import com.msg.design_system.theme.BitgoeulAndroidTheme +import com.msg.ui.makeToast @Composable internal fun InputNewPasswordRoute( @@ -134,7 +134,7 @@ internal fun InputNewPasswordScreen( if (passwordPattern.matches(firstInputPassword.value)) { onNextClicked(secondInputPassword.value) } else { - Toast.makeText(context, "비밀번호는 8~24자 영문, 숫자, 특수문자 1개 이상이어야 합니다.", Toast.LENGTH_SHORT).show() + makeToast(context, "비밀번호는 8~24자 영문, 숫자, 특수문자 1개 이상이어야 합니다.") } } ) diff --git a/feature/login/src/main/java/com/bitgoeul/login/LoginScreen.kt b/feature/login/src/main/java/com/bitgoeul/login/LoginScreen.kt index 81014fa2..46a9533b 100644 --- a/feature/login/src/main/java/com/bitgoeul/login/LoginScreen.kt +++ b/feature/login/src/main/java/com/bitgoeul/login/LoginScreen.kt @@ -1,7 +1,6 @@ package com.bitgoeul.login import android.content.pm.ActivityInfo -import android.widget.Toast import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -35,6 +34,7 @@ import com.msg.design_system.theme.BitgoeulAndroidTheme import com.msg.design_system.util.LockScreenOrientation import com.msg.design_system.util.checkEmailRegex import com.msg.design_system.util.checkPasswordRegex +import com.msg.ui.makeToast import kotlinx.coroutines.launch @Composable @@ -56,11 +56,11 @@ internal fun LoginRoute( getLoginData( viewModel = viewModel, onSuccess = { - Toast.makeText(context, "로그인에 성공하였습니다.", Toast.LENGTH_SHORT).show() + makeToast(context, "로그인에 성공하였습니다.") onLoginClicked() }, onFailure = { - Toast.makeText(context, "로그인에 실패하였습니다. 다시 시도해주세요", Toast.LENGTH_SHORT).show() + makeToast(context, "로그인에 실패하였습니다. 다시 시도해주세요") } ) }