Skip to content

Commit ad6cfa3

Browse files
authored
Revert "Spellcheck locale fix (#1774)" (#1819)
This reverts commit b4d683a.
1 parent 6ab36da commit ad6cfa3

212 files changed

Lines changed: 4 additions & 297 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/src/main/java/com/dessalines/thumbkey/ComposeKeyboardView.kt

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import androidx.compose.runtime.Composable
88
import androidx.compose.runtime.CompositionLocalProvider
99
import androidx.compose.runtime.getValue
1010
import androidx.compose.runtime.livedata.observeAsState
11-
import androidx.compose.runtime.mutableStateOf
12-
import androidx.compose.runtime.remember
13-
import androidx.compose.runtime.setValue
1411
import androidx.compose.ui.platform.AbstractComposeView
1512
import androidx.compose.ui.platform.LocalLayoutDirection
1613
import androidx.compose.ui.unit.LayoutDirection
@@ -37,8 +34,6 @@ class ComposeKeyboardView(
3734
val settings by settingsState
3835
val ctx = context as IMEService
3936

40-
var currentLocaleIndex by remember { mutableStateOf(0) }
41-
4237
ThumbkeyTheme(
4338
settings = settings,
4439
) {
@@ -72,32 +67,17 @@ class ComposeKeyboardView(
7267
?.textProcessor
7368
?.updateCursorPosition(ctx)
7469

75-
// Notify the system of the new locale for spellchecking
76-
ctx.updateInputLocale()
77-
7870
// Display the new layout's name on the screen
7971
if (s.showToastOnLayoutSwitch.toBool()) {
8072
val layoutName = layout.keyboardDefinition.title
81-
val localeCode = layout.keyboardDefinition.locales?.firstOrNull() ?: ""
82-
val message = if (localeCode.isNotEmpty()) "$layoutName: $localeCode" else layoutName
83-
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
73+
Toast
74+
.makeText(context, layoutName, Toast.LENGTH_SHORT)
75+
.show()
8476
}
8577
}
8678
}
8779
}
8880
},
89-
onCycleLocale = {
90-
val locales = ctx.currentKeyboardDefinition?.locales ?: return@KeyboardScreen
91-
if (locales.size > 0) {
92-
currentLocaleIndex = (currentLocaleIndex + 1) % locales.size
93-
val localeCode = locales[currentLocaleIndex]
94-
ctx.setLocale(localeCode)
95-
96-
val layoutName = ctx.currentKeyboardDefinition?.title ?: ""
97-
val message = if (localeCode.isNotEmpty()) "$layoutName: $localeCode" else localeCode
98-
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
99-
}
100-
},
10181
onChangePosition = { f ->
10282
ctx.lifecycleScope.launch {
10383
val state = settingsState.value

app/src/main/java/com/dessalines/thumbkey/IMEService.kt

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package com.dessalines.thumbkey
22

3-
import android.content.Context
43
import android.inputmethodservice.InputMethodService
5-
import android.os.Build
64
import android.util.Log
75
import android.view.inputmethod.CursorAnchorInfo
86
import android.view.inputmethod.EditorInfo
9-
import android.view.inputmethod.InputMethodManager
10-
import android.view.inputmethod.InputMethodSubtype
117
import androidx.lifecycle.Lifecycle
128
import androidx.lifecycle.LifecycleOwner
139
import androidx.lifecycle.LifecycleRegistry
@@ -71,43 +67,6 @@ class IMEService :
7167
super.onStartInput(attribute, restarting)
7268
val view = this.setupView()
7369
this.setInputView(view)
74-
updateInputLocale()
75-
}
76-
77-
fun updateInputLocale() {
78-
val locales = currentKeyboardDefinition?.locales
79-
if (!locales.isNullOrEmpty()) {
80-
setLocale(locales.first())
81-
}
82-
}
83-
84-
fun setLocale(locale: String) {
85-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
86-
try {
87-
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
88-
val imeId = "$packageName/${IMEService::class.java.name}"
89-
90-
val subtype =
91-
InputMethodSubtype
92-
.InputMethodSubtypeBuilder()
93-
.setSubtypeLocale(locale)
94-
.setLanguageTag(locale)
95-
.setSubtypeMode("keyboard")
96-
.setIsAuxiliary(false)
97-
.setOverridesImplicitlyEnabledSubtype(true)
98-
.build()
99-
100-
imm.setAdditionalInputMethodSubtypes(imeId, arrayOf(subtype))
101-
102-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
103-
switchInputMethod(imeId, subtype)
104-
}
105-
106-
Log.d(TAG, "Updated input locale to: $locale")
107-
} catch (e: Exception) {
108-
Log.e(TAG, "Failed to update input locale: ${e.message}")
109-
}
110-
}
11170
}
11271

11372
// Lifecycle Methods

app/src/main/java/com/dessalines/thumbkey/keyboards/ARThumbKeyLevant.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,4 @@ val KB_AR_THUMBKEY_LEVANT: KeyboardDefinition =
9595
shifted = KB_AR_THUMBKEY_LEVANT_MAIN,
9696
numeric = ARABIC_NUMERIC_KEYBOARD,
9797
),
98-
locales = listOf("ar"),
9998
)

app/src/main/java/com/dessalines/thumbkey/keyboards/BGMessagEasePhoneticSymbols.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,5 +256,4 @@ val KB_BG_MESSAGEASE_PHONETIC_SYMBOLS: KeyboardDefinition =
256256
KeyboardDefinitionSettings(
257257
autoCapitalizers = arrayOf(::autoCapitalizeI, ::autoCapitalizeIApostrophe),
258258
),
259-
locales = listOf("bg"),
260259
)

app/src/main/java/com/dessalines/thumbkey/keyboards/BGThumbKeySymbols.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,4 @@ val KB_BG_THUMBKEY_SYMBOLS: KeyboardDefinition =
259259
shifted = KB_GB_THUMBKEY_SYMBOLS_SHIFTED,
260260
numeric = NUMERIC_KEYBOARD,
261261
),
262-
locales = listOf("bg"),
263262
)

app/src/main/java/com/dessalines/thumbkey/keyboards/BRFRThumbKey.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ val KB_BR_FR_THUMBKEY_SHIFTED =
227227
val KB_BR_FR_THUMBKEY: KeyboardDefinition =
228228
KeyboardDefinition(
229229
title = "brezhoneg français thumb-key",
230-
locales = listOf("br", "fr"),
231230
modes =
232231
KeyboardDefinitionModes(
233232
main = KB_BR_FR_THUMBKEY_MAIN,

app/src/main/java/com/dessalines/thumbkey/keyboards/BRFRThumbKeyCompose.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,5 +355,4 @@ val KB_BR_FR_THUMBKEY_COMPOSE: KeyboardDefinition =
355355
shifted = KB_BR_FR_THUMBKEY_COMPOSE_SHIFTED,
356356
numeric = FRENCH_NUMERIC_KEYBOARD,
357357
),
358-
locales = listOf("br", "fr"),
359358
)

app/src/main/java/com/dessalines/thumbkey/keyboards/BRFRThumbKeyV3.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,5 +278,4 @@ val KB_BR_FR_THUMBKEY_V3: KeyboardDefinition =
278278
shifted = KB_BR_FR_THUMBKEY_V3_SHIFTED,
279279
numeric = FRENCH_NUMERIC_KEYBOARD,
280280
),
281-
locales = listOf("br", "fr"),
282281
)

app/src/main/java/com/dessalines/thumbkey/keyboards/BYThumbKey.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,4 @@ val KB_BY_THUMBKEY: KeyboardDefinition =
206206
shifted = KB_BY_THUMBKEY_SHIFTED,
207207
numeric = NUMERIC_KEYBOARD,
208208
),
209-
locales = listOf("be"),
210209
)

app/src/main/java/com/dessalines/thumbkey/keyboards/BYThumbKeySymbols.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,5 +256,4 @@ val KB_BY_THUMBKEY_SYMBOLS: KeyboardDefinition =
256256
shifted = KB_BY_THUMBKEY_SYMBOLS_SHIFTED,
257257
numeric = NUMERIC_KEYBOARD,
258258
),
259-
locales = listOf("be"),
260259
)

0 commit comments

Comments
 (0)