From 8b11ce27832d4a309dcc865fce7c1beff5d7790b Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:31:42 +0200 Subject: [PATCH] fix(core/ui): fallback typeface --- .../main/kotlin/me/rhunk/snapenhance/core/ui/UserInterface.kt | 2 +- .../me/rhunk/snapenhance/core/ui/menu/impl/ChatActionMenu.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/UserInterface.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/UserInterface.kt index 250a1d3b..e33eee37 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/UserInterface.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/UserInterface.kt @@ -19,7 +19,7 @@ class UserInterface( val actionSheetBackground get() = if (context.androidContext.isDarkTheme()) 0xff1e1e1e.toInt() else 0xffffffff.toInt() val avenirNextTypeface: Typeface by lazy { - fontMap[600]?.let { context.resources.getFont(it) } ?: throw IllegalStateException("Avenir Next not loaded") + fontMap[600]?.let { context.resources.getFont(it) } ?: Typeface.MONOSPACE } fun dpToPx(dp: Int): Int { diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/menu/impl/ChatActionMenu.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/menu/impl/ChatActionMenu.kt index 81c41f01..643876ee 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/menu/impl/ChatActionMenu.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/menu/impl/ChatActionMenu.kt @@ -101,7 +101,7 @@ class ChatActionMenu : AbstractMenu() { this@ChatActionMenu.context.userInterface.apply { background = createRoundedBackground(actionSheetBackground, 16F, true) setTextColor(colorPrimary) - typeface = resources.getFont(getFontResource(600) ?: throw IllegalStateException("Avenir Next not loaded")) + typeface = this@ChatActionMenu.context.userInterface.avenirNextTypeface } isAllCaps = false setShadowLayer(0F, 0F, 0F, 0)