From a394613951424203d49ccfab80d758e94d8f0ee9 Mon Sep 17 00:00:00 2001 From: eranl <1707552+eranl@users.noreply.github.com> Date: Wed, 12 Mar 2025 01:47:09 +0200 Subject: [PATCH] Prevent non-TLD hints on period key --- .../keyboard_parser/floris/TextKeyData.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/helium314/keyboard/keyboard/internal/keyboard_parser/floris/TextKeyData.kt b/app/src/main/java/helium314/keyboard/keyboard/internal/keyboard_parser/floris/TextKeyData.kt index d3479dca..757ea9a5 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/internal/keyboard_parser/floris/TextKeyData.kt +++ b/app/src/main/java/helium314/keyboard/keyboard/internal/keyboard_parser/floris/TextKeyData.kt @@ -526,10 +526,11 @@ sealed interface KeyData : AbstractKeyData { return when (label) { KeyLabel.ALPHA, KeyLabel.SYMBOL_ALPHA, KeyLabel.SYMBOL -> Key.LABEL_FLAGS_PRESERVE_CASE or Key.LABEL_FLAGS_FOLLOW_FUNCTIONAL_TEXT_COLOR KeyLabel.COMMA -> Key.LABEL_FLAGS_HAS_POPUP_HINT - // essentially this only changes the appearance of the armenian period key in holo theme + // essentially the first term only changes the appearance of the armenian period key in holo theme KeyLabel.PERIOD -> (Key.LABEL_FLAGS_HAS_POPUP_HINT and - if (params.mId.isAlphabetKeyboard) params.mLocaleKeyboardInfos.labelFlags else 0) or - Key.LABEL_FLAGS_PRESERVE_CASE + if (params.mId.isAlphabetKeyboard) params.mLocaleKeyboardInfos.labelFlags else 0) or + (if (shouldShowTldPopups(params)) 0 else Key.LABEL_FLAGS_DISABLE_HINT_LABEL) or + Key.LABEL_FLAGS_PRESERVE_CASE KeyLabel.ACTION -> { Key.LABEL_FLAGS_PRESERVE_CASE or Key.LABEL_FLAGS_AUTO_X_SCALE or Key.LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO or Key.LABEL_FLAGS_FOLLOW_FUNCTIONAL_TEXT_COLOR or @@ -576,12 +577,14 @@ sealed interface KeyData : AbstractKeyData { private fun getPeriodPopups(params: KeyboardParams): SimplePopups = SimplePopups( - if (Settings.getInstance().current.mShowTldPopupKeys - && params.mId.mSubtype.layouts[LayoutType.FUNCTIONAL] != "functional_keys_tablet" - && params.mId.mMode in setOf(KeyboardId.MODE_URL, KeyboardId.MODE_EMAIL) - ) params.mLocaleKeyboardInfos.tlds + if (shouldShowTldPopups(params)) params.mLocaleKeyboardInfos.tlds else getPunctuationPopupKeys(params) ) + + private fun shouldShowTldPopups(params: KeyboardParams): Boolean = + (Settings.getInstance().current.mShowTldPopupKeys + && params.mId.mSubtype.layouts[LayoutType.FUNCTIONAL] != "functional_keys_tablet" + && params.mId.mMode in setOf(KeyboardId.MODE_URL, KeyboardId.MODE_EMAIL)) } /**