mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
better deal with missing layouts in debug mode
This commit is contained in:
parent
d223864c81
commit
dbb966f7af
1 changed files with 8 additions and 3 deletions
|
@ -240,10 +240,15 @@ private fun loadEnabledSubtypes(context: Context) {
|
||||||
for (localeAndLayout in subtypeStrings) {
|
for (localeAndLayout in subtypeStrings) {
|
||||||
require(localeAndLayout.size == 2)
|
require(localeAndLayout.size == 2)
|
||||||
val subtypesForLocale = resourceSubtypesByLocale[localeAndLayout.first()]
|
val subtypesForLocale = resourceSubtypesByLocale[localeAndLayout.first()]
|
||||||
if (DebugFlags.DEBUG_ENABLED) // should not happen, but should not crash for normal user
|
if (subtypesForLocale == null) {
|
||||||
require(subtypesForLocale != null)
|
val message = "no resource subtype for $localeAndLayout"
|
||||||
else if (subtypesForLocale == null)
|
Log.w(TAG, message)
|
||||||
|
if (DebugFlags.DEBUG_ENABLED)
|
||||||
|
Toast.makeText(context, message, Toast.LENGTH_LONG).show()
|
||||||
|
else // don't remove in debug mode
|
||||||
|
removeEnabledSubtype(prefs, localeAndLayout.joinToString(LOCALE_LAYOUT_SEPARATOR))
|
||||||
continue
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
val subtype = subtypesForLocale.firstOrNull { SubtypeLocaleUtils.getKeyboardLayoutSetName(it) == localeAndLayout.last() }
|
val subtype = subtypesForLocale.firstOrNull { SubtypeLocaleUtils.getKeyboardLayoutSetName(it) == localeAndLayout.last() }
|
||||||
?: additionalSubtypes.firstOrNull { it.locale() == localeAndLayout.first() && SubtypeLocaleUtils.getKeyboardLayoutSetName(it) == localeAndLayout.last() }
|
?: additionalSubtypes.firstOrNull { it.locale() == localeAndLayout.first() && SubtypeLocaleUtils.getKeyboardLayoutSetName(it) == localeAndLayout.last() }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue