diff options
| -rw-r--r-- | CONTRIBUTING.md | 5 | ||||
| -rw-r--r-- | build.gradle | 27 | ||||
| -rw-r--r-- | gen_layouts.py | 13 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 6 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/prefs/LayoutsPreference.java | 2 | ||||
| -rw-r--r-- | srcs/layouts/arab_alt.xml (renamed from res/xml/arab_alt.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/arab_pc.xml (renamed from res/xml/arab_pc.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/arab_pc_ckb.xml (renamed from res/xml/arab_pc_ckb.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/arab_pc_hindu.xml (renamed from res/xml/arab_pc_hindu.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/arab_pc_ir.xml (renamed from res/xml/arab_pc_ir.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/armenian_ph_am.xml (renamed from res/xml/armenian_ph_am.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/beng_national.xml (renamed from res/xml/beng_national.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/beng_provat.xml (renamed from res/xml/beng_provat.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/cyrl_jcuken_ru.xml (renamed from res/xml/cyrl_jcuken_ru.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/cyrl_jcuken_uk.xml (renamed from res/xml/cyrl_jcuken_uk.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/cyrl_ueishsht.xml (renamed from res/xml/cyrl_ueishsht.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/cyrl_yaverti.xml (renamed from res/xml/cyrl_yaverti.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/deva_alt.xml (renamed from res/xml/deva_alt.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/deva_inscript.xml (renamed from res/xml/deva_inscript.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/grek_qwerty.xml (renamed from res/xml/grek_qwerty.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/hang_dubeolsik_kr.xml (renamed from res/xml/hang_dubeolsik_kr.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/hebr_1_il.xml (renamed from res/xml/hebr_1_il.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/hebr_2_il.xml (renamed from res/xml/hebr_2_il.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_azerty_fr.xml (renamed from res/xml/latn_azerty_fr.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_bepo_fr.xml (renamed from res/xml/latn_bepo_fr.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_bone.xml (renamed from res/xml/latn_bone.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_colemak.xml (renamed from res/xml/latn_colemak.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_dvorak.xml (renamed from res/xml/latn_dvorak.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_neo2.xml (renamed from res/xml/latn_neo2.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_br.xml (renamed from res/xml/latn_qwerty_br.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_cz.xml (renamed from res/xml/latn_qwerty_cz.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_es.xml (renamed from res/xml/latn_qwerty_es.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_hu.xml (renamed from res/xml/latn_qwerty_hu.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_lv.xml (renamed from res/xml/latn_qwerty_lv.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_no.xml (renamed from res/xml/latn_qwerty_no.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_pl.xml (renamed from res/xml/latn_qwerty_pl.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_ro.xml (renamed from res/xml/latn_qwerty_ro.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_se.xml (renamed from res/xml/latn_qwerty_se.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_tr.xml (renamed from res/xml/latn_qwerty_tr.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_us.xml (renamed from res/xml/latn_qwerty_us.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwerty_vi.xml (renamed from res/xml/latn_qwerty_vi.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwertz.xml (renamed from res/xml/latn_qwertz.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwertz_cz.xml (renamed from res/xml/latn_qwertz_cz.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwertz_cz_multifunctional.xml (renamed from res/xml/latn_qwertz_cz_multifunctional.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwertz_de.xml (renamed from res/xml/latn_qwertz_de.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwertz_fr_ch.xml (renamed from res/xml/latn_qwertz_fr_ch.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwertz_hu.xml (renamed from res/xml/latn_qwertz_hu.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/latn_qwertz_sk.xml (renamed from res/xml/latn_qwertz_sk.xml) | 0 | ||||
| -rw-r--r-- | srcs/layouts/urdu_phonetic_ur.xml (renamed from res/xml/urdu_phonetic_ur.xml) | 0 |
49 files changed, 26 insertions, 27 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 62b2342..596ea64 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,14 +88,15 @@ Github secret named `DEBUG_KEYSTORE`. ### Adding a layout -Layouts are defined in XML, see `res/xml/latn_qwerty_us.xml`. +Layouts are defined in XML, see `srcs/layouts/latn_qwerty_us.xml`. An online tool for editing layout files written by @Lixquid is available [here](https://unexpected-keyboard-layout-editor.lixquid.com/). Makes sure to specify the `name` attribute like in `latn_qwerty_us.xml`, otherwise the layout won't be added to the app. -The layout file must be placed in the `res/xml/` directory and named according to: +The layout file must be placed in the `srcs/layouts` directory and named +according to: - script (`latn` for latin, etc..) - layout name (eg. the name of a standard) - country code (or language code if more adequate) diff --git a/build.gradle b/build.gradle index b2ea12d..1f12e56 100644 --- a/build.gradle +++ b/build.gradle @@ -115,17 +115,13 @@ tasks.register('genLayoutsList') { tasks.register('checkKeyboardLayouts') { println "\nChecking layouts" - new ByteArrayOutputStream().withStream { bos -> - exec { - def layouts = new File(projectDir, "res/xml").listFiles().findAll { - it.isFile() && it.name.endsWith(".xml") - } - workingDir = projectDir - commandLine("python", "check_layout.py", *layouts) - standardOutput = bos + exec { + def layouts = new File(projectDir, "srcs/layouts").listFiles().findAll { + it.name.endsWith(".xml") } - - new File(projectDir, "check_layout.output").write(bos.toString()) + workingDir = projectDir + commandLine("python", "check_layout.py", *layouts) + standardOutput = new FileOutputStream("${projectDir}/check_layout.output") } } @@ -140,6 +136,7 @@ tasks.register('syncTranslations') { tasks.named("preBuild") { dependsOn += "initDebugKeystore" dependsOn += "copyRawQwertyUS" + dependsOn += "copyLayoutDefinitions" } tasks.register('initDebugKeystore') { @@ -156,7 +153,15 @@ tasks.register('initDebugKeystore') { tasks.register('copyRawQwertyUS') { copy { - from "res/xml/latn_qwerty_us.xml" + from "srcs/layouts/latn_qwerty_us.xml" into "build/generated-resources/raw" } } + +tasks.register('copyLayoutDefinitions') +{ + copy { + from "srcs/layouts" + into "build/generated-resources/xml" + } +} diff --git a/gen_layouts.py b/gen_layouts.py index c2e6e8d..4b8ac59 100644 --- a/gen_layouts.py +++ b/gen_layouts.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Generates the list of layouts in res/values/layouts.xml from the layout files -# in res/xml. Every layouts must have a 'name' attribute to be listed. +# in srcs/layouts. Every layouts must have a 'name' attribute to be listed. import itertools as it import sys, os, glob @@ -11,11 +11,6 @@ import xml.etree.ElementTree as XML # are sorted alphabetically. FIRST_LAYOUTS = [ "latn_qwerty_us", "latn_colemak", "latn_dvorak" ] -# File names that are known not to be layouts. Avoid warning about them. -KNOWN_NOT_LAYOUT = set([ - "number_row", "numpad", "pin", "bottom_row", "settings", "method", - "greekmath", "numeric" ]) - # Read a layout from a file. Returns [None] if [fname] is not a layout. def read_layout(fname): root = XML.parse(fname).getroot() @@ -28,9 +23,7 @@ def read_layouts(files): for layout_file in files: layout_id, _ = os.path.splitext(os.path.basename(layout_file)) layout = read_layout(layout_file) - if layout_id in KNOWN_NOT_LAYOUT: - continue - elif layout == None: + if layout == None: print("Not a layout file: %s" % layout_file) elif layout["name"] == None: print("Layout doesn't have a name: %s" % layout_id) @@ -66,6 +59,6 @@ def generate_arrays(out, layouts): XML.indent(root) XML.ElementTree(element=root).write(out, encoding="unicode", xml_declaration=True) -layouts = sort_layouts(read_layouts(glob.glob("res/xml/*.xml"))) +layouts = sort_layouts(read_layouts(glob.glob("srcs/layouts/*.xml"))) with open("res/values/layouts.xml", "w") as out: generate_arrays(out, layouts) diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index 27ceaf4..dbd9e3e 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -317,9 +317,9 @@ public final class KeyValue { switch (name) { - /* These symbols have special meaning when in `res/xml` and are escaped in - standard layouts. The backslash is not stripped when parsed from the - custom layout option. */ + /* These symbols have special meaning when in `srcs/layouts` and are + escaped in standard layouts. The backslash is not stripped when parsed + from the custom layout option. */ case "\\?": return makeStringKey("?"); case "\\#": return makeStringKey("#"); case "\\@": return makeStringKey("@"); diff --git a/srcs/juloo.keyboard2/prefs/LayoutsPreference.java b/srcs/juloo.keyboard2/prefs/LayoutsPreference.java index 787800c..842a2f2 100644 --- a/srcs/juloo.keyboard2/prefs/LayoutsPreference.java +++ b/srcs/juloo.keyboard2/prefs/LayoutsPreference.java @@ -245,7 +245,7 @@ public class LayoutsPreference extends ListGroupPreference<LayoutsPreference.Lay public SystemLayout() {} } - /** The name of a layout defined in [res/xml]. */ + /** The name of a layout defined in [srcs/layouts]. */ public static final class NamedLayout implements Layout { public final String name; diff --git a/res/xml/arab_alt.xml b/srcs/layouts/arab_alt.xml index 380d206..380d206 100644 --- a/res/xml/arab_alt.xml +++ b/srcs/layouts/arab_alt.xml diff --git a/res/xml/arab_pc.xml b/srcs/layouts/arab_pc.xml index 62b086d..62b086d 100644 --- a/res/xml/arab_pc.xml +++ b/srcs/layouts/arab_pc.xml diff --git a/res/xml/arab_pc_ckb.xml b/srcs/layouts/arab_pc_ckb.xml index 0e9bd4f..0e9bd4f 100644 --- a/res/xml/arab_pc_ckb.xml +++ b/srcs/layouts/arab_pc_ckb.xml diff --git a/res/xml/arab_pc_hindu.xml b/srcs/layouts/arab_pc_hindu.xml index b25eed1..b25eed1 100644 --- a/res/xml/arab_pc_hindu.xml +++ b/srcs/layouts/arab_pc_hindu.xml diff --git a/res/xml/arab_pc_ir.xml b/srcs/layouts/arab_pc_ir.xml index 4b5caa1..4b5caa1 100644 --- a/res/xml/arab_pc_ir.xml +++ b/srcs/layouts/arab_pc_ir.xml diff --git a/res/xml/armenian_ph_am.xml b/srcs/layouts/armenian_ph_am.xml index a11737a..a11737a 100644 --- a/res/xml/armenian_ph_am.xml +++ b/srcs/layouts/armenian_ph_am.xml diff --git a/res/xml/beng_national.xml b/srcs/layouts/beng_national.xml index a3c0d55..a3c0d55 100644 --- a/res/xml/beng_national.xml +++ b/srcs/layouts/beng_national.xml diff --git a/res/xml/beng_provat.xml b/srcs/layouts/beng_provat.xml index ee7be4a..ee7be4a 100644 --- a/res/xml/beng_provat.xml +++ b/srcs/layouts/beng_provat.xml diff --git a/res/xml/cyrl_jcuken_ru.xml b/srcs/layouts/cyrl_jcuken_ru.xml index 81cf35c..81cf35c 100644 --- a/res/xml/cyrl_jcuken_ru.xml +++ b/srcs/layouts/cyrl_jcuken_ru.xml diff --git a/res/xml/cyrl_jcuken_uk.xml b/srcs/layouts/cyrl_jcuken_uk.xml index 905f0e1..905f0e1 100644 --- a/res/xml/cyrl_jcuken_uk.xml +++ b/srcs/layouts/cyrl_jcuken_uk.xml diff --git a/res/xml/cyrl_ueishsht.xml b/srcs/layouts/cyrl_ueishsht.xml index e2972a8..e2972a8 100644 --- a/res/xml/cyrl_ueishsht.xml +++ b/srcs/layouts/cyrl_ueishsht.xml diff --git a/res/xml/cyrl_yaverti.xml b/srcs/layouts/cyrl_yaverti.xml index a228f24..a228f24 100644 --- a/res/xml/cyrl_yaverti.xml +++ b/srcs/layouts/cyrl_yaverti.xml diff --git a/res/xml/deva_alt.xml b/srcs/layouts/deva_alt.xml index 13972dc..13972dc 100644 --- a/res/xml/deva_alt.xml +++ b/srcs/layouts/deva_alt.xml diff --git a/res/xml/deva_inscript.xml b/srcs/layouts/deva_inscript.xml index 0bcd86d..0bcd86d 100644 --- a/res/xml/deva_inscript.xml +++ b/srcs/layouts/deva_inscript.xml diff --git a/res/xml/grek_qwerty.xml b/srcs/layouts/grek_qwerty.xml index f5499ec..f5499ec 100644 --- a/res/xml/grek_qwerty.xml +++ b/srcs/layouts/grek_qwerty.xml diff --git a/res/xml/hang_dubeolsik_kr.xml b/srcs/layouts/hang_dubeolsik_kr.xml index 29dd01b..29dd01b 100644 --- a/res/xml/hang_dubeolsik_kr.xml +++ b/srcs/layouts/hang_dubeolsik_kr.xml diff --git a/res/xml/hebr_1_il.xml b/srcs/layouts/hebr_1_il.xml index bbf5e56..bbf5e56 100644 --- a/res/xml/hebr_1_il.xml +++ b/srcs/layouts/hebr_1_il.xml diff --git a/res/xml/hebr_2_il.xml b/srcs/layouts/hebr_2_il.xml index 090bef8..090bef8 100644 --- a/res/xml/hebr_2_il.xml +++ b/srcs/layouts/hebr_2_il.xml diff --git a/res/xml/latn_azerty_fr.xml b/srcs/layouts/latn_azerty_fr.xml index cf8b185..cf8b185 100644 --- a/res/xml/latn_azerty_fr.xml +++ b/srcs/layouts/latn_azerty_fr.xml diff --git a/res/xml/latn_bepo_fr.xml b/srcs/layouts/latn_bepo_fr.xml index 941c3ee..941c3ee 100644 --- a/res/xml/latn_bepo_fr.xml +++ b/srcs/layouts/latn_bepo_fr.xml diff --git a/res/xml/latn_bone.xml b/srcs/layouts/latn_bone.xml index f9ce147..f9ce147 100644 --- a/res/xml/latn_bone.xml +++ b/srcs/layouts/latn_bone.xml diff --git a/res/xml/latn_colemak.xml b/srcs/layouts/latn_colemak.xml index 1a73fbb..1a73fbb 100644 --- a/res/xml/latn_colemak.xml +++ b/srcs/layouts/latn_colemak.xml diff --git a/res/xml/latn_dvorak.xml b/srcs/layouts/latn_dvorak.xml index cff4c4c..cff4c4c 100644 --- a/res/xml/latn_dvorak.xml +++ b/srcs/layouts/latn_dvorak.xml diff --git a/res/xml/latn_neo2.xml b/srcs/layouts/latn_neo2.xml index 5c364cc..5c364cc 100644 --- a/res/xml/latn_neo2.xml +++ b/srcs/layouts/latn_neo2.xml diff --git a/res/xml/latn_qwerty_br.xml b/srcs/layouts/latn_qwerty_br.xml index e4829ae..e4829ae 100644 --- a/res/xml/latn_qwerty_br.xml +++ b/srcs/layouts/latn_qwerty_br.xml diff --git a/res/xml/latn_qwerty_cz.xml b/srcs/layouts/latn_qwerty_cz.xml index 8d4207c..8d4207c 100644 --- a/res/xml/latn_qwerty_cz.xml +++ b/srcs/layouts/latn_qwerty_cz.xml diff --git a/res/xml/latn_qwerty_es.xml b/srcs/layouts/latn_qwerty_es.xml index cb3c2cc..cb3c2cc 100644 --- a/res/xml/latn_qwerty_es.xml +++ b/srcs/layouts/latn_qwerty_es.xml diff --git a/res/xml/latn_qwerty_hu.xml b/srcs/layouts/latn_qwerty_hu.xml index 1caf242..1caf242 100644 --- a/res/xml/latn_qwerty_hu.xml +++ b/srcs/layouts/latn_qwerty_hu.xml diff --git a/res/xml/latn_qwerty_lv.xml b/srcs/layouts/latn_qwerty_lv.xml index a373eb8..a373eb8 100644 --- a/res/xml/latn_qwerty_lv.xml +++ b/srcs/layouts/latn_qwerty_lv.xml diff --git a/res/xml/latn_qwerty_no.xml b/srcs/layouts/latn_qwerty_no.xml index b86ea34..b86ea34 100644 --- a/res/xml/latn_qwerty_no.xml +++ b/srcs/layouts/latn_qwerty_no.xml diff --git a/res/xml/latn_qwerty_pl.xml b/srcs/layouts/latn_qwerty_pl.xml index 9a5a3ed..9a5a3ed 100644 --- a/res/xml/latn_qwerty_pl.xml +++ b/srcs/layouts/latn_qwerty_pl.xml diff --git a/res/xml/latn_qwerty_ro.xml b/srcs/layouts/latn_qwerty_ro.xml index fdc4232..fdc4232 100644 --- a/res/xml/latn_qwerty_ro.xml +++ b/srcs/layouts/latn_qwerty_ro.xml diff --git a/res/xml/latn_qwerty_se.xml b/srcs/layouts/latn_qwerty_se.xml index bf3bb7d..bf3bb7d 100644 --- a/res/xml/latn_qwerty_se.xml +++ b/srcs/layouts/latn_qwerty_se.xml diff --git a/res/xml/latn_qwerty_tr.xml b/srcs/layouts/latn_qwerty_tr.xml index 229a6d8..229a6d8 100644 --- a/res/xml/latn_qwerty_tr.xml +++ b/srcs/layouts/latn_qwerty_tr.xml diff --git a/res/xml/latn_qwerty_us.xml b/srcs/layouts/latn_qwerty_us.xml index 0d394ac..0d394ac 100644 --- a/res/xml/latn_qwerty_us.xml +++ b/srcs/layouts/latn_qwerty_us.xml diff --git a/res/xml/latn_qwerty_vi.xml b/srcs/layouts/latn_qwerty_vi.xml index b042b1d..b042b1d 100644 --- a/res/xml/latn_qwerty_vi.xml +++ b/srcs/layouts/latn_qwerty_vi.xml diff --git a/res/xml/latn_qwertz.xml b/srcs/layouts/latn_qwertz.xml index 34929f5..34929f5 100644 --- a/res/xml/latn_qwertz.xml +++ b/srcs/layouts/latn_qwertz.xml diff --git a/res/xml/latn_qwertz_cz.xml b/srcs/layouts/latn_qwertz_cz.xml index e3bbae9..e3bbae9 100644 --- a/res/xml/latn_qwertz_cz.xml +++ b/srcs/layouts/latn_qwertz_cz.xml diff --git a/res/xml/latn_qwertz_cz_multifunctional.xml b/srcs/layouts/latn_qwertz_cz_multifunctional.xml index 9fc8dab..9fc8dab 100644 --- a/res/xml/latn_qwertz_cz_multifunctional.xml +++ b/srcs/layouts/latn_qwertz_cz_multifunctional.xml diff --git a/res/xml/latn_qwertz_de.xml b/srcs/layouts/latn_qwertz_de.xml index 122375b..122375b 100644 --- a/res/xml/latn_qwertz_de.xml +++ b/srcs/layouts/latn_qwertz_de.xml diff --git a/res/xml/latn_qwertz_fr_ch.xml b/srcs/layouts/latn_qwertz_fr_ch.xml index b3e4cce..b3e4cce 100644 --- a/res/xml/latn_qwertz_fr_ch.xml +++ b/srcs/layouts/latn_qwertz_fr_ch.xml diff --git a/res/xml/latn_qwertz_hu.xml b/srcs/layouts/latn_qwertz_hu.xml index 61ebf24..61ebf24 100644 --- a/res/xml/latn_qwertz_hu.xml +++ b/srcs/layouts/latn_qwertz_hu.xml diff --git a/res/xml/latn_qwertz_sk.xml b/srcs/layouts/latn_qwertz_sk.xml index 5227370..5227370 100644 --- a/res/xml/latn_qwertz_sk.xml +++ b/srcs/layouts/latn_qwertz_sk.xml diff --git a/res/xml/urdu_phonetic_ur.xml b/srcs/layouts/urdu_phonetic_ur.xml index a1fd561..a1fd561 100644 --- a/res/xml/urdu_phonetic_ur.xml +++ b/srcs/layouts/urdu_phonetic_ur.xml |
