From 209a6673504eba6da8fec3b77ef5e6b7e7fb3feb Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Thu, 8 Jun 2023 08:06:13 +0200 Subject: [PATCH] fix: dark mode compatibility --- .../features/impl/ui/menus/ViewAppearanceHelper.kt | 12 +++++++++++- 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 index ba7d8e59..c122f5b0 100644 --- 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