-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
위젯 다크 모드 추가 #384
위젯 다크 모드 추가 #384
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val sharedPreferences = context.getSharedPreferences(SNUTTStorage.DOMAIN_SCOPE_CURRENT_VERSION, Context.MODE_PRIVATE) | ||
val themeMode = sharedPreferences.getString("theme_mode", null) ?: "" | ||
val isDarkMode = when (themeMode) { | ||
"\"DARK\"" -> true | ||
"\"LIGHT\"" -> false | ||
else -> isSystemDarkMode(context) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
생각보다 앱 내 화면 모드를 가져오는게 어렵지 않았어
만약 그냥 시스템 모드를 가져오는거로 바꾼다면 저 isSystemDarkMode()만 쓰면 되는 상황
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어 isSystemDarkMode 이거 composable 함수인줄 알았는데 아니었구나 ㅋㅋㅋ 굳굳
setBackgroundColor( | ||
if (isDarkMode) Color.rgb(43, 43, 43) else Color.rgb(255, 255, 255), | ||
) | ||
linePaint.apply { | ||
color = if (isDarkMode) Color.rgb(60, 60, 60) else Color.rgb(235, 235, 235) | ||
} | ||
subLinePaint.apply { | ||
color = if (isDarkMode) Color.rgb(60, 60, 60) else Color.rgb(243, 243, 243) | ||
} | ||
hourLabelTextPaint.apply { | ||
color = if (isDarkMode) Color.rgb(119, 119, 119) else Color.rgb(0, 0, 0) | ||
} | ||
dayLabelTextPaint.apply { | ||
color = if (isDarkMode) Color.rgb(119, 119, 119) else Color.rgb(0, 0, 0) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Color... 좀 마음에 안들게 가져오는데 SNUTTColors꺼를 갖다 쓰는게 안되니
개선한다면 그냥 상수로 들고 있다가 가져오는 정도...가 최선일것 같기도 하고...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일단 싸게싸게 ㄱㄱ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아주훌륭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고많았어 🧇🧇🧇
"\"DARK\"" -> true | ||
"\"LIGHT\"" -> false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 SharedPreference에 ThemeMode 저장할 때 큰따옴표도 같이 저장돼??
직렬화할 때 MoshiSerializer#serialize()
타는 거 같은데 moshi가 그렇게 동작하는건가
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
음 그러게 ThemeMode가 Enum이라 그런가
저장할 때 직렬화를 하는데, getSharedPreferences로 가져와서 그럴까..?
이유는 생각 안해보긴 했어.. ㅋㅋㅋㅋ
No description provided.