mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-24 16:46:35 +00:00
add a log message when selected subtype is not found
This commit is contained in:
parent
3a354524f3
commit
246cd6c5cf
1 changed files with 10 additions and 7 deletions
|
@ -98,14 +98,17 @@ fun getSelectedSubtype(prefs: SharedPreferences): InputMethodSubtype {
|
||||||
val subtypes = if (prefs.getBoolean(Settings.PREF_USE_SYSTEM_LOCALES, true)) getDefaultEnabledSubtypes()
|
val subtypes = if (prefs.getBoolean(Settings.PREF_USE_SYSTEM_LOCALES, true)) getDefaultEnabledSubtypes()
|
||||||
else enabledSubtypes
|
else enabledSubtypes
|
||||||
val subtype = subtypes.firstOrNull { localeAndLayout.first == it.locale() && localeAndLayout.second == SubtypeLocaleUtils.getKeyboardLayoutSetName(it) }
|
val subtype = subtypes.firstOrNull { localeAndLayout.first == it.locale() && localeAndLayout.second == SubtypeLocaleUtils.getKeyboardLayoutSetName(it) }
|
||||||
?: subtypes.firstOrNull()
|
if (subtype != null) {
|
||||||
if (subtype == null) {
|
return subtype
|
||||||
val defaultSubtypes = getDefaultEnabledSubtypes()
|
} else {
|
||||||
return defaultSubtypes.firstOrNull { localeAndLayout.first == it.locale() && localeAndLayout.second == SubtypeLocaleUtils.getKeyboardLayoutSetName(it) }
|
Log.w(TAG, "selected subtype $localeAndLayout not found")
|
||||||
?: defaultSubtypes.firstOrNull { localeAndLayout.first.language == it.locale().language && localeAndLayout.second == SubtypeLocaleUtils.getKeyboardLayoutSetName(it) }
|
|
||||||
?: defaultSubtypes.first()
|
|
||||||
}
|
}
|
||||||
return subtype
|
if (subtypes.isNotEmpty())
|
||||||
|
return subtypes.first()
|
||||||
|
val defaultSubtypes = getDefaultEnabledSubtypes()
|
||||||
|
return defaultSubtypes.firstOrNull { localeAndLayout.first == it.locale() && localeAndLayout.second == SubtypeLocaleUtils.getKeyboardLayoutSetName(it) }
|
||||||
|
?: defaultSubtypes.firstOrNull { localeAndLayout.first.language == it.locale().language && localeAndLayout.second == SubtypeLocaleUtils.getKeyboardLayoutSetName(it) }
|
||||||
|
?: defaultSubtypes.first()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setSelectedSubtype(prefs: SharedPreferences, subtype: InputMethodSubtype) {
|
fun setSelectedSubtype(prefs: SharedPreferences, subtype: InputMethodSubtype) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue