From f884e991a37eb8d439bb29ca5930e4012e68acda Mon Sep 17 00:00:00 2001 From: sanjeok77 Date: Thu, 12 Mar 2026 22:44:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=8B=A4=ED=81=AC=EB=AA=A8=EB=93=9C=20?= =?UTF-8?q?=EC=A7=80=EC=9B=90=20=EC=BB=A4=EC=8A=A4=ED=85=80=20=ED=86=A0?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - showCustomToast() 함수 추가 (AlarmUtils) - 커스텀 토스트 레이아웃 및 배경 drawable 추가 - values/colors.xml 및 values-night/colors.xml 리소스 사용 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- .../java/com/example/shiftalarm/AlarmUtils.kt | 20 +++++++++++++++++++ app/src/main/res/drawable/bg_custom_toast.xml | 9 +++++++++ app/src/main/res/layout/custom_toast.xml | 20 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 app/src/main/res/drawable/bg_custom_toast.xml create mode 100644 app/src/main/res/layout/custom_toast.xml diff --git a/app/src/main/java/com/example/shiftalarm/AlarmUtils.kt b/app/src/main/java/com/example/shiftalarm/AlarmUtils.kt index ee4c71d..f4b8fc2 100644 --- a/app/src/main/java/com/example/shiftalarm/AlarmUtils.kt +++ b/app/src/main/java/com/example/shiftalarm/AlarmUtils.kt @@ -16,6 +16,26 @@ import java.util.concurrent.TimeUnit val SEOUL_ZONE: ZoneId = ZoneId.of("Asia/Seoul") const val TAG = "ShiftAlarm" +/** + * 다크모드 지원 커스텀 토스트 표시 + */ +fun showCustomToast(context: Context, message: String, duration: Int = android.widget.Toast.LENGTH_SHORT) { + try { + val inflater = android.view.LayoutInflater.from(context) + val layout = inflater.inflate(R.layout.custom_toast, null) + val textView = layout.findViewById(R.id.toastText) + textView.text = message + + val toast = android.widget.Toast(context) + toast.duration = duration + toast.view = layout + toast.setGravity(android.view.Gravity.BOTTOM or android.view.Gravity.CENTER_HORIZONTAL, 0, 100) + toast.show() + } catch (e: Exception) { + // Fallback to default toast if custom toast fails + android.widget.Toast.makeText(context, message, duration).show() + } +} // ============================================ // 알람 ID 생성 // ============================================ diff --git a/app/src/main/res/drawable/bg_custom_toast.xml b/app/src/main/res/drawable/bg_custom_toast.xml new file mode 100644 index 0000000..740597b --- /dev/null +++ b/app/src/main/res/drawable/bg_custom_toast.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/app/src/main/res/layout/custom_toast.xml b/app/src/main/res/layout/custom_toast.xml new file mode 100644 index 0000000..4f83742 --- /dev/null +++ b/app/src/main/res/layout/custom_toast.xml @@ -0,0 +1,20 @@ + + + + + +