fix: 토스트 다크모드 완전 지원
- 배경색을 반투명 회색(#CC333333)으로 변경하여 라이트/다크 모두 가독성 확보 - 텍스트 색상을 흰색(@android:color/white)으로 변경 - showCustomToast() 함수 개선 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -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<android.widget.TextView>(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) {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/surface" />
|
||||
<corners android:radius="12dp" />
|
||||
<!-- 배경색: 다크모드에서도 잘 보이도록 surface 색상 사용 -->
|
||||
<solid android:color="#CC333333" />
|
||||
<corners android:radius="16dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/outline" />
|
||||
|
||||
@@ -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">
|
||||
|
||||
<TextView
|
||||
@@ -13,7 +13,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textColor="@android:color/white"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user