commit 209a6673504eba6da8fec3b77ef5e6b7e7fb3feb
parent 983816f504673362731029aa418fffd3c26fae82
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Thu, 8 Jun 2023 08:06:13 +0200
fix: dark mode compatibility
Diffstat:
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/ViewAppearanceHelper.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/ViewAppearanceHelper.kt
@@ -15,10 +15,20 @@ object ViewAppearanceHelper {
"ClickableViewAccessibility"
)
fun applyTheme(viewModel: View, view: TextView) {
+ val sigColorTextPrimary = viewModel.context.theme.obtainStyledAttributes(
+ intArrayOf(
+ viewModel.resources.getIdentifier(
+ "sigColorTextPrimary",
+ "attr",
+ Constants.SNAPCHAT_PACKAGE_NAME
+ )
+ )
+ )
+
val snapchatFontResId = view.context.resources.getIdentifier("avenir_next_medium", "font", "com.snapchat.android")
//remove the shadow
view.setBackgroundColor(0x00000000)
- view.setTextColor(viewModel.resources.getColor(viewModel.resources.getIdentifier("sig_color_text_primary_light", "color", Constants.SNAPCHAT_PACKAGE_NAME), null))
+ view.setTextColor(sigColorTextPrimary.getColor(0, 0))
view.setShadowLayer(0F, 0F, 0F, 0)
view.outlineProvider = null
view.gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL