From e324057de27388546c39bbbbe6a7156aa8f9b3eb Mon Sep 17 00:00:00 2001 From: Nehemiah of Zebulun Date: Tue, 5 Sep 2023 14:13:26 +0200 Subject: [PATCH] Allowing overrides to input method based on package name --- app/src/main/java/net/mezimmah/wkt9/WKT9.kt | 18 ++++++++++++------ app/src/main/res/values/strings.xml | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/net/mezimmah/wkt9/WKT9.kt b/app/src/main/java/net/mezimmah/wkt9/WKT9.kt index 1810b8f..c2cbf5a 100644 --- a/app/src/main/java/net/mezimmah/wkt9/WKT9.kt +++ b/app/src/main/java/net/mezimmah/wkt9/WKT9.kt @@ -215,12 +215,18 @@ class WKT9: InputMethodService(), SpellCheckerSession.SpellCheckerSessionListene cursorPosition = attribute?.initialSelEnd ?: 0 // spellCheckerSession = textServiceManager.newSpellCheckerSession(null, locale, this, false) - when (inputClass) { - InputType.TYPE_CLASS_DATETIME, - InputType.TYPE_CLASS_NUMBER, - InputType.TYPE_CLASS_PHONE -> enableInputMode(WKT9InputMode.NUMERIC) - InputType.TYPE_CLASS_TEXT -> enableTextInputMode(typeVariation, typeFlags) - else -> enableInputMode(WKT9InputMode.IDLE) + val forceNumeric = resources.getStringArray(R.array.input_mode_numeric) + + if (forceNumeric.contains(attribute?.packageName)) enableInputMode(WKT9InputMode.NUMERIC) + else { + when (inputClass) { + InputType.TYPE_CLASS_DATETIME, + InputType.TYPE_CLASS_NUMBER, + InputType.TYPE_CLASS_PHONE -> enableInputMode(WKT9InputMode.NUMERIC) + + InputType.TYPE_CLASS_TEXT -> enableTextInputMode(typeVariation, typeFlags) + else -> enableInputMode(WKT9InputMode.IDLE) + } } updateInputStatus() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f807f0c..b310fb3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -12,4 +12,8 @@ whisper_url Whisper Server URL Provide an URL to the Whisper server. + + + org.linphone + \ No newline at end of file