diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/extensions/Context.kt index 8b842be..75e8aa8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/extensions/Context.kt @@ -149,7 +149,7 @@ fun Context.setupKeyboardDialogStuff( } fun Context.getKeyboardLanguages(): ArrayList { - val languages = Language.values().map { RadioItem(it.ordinal, it.getName(this)) } + val languages = Language.sorted(this).map { RadioItem(it.ordinal, it.getName(this)) } return ArrayList(languages) } diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/Language.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/Language.kt index e48a655..c90dee3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/Language.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/Language.kt @@ -69,6 +69,8 @@ enum class Language(@StringRes private val stringRes: Int, private val layout: I } companion object { + fun sorted(context: Context) = Language.values().sortedBy { context.getString(it.stringRes) } + fun getKeyboardLayout(keyboardLanguage: Int): Int { return Language.values().getOrElse(keyboardLanguage) { ENGLISH_QWERTY }.layout }