From 89068b4d0526b873c26fe6ccb6f8adccc5753207 Mon Sep 17 00:00:00 2001 From: sanjeok77 Date: Thu, 12 Mar 2026 23:18:22 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=86=A0=EC=8A=A4=ED=8A=B8=20=EB=8B=A4?= =?UTF-8?q?=ED=81=AC=EB=AA=A8=EB=93=9C=20=EC=99=84=EC=A0=84=20=EC=A7=80?= =?UTF-8?q?=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 배경색을 반투명 회색(#CC333333)으로 변경하여 라이트/다크 모두 가독성 확보 - 텍스트 색상을 흰색(@android:color/white)으로 변경 - showCustomToast() 함수 개선 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- .../java/com/example/shiftalarm/AlarmUtils.kt | 21 +++++++++++++++++++ app/src/main/res/drawable/bg_custom_toast.xml | 5 +++-- app/src/main/res/layout/custom_toast.xml | 6 +++--- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/example/shiftalarm/AlarmUtils.kt b/app/src/main/java/com/example/shiftalarm/AlarmUtils.kt index f4b8fc2..ba75216 100644 --- a/app/src/main/java/com/example/shiftalarm/AlarmUtils.kt +++ b/app/src/main/java/com/example/shiftalarm/AlarmUtils.kt @@ -29,6 +29,27 @@ fun showCustomToast(context: Context, message: String, duration: Int = android.w 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, 150) + toast.show() + } catch (e: Exception) { + // Fallback to default toast if custom toast fails + android.widget.Toast.makeText(context, message, duration).show() + } +} + * 다크모드 지원 커스텀 토스트 표시 + */ +fun showCustomToast(context: Context, message: String, duration: Int = android.widget.Toast.LENGTH_SHORT) { + try { + // Use application context with theme for proper dark mode support + val themedContext = android.view.ContextThemeWrapper(context.applicationContext, R.style.Theme_ShiftAlarm) + val inflater = android.view.LayoutInflater.from(themedContext) + 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.applicationContext) + 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) { diff --git a/app/src/main/res/drawable/bg_custom_toast.xml b/app/src/main/res/drawable/bg_custom_toast.xml index 740597b..ad25896 100644 --- a/app/src/main/res/drawable/bg_custom_toast.xml +++ b/app/src/main/res/drawable/bg_custom_toast.xml @@ -1,8 +1,9 @@ - - + + + diff --git a/app/src/main/res/layout/custom_toast.xml b/app/src/main/res/layout/custom_toast.xml index 4f83742..4c337bc 100644 --- a/app/src/main/res/layout/custom_toast.xml +++ b/app/src/main/res/layout/custom_toast.xml @@ -4,8 +4,8 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:background="@drawable/bg_custom_toast" - android:paddingHorizontal="16dp" - android:paddingVertical="10dp" + android:paddingHorizontal="20dp" + android:paddingVertical="12dp" android:gravity="center">