From bf05980349c946d7605190e8619e20f48ddacf9a Mon Sep 17 00:00:00 2001 From: Helium314 Date: Sun, 21 Jan 2024 19:24:09 +0100 Subject: [PATCH] improve layout for gujarati, fixes #417 --- app/src/main/assets/layouts/gujarati.json | 59 +++++++++---------- .../keyboard_parser/LocaleKeyTexts.kt | 3 +- .../settings/PreferencesSettingsFragment.java | 2 +- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/app/src/main/assets/layouts/gujarati.json b/app/src/main/assets/layouts/gujarati.json index 1d761609..119854dd 100644 --- a/app/src/main/assets/layouts/gujarati.json +++ b/app/src/main/assets/layouts/gujarati.json @@ -18,19 +18,19 @@ }, { "$": "shift_state_selector", "manualOrLocked": { "label": "બ" }, - "default": { "label": "◌ુ" } + "default": { "label": "ુ" } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ભ" }, - "default": { "label": "◌ૂ" } + "default": { "label": "ૂ" } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "મ" }, - "default": { "label": "◌ે" } + "default": { "label": "ે" } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ય" }, - "default": { "label": "◌ૈ" } + "default": { "label": "ૈ" } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ર" }, @@ -48,85 +48,82 @@ [ { "$": "shift_state_selector", "manualOrLocked": { "label": "શ" }, - "default": { "label": "ઃ", "popup": { "main": { "label": "૱" } } } + "default": { "label": "ઃ", "popup": { "main": { "label": "ઍ" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ષ" }, - "default": { "label": "ક", "popup": { "main": { "label": "ૅ" } } } + "default": { "label": "ક", "popup": { "main": { "label": "ઑ" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "સ" }, - "default": { "label": "ખ", "popup": { "main": { "label": "ૉ" } } } + "default": { "label": "ખ", "popup": { "main": { "label": "ૅ" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "હ" }, - "default": { "label": "ગ", "popup": { "main": { "label": "઼" } } } + "default": { "label": "ગ", "popup": { "main": { "label": "ૉ" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ળ" }, - "default": { "label": "ઘ", "popup": { "main": { "label": "ૺ" } } } + "default": { "label": "ઘ", "popup": { "main": { "label": "ૃ" } } } }, { "$": "shift_state_selector", - "manualOrLocked": { "label": "ક્ષ" }, - "default": { "label": "ઙ", "popup": { "main": { "label": "ઁ" } } } + "manualOrLocked": { "label": "ક્ષ", "labelFlags": 128 }, + "default": { "label": "ઙ", "popup": { "main": { "label": "ઋ" } } } }, { "$": "shift_state_selector", - "manualOrLocked": { "label": "જ્ઞ" }, - "default": { "label": "ચ", "popup": { "main": { "label": "૾" } } } + "manualOrLocked": { "label": "જ્ઞ", "labelFlags": 128 }, + "default": { "label": "ચ", "popup": { "main": { "label": "ત્ર" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "આ" }, - "default": { "label": "છ", "popup": { "main": { "label": "૿" } } } + "default": { "label": "છ", "popup": { "main": { "label": "ત્ત" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ઇ" }, - "default": { "label": "જ", "popup": { "main": { "label": "ત્ર" } } } + "default": { "label": "જ", "popup": { "main": { "label": "દ્વ" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ઈ" }, - "default": { "label": "ઝ", "popup": { "main": { "label": "શ્ર" } } } + "default": { "label": "ઝ", "popup": { "main": { "label": "દ્ધ" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ઉ" }, - "default": { "label": "ઞ", "popup": { "main": { "label": "શ્ર" } } } + "default": { "label": "ઞ", "popup": { "main": { "label": "દ્ર" } } } } ], [ { "$": "shift_state_selector", "manualOrLocked": { "label": "ઊ" }, - "default": { "label": "ટ", "popup": { "main": { "label": "શ્વ" } } } + "default": { "label": "ટ"} }, { "$": "shift_state_selector", "manualOrLocked": { "label": "એ" }, - "default": { "label": "ઠ", "popup": { "main": { "label": "ત્ત" } } } + "default": { "label": "ઠ", "popup": { "main": { "label": "શ્ર" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ઐ" }, - "default": { "label": "ડ", "popup": { "main": { "label": "દ્ર" } } } + "default": { "label": "ડ", "popup": { "main": { "label": "શ્વ" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ઓ" }, - "default": { "label": "ઢ", "popup": { "main": { "label": "દ્વ" } } } + "default": { "label": "ઢ", "popup": { "main": { "label": "દ્દ" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ઔ" }, - "default": { "label": "ણ", "popup": { "main": { "label": "દ્દ" } } } + "default": { "label": "ણ", "popup": { "main": { "label": "હ્ય" } } } }, { "$": "shift_state_selector", - "manualOrLocked": { "label": "અં" }, - "default": { "label": "ત", "popup": { "main": { "label": "દ્ય" } } } + "manualOrLocked": { "label": "અં", "labelFlags": 128 }, + "default": { "label": "ત", "popup": { "main": { "label": "꠰" } } } }, { "$": "shift_state_selector", - "manualOrLocked": { "label": "અઃ" }, - "default": { "label": "થ", "popup": { "main": { "label": "꠰" } } } + "manualOrLocked": { "label": "અઃ", "labelFlags": 128 }, + "default": { "label": "થ", "popup": { "main": { "label": "꠱" } } } }, { "$": "shift_state_selector", "manualOrLocked": { "label": "ૐ" }, - "default": { "label": "દ", "popup": { "main": { "label": "꠱" } } } + "default": { "label": "દ", "popup": { "main": { "label": "꠲" } } } }, - { "$": "shift_state_selector", - "manualOrLocked": { "label": "ૠ" }, - "default": { "label": "્", "popup": { "main": { "label": "꠲" } } } - } + { "label": "્", "popup": { "main": { "label": "૱" } } } ] ] diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/internal/keyboard_parser/LocaleKeyTexts.kt b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/internal/keyboard_parser/LocaleKeyTexts.kt index e676bfec..fe7e28f6 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/internal/keyboard_parser/LocaleKeyTexts.kt +++ b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/internal/keyboard_parser/LocaleKeyTexts.kt @@ -67,6 +67,7 @@ class LocaleKeyTexts(dataStream: InputStream?, locale: Locale) { val colonSpaceRegex = ":\\s+".toRegex() reader.forEachLine { l -> val line = l.trim() + if (line.isEmpty()) return@forEachLine when (line) { "[morekeys]" -> { mode = READER_MODE_MORE_KEYS; return@forEachLine } "[extra_keys]" -> { mode = READER_MODE_EXTRA_KEYS; return@forEachLine } @@ -284,7 +285,7 @@ private fun getCurrencyKey(locale: Locale): Pair> { return genericCurrencyKey(getCurrency(locale)) if (locale.country != "IN" && locale.language == "ta") return genericCurrencyKey("௹") - if (locale.country == "IN" || locale.language.matches("hi|kn|ml|mr|ta|te".toRegex())) + if (locale.country == "IN" || locale.language.matches("hi|kn|ml|mr|ta|te|gu".toRegex())) return rupee if (locale.country == "GB") return pound diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/PreferencesSettingsFragment.java b/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/PreferencesSettingsFragment.java index 372485de..1e735d69 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/PreferencesSettingsFragment.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/PreferencesSettingsFragment.java @@ -102,7 +102,7 @@ public final class PreferencesSettingsFragment extends SubScreenFragment { final Preference pref = findPreference(Settings.PREF_LOCALIZED_NUMBER_ROW); if (pref == null) return; // locales that have a number row defined (not good to have it hardcoded, but reading a bunch of files may be noticeably slow) - final String[] numberRowLocales = new String[] { "ar", "bn", "fa", "hi", "mr", "ne", "ur" }; + final String[] numberRowLocales = new String[] { "ar", "bn", "fa", "gu", "hi", "mr", "ne", "ur" }; for (final InputMethodSubtype subtype : SubtypeSettingsKt.getEnabledSubtypes(getSharedPreferences(), true)) { if (ArraysKt.any(numberRowLocales, (l) -> l.equals(subtype.getLocale().substring(0, 2)))) { pref.setVisible(true);