mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-21 14:49:10 +00:00
add slavic layouts for new parser
This commit is contained in:
parent
a1dbfedc0b
commit
26c890a3e2
18 changed files with 383 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
|||
[morekeys]
|
||||
и ѝ
|
||||
" ” „ “
|
||||
|
||||
[labels]
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
а ә
|
||||
о ө
|
||||
ь ъ
|
||||
ы і
|
||||
э һ
|
||||
|
||||
[labels]
|
||||
alphabet: АБВ
|
||||
|
|
|
@ -1,2 +1,8 @@
|
|||
[morekeys]
|
||||
ш щ
|
||||
ё е
|
||||
ь ъ
|
||||
в ю
|
||||
|
||||
[labels]
|
||||
alphabet: АБВ
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[morekeys]
|
||||
г ґ
|
||||
ь ъ
|
||||
і ї
|
||||
' ’ ‚ ‘
|
||||
" ” „ “
|
||||
|
||||
|
|
33
app/src/main/assets/layouts/be.txt
Normal file
33
app/src/main/assets/layouts/be.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
й
|
||||
ц
|
||||
у
|
||||
к
|
||||
е
|
||||
н
|
||||
г
|
||||
ш
|
||||
ў
|
||||
з
|
||||
х
|
||||
|
||||
ф @
|
||||
ы #
|
||||
в $$$
|
||||
а %
|
||||
п &
|
||||
р _
|
||||
о /
|
||||
л -
|
||||
д +
|
||||
ж (
|
||||
э )
|
||||
|
||||
я *
|
||||
ч "
|
||||
с '
|
||||
м :
|
||||
і ;
|
||||
т !
|
||||
ь ?
|
||||
б <
|
||||
ю >
|
32
app/src/main/assets/layouts/bulgarian.txt
Normal file
32
app/src/main/assets/layouts/bulgarian.txt
Normal file
|
@ -0,0 +1,32 @@
|
|||
я
|
||||
в
|
||||
е
|
||||
р
|
||||
т
|
||||
ъ
|
||||
у
|
||||
и ѝ
|
||||
о
|
||||
п
|
||||
ч
|
||||
|
||||
а
|
||||
с
|
||||
д
|
||||
ф
|
||||
г
|
||||
х
|
||||
й
|
||||
к
|
||||
л
|
||||
ш
|
||||
щ
|
||||
|
||||
з
|
||||
ь
|
||||
ц
|
||||
ж
|
||||
б
|
||||
н
|
||||
м
|
||||
ю
|
33
app/src/main/assets/layouts/bulgarian_bds.txt
Normal file
33
app/src/main/assets/layouts/bulgarian_bds.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
у
|
||||
е
|
||||
и ѝ
|
||||
ш
|
||||
щ
|
||||
к
|
||||
с
|
||||
д
|
||||
з
|
||||
ц
|
||||
б
|
||||
|
||||
ь
|
||||
я
|
||||
а
|
||||
о
|
||||
ж
|
||||
г
|
||||
т
|
||||
н
|
||||
в
|
||||
м
|
||||
ч
|
||||
|
||||
ю
|
||||
й
|
||||
ъ
|
||||
э
|
||||
ф
|
||||
х
|
||||
п
|
||||
р
|
||||
л
|
33
app/src/main/assets/layouts/bulgarian_bekl.txt
Normal file
33
app/src/main/assets/layouts/bulgarian_bekl.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
у
|
||||
е
|
||||
и ѝ
|
||||
ш
|
||||
щ
|
||||
к
|
||||
с
|
||||
д
|
||||
з
|
||||
ц
|
||||
б
|
||||
|
||||
ь
|
||||
я
|
||||
а
|
||||
о
|
||||
ж
|
||||
г
|
||||
т
|
||||
н
|
||||
в
|
||||
м
|
||||
ч
|
||||
|
||||
ю
|
||||
й ѭ
|
||||
ъ ѫ
|
||||
ѣ
|
||||
ф
|
||||
х
|
||||
п
|
||||
р
|
||||
л
|
33
app/src/main/assets/layouts/kk.txt
Normal file
33
app/src/main/assets/layouts/kk.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
й
|
||||
ц
|
||||
у
|
||||
к
|
||||
е
|
||||
н
|
||||
г
|
||||
ш
|
||||
щ
|
||||
з
|
||||
х
|
||||
|
||||
ф @
|
||||
ы #
|
||||
в $$$
|
||||
а %
|
||||
п &
|
||||
р _
|
||||
о /
|
||||
л -
|
||||
д +
|
||||
ж (
|
||||
э )
|
||||
|
||||
я *
|
||||
ч "
|
||||
с '
|
||||
м :
|
||||
и ;
|
||||
т !
|
||||
ь ?
|
||||
б <
|
||||
ю >
|
33
app/src/main/assets/layouts/ky.txt
Normal file
33
app/src/main/assets/layouts/ky.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
й
|
||||
ц
|
||||
у
|
||||
к
|
||||
е
|
||||
н
|
||||
г
|
||||
ш
|
||||
щ
|
||||
з
|
||||
х
|
||||
|
||||
ф @
|
||||
ы #
|
||||
в $$$
|
||||
а %
|
||||
п &
|
||||
р _
|
||||
о /
|
||||
л -
|
||||
д +
|
||||
ж (
|
||||
э )
|
||||
|
||||
я *
|
||||
ч "
|
||||
с '
|
||||
м :
|
||||
и ;
|
||||
т !
|
||||
ь ?
|
||||
б <
|
||||
ю >
|
33
app/src/main/assets/layouts/mk.txt
Normal file
33
app/src/main/assets/layouts/mk.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
љ
|
||||
њ
|
||||
е
|
||||
р
|
||||
т
|
||||
ѕ
|
||||
у
|
||||
и
|
||||
о
|
||||
п
|
||||
ш
|
||||
|
||||
а
|
||||
с
|
||||
д
|
||||
ф
|
||||
г
|
||||
х
|
||||
ј
|
||||
к
|
||||
л
|
||||
ч
|
||||
ќ
|
||||
|
||||
з
|
||||
џ
|
||||
ц
|
||||
в
|
||||
б
|
||||
н
|
||||
м
|
||||
ѓ
|
||||
ж
|
33
app/src/main/assets/layouts/mongolian.txt
Normal file
33
app/src/main/assets/layouts/mongolian.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
ф
|
||||
ц
|
||||
у
|
||||
ж
|
||||
э
|
||||
н
|
||||
г
|
||||
ш
|
||||
ү
|
||||
з
|
||||
к
|
||||
|
||||
й
|
||||
ы
|
||||
б
|
||||
ө
|
||||
а
|
||||
х
|
||||
р
|
||||
о
|
||||
л
|
||||
д
|
||||
п
|
||||
|
||||
я
|
||||
ч
|
||||
ё
|
||||
с
|
||||
м
|
||||
и
|
||||
т
|
||||
ь
|
||||
в
|
33
app/src/main/assets/layouts/ru.txt
Normal file
33
app/src/main/assets/layouts/ru.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
й
|
||||
ц
|
||||
у
|
||||
к
|
||||
е
|
||||
н
|
||||
г
|
||||
ш
|
||||
щ
|
||||
з
|
||||
х
|
||||
|
||||
ф @
|
||||
ы #
|
||||
в $$$
|
||||
а %
|
||||
п &
|
||||
р _
|
||||
о /
|
||||
л -
|
||||
д +
|
||||
ж (
|
||||
э )
|
||||
|
||||
я *
|
||||
ч "
|
||||
с '
|
||||
м :
|
||||
и ;
|
||||
т !
|
||||
ь ?
|
||||
б <
|
||||
ю >
|
33
app/src/main/assets/layouts/sr.txt
Normal file
33
app/src/main/assets/layouts/sr.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
љ
|
||||
њ
|
||||
е
|
||||
р
|
||||
т
|
||||
з
|
||||
у
|
||||
и
|
||||
о
|
||||
п
|
||||
ш
|
||||
|
||||
а
|
||||
с
|
||||
д
|
||||
ф
|
||||
г
|
||||
х
|
||||
ј
|
||||
к
|
||||
л
|
||||
ч
|
||||
ћ
|
||||
|
||||
ѕ
|
||||
џ
|
||||
ц
|
||||
в
|
||||
б
|
||||
н
|
||||
м
|
||||
ђ
|
||||
ж
|
33
app/src/main/assets/layouts/uk.txt
Normal file
33
app/src/main/assets/layouts/uk.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
й
|
||||
ц
|
||||
у
|
||||
к
|
||||
е
|
||||
н
|
||||
г
|
||||
ш
|
||||
щ
|
||||
з
|
||||
х
|
||||
|
||||
ф @
|
||||
і #
|
||||
в $$$
|
||||
а %
|
||||
п &
|
||||
р _
|
||||
о /
|
||||
л -
|
||||
д +
|
||||
ж (
|
||||
є )
|
||||
|
||||
я *
|
||||
ч "
|
||||
с '
|
||||
м :
|
||||
и ;
|
||||
т !
|
||||
ь ?
|
||||
б <
|
||||
ю >
|
|
@ -63,7 +63,6 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
|||
return this
|
||||
|
||||
// todo: further plan
|
||||
// release next version before continuing, testing current state for a while is likely necessary
|
||||
// migrate other languages/layouts to this style
|
||||
// may be tricky in some cases, like additional row, or no shift key
|
||||
// also the integrated number row is weird together with the number row setting, and should be removed / ignored
|
||||
|
@ -71,6 +70,7 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
|||
// test the zwnj key
|
||||
// label flags: some should be set by keyboard, not by row/letter
|
||||
// e.g. arabic looks weird with number row in holo being bold, but all other letters normal
|
||||
// careful with korean, iirc the layouts are copied somewhere in the code -> try reading them instead of having them duplicate hardcoded
|
||||
// migrate pcqwerty to this style
|
||||
// this will be more complicated...
|
||||
// linked shift keys might be easy
|
||||
|
@ -119,6 +119,9 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
|||
// does glide typing work with multiple letters on one key? if not, users should be notified
|
||||
// maybe allow users to define their own symbol and shift-symbol layouts
|
||||
// allow users to import layouts, which essentially just fills the text from a file
|
||||
// add setting to use moreKeys from symbol layout (always, never, only if none defined)
|
||||
// should also have sth related to hint, because hint and start morekey maybe should stay
|
||||
// option to add extra keys for all layouts?
|
||||
|
||||
// labelFlags should be set correctly
|
||||
// alignHintLabelToBottom: on lxx and rounded themes, but did not find what it actually does...
|
||||
|
@ -153,6 +156,7 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
|||
|
||||
fun loadFromXml(xmlId: Int, id: KeyboardId): KeyboardBuilder<KP> {
|
||||
if (Settings.getInstance().current.mUseNewKeyboardParsing
|
||||
// && id.mElementId != KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED && id.mElementId != KeyboardId.ELEMENT_SYMBOLS_SHIFTED
|
||||
&& this::class == KeyboardBuilder::class // otherwise this will apply to moreKeys and moreSuggestions, and then some parameters are off
|
||||
) {
|
||||
if (loadFromAssets(id) != null)
|
||||
|
|
|
@ -556,16 +556,19 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
|
|||
-> SimpleKeyboardParser(params, context).parseLayoutFromAssets("symbols_shifted")
|
||||
!id.isAlphabetKeyboard -> null
|
||||
layoutFileNames.contains("$layoutName.json") -> JsonKeyboardParser(params, context).parseLayoutFromAssets(layoutName)
|
||||
layoutFileNames.contains("${getSimpleLayoutName(layoutName)}.txt")
|
||||
layoutFileNames.contains("${getSimpleLayoutName(layoutName, params)}.txt")
|
||||
-> SimpleKeyboardParser(params, context).parseLayoutFromAssets(layoutName)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic // unsupported without JvmStatic
|
||||
protected fun getSimpleLayoutName(layoutName: String) = when (layoutName) {
|
||||
// todo: should be removed in the end (after removing old parser), and the internal layout names changed for easier finding
|
||||
// currently it's spread out everywhere... method.xml, locale_and_extra_value_to_keyboard_layout_set_map, getKeyboardLayoutNameForLocale, ...
|
||||
protected fun getSimpleLayoutName(layoutName: String, params: KeyboardParams) = when (layoutName) {
|
||||
"swiss", "german", "serbian_qwertz" -> "qwertz"
|
||||
"nordic", "spanish" -> "qwerty"
|
||||
"south_slavic", "east_slavic" -> params.mId.locale.language // layouts split per language now, much less convoluted
|
||||
else -> layoutName
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class SimpleKeyboardParser(private val params: KeyboardParams, private val conte
|
|||
&& params.mId.mSubtype.keyboardLayoutSetName in listOf("nordic", "spanish", "german", "swiss", "serbian_qwertz")
|
||||
|
||||
override fun getLayoutFromAssets(layoutName: String) =
|
||||
context.assets.open("layouts/${getSimpleLayoutName(layoutName)}.txt").reader().readText()
|
||||
context.assets.open("layouts/${getSimpleLayoutName(layoutName, params)}.txt").reader().readText()
|
||||
|
||||
override fun parseCoreLayout(layoutContent: String): MutableList<List<KeyData>> {
|
||||
val rowStrings = layoutContent.replace("\r\n", "\n").split("\n\n")
|
||||
|
|
Loading…
Add table
Reference in a new issue