Merge branch 'languages_refactoring' into scandinavian_language_layouts
This commit is contained in:
commit
535409e9ee
|
@ -149,7 +149,7 @@ fun Context.setupKeyboardDialogStuff(
|
|||
}
|
||||
|
||||
fun Context.getKeyboardLanguages(): ArrayList<RadioItem> {
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue