mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-24 08:36:26 +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()
|
||||
else enabledSubtypes
|
||||
val subtype = subtypes.firstOrNull { localeAndLayout.first == it.locale() && localeAndLayout.second == SubtypeLocaleUtils.getKeyboardLayoutSetName(it) }
|
||||
?: subtypes.firstOrNull()
|
||||
if (subtype == null) {
|
||||
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()
|
||||
if (subtype != null) {
|
||||
return subtype
|
||||
} else {
|
||||
Log.w(TAG, "selected subtype $localeAndLayout not found")
|
||||
}
|
||||
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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue