diff options
| author | Jules Aguillon | 2026-02-02 00:20:00 +0100 |
|---|---|---|
| committer | GitHub | 2026-02-02 00:20:00 +0100 |
| commit | 77c4a27c4c37b3620defcab94ffd1b2f536c88cb (patch) | |
| tree | 1bf2c5b723e1f86b0904257e7e57f4fda15378e9 /srcs/juloo.keyboard2/Config.java | |
| parent | 2ecf93d9904544ee73159e9f0ee74b49057bca6c (diff) | |
| download | unexpected-keyboard-77c4a27c4c37b3620defcab94ffd1b2f536c88cb.tar.gz unexpected-keyboard-77c4a27c4c37b3620defcab94ffd1b2f536c88cb.zip | |
Spell checking (#1137)
This adds dictionary-based spell checking to the keyboard. The keyboard looks at the word being typed and matches it against a dictionary to either complete the rest of the word or find alternative spellings.
The core of this feature is implemented in cdict, which is included as a
submodule in vendor/cidct.
Cdict is developped at https://github.com/Julow/cdict
The dictionaries are hosted at https://github.com/Julow/Unexpected-Keyboard-dictionaries/
The wordlists used to build the dictionaries are the same ones used by
HeliBoard from https://codeberg.org/Helium314/aosp-dictionaries
- Add an activity accessible from the launcher app that lists available
dictionaries with a download button.
The DictionaryListView view shows the list of available dictionaries and
handles downloading and installing them.
- The Dictionaries class manages installed dictionaries. Dictionaries are
installed as individual files into the app's private directory.
- Available dictionaries are listed in dictionaries.xml, which is generated
when building Unexpected-Keyboard-dictionaries.
method.xml mentions the dictionary name for each locales.
Diffstat (limited to 'srcs/juloo.keyboard2/Config.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Config.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 16a92ef..18e9fe7 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -8,6 +8,8 @@ import android.util.TypedValue; import java.util.ArrayList; import java.util.List; import java.util.Map; +import juloo.cdict.Cdict; +import juloo.keyboard2.dict.Dictionaries; import juloo.keyboard2.prefs.CustomExtraKeysPreference; import juloo.keyboard2.prefs.ExtraKeysPreference; import juloo.keyboard2.prefs.LayoutsPreference; @@ -80,8 +82,8 @@ public final class Config public ExtraKeys extra_keys_subtype; public Map<KeyValue, KeyboardData.PreferredPos> extra_keys_param; public Map<KeyValue, KeyboardData.PreferredPos> extra_keys_custom; - - public final IKeyEventHandler handler; + public Cdict current_dictionary = null; // Might be 'null'. + public IKeyEventHandler handler; public boolean orientation_landscape = false; public boolean foldable_unfolded = false; public boolean wide_screen = false; @@ -90,7 +92,8 @@ public final class Config int current_layout_narrow; int current_layout_wide; - private Config(SharedPreferences prefs, Resources res, IKeyEventHandler h, Boolean foldableUnfolded) + private Config(SharedPreferences prefs, Resources res, + Boolean foldableUnfolded, Dictionaries dicts) { _prefs = prefs; editor_config = new EditorConfig(); @@ -100,17 +103,16 @@ public final class Config labelTextSize = 0.33f; sublabelTextSize = 0.22f; // from prefs - refresh(res, foldableUnfolded); + refresh(res, foldableUnfolded, dicts); // initialized later shouldOfferVoiceTyping = false; extra_keys_subtype = null; - handler = h; } /* ** Reload prefs */ - public void refresh(Resources res, Boolean foldableUnfolded) + public void refresh(Resources res, Boolean foldableUnfolded, Dictionaries dicts) { DisplayMetrics dm = res.getDisplayMetrics(); orientation_landscape = res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; @@ -289,10 +291,10 @@ public final class Config private static Config _globalConfig = null; public static void initGlobalConfig(SharedPreferences prefs, Resources res, - IKeyEventHandler handler, Boolean foldableUnfolded) + Boolean foldableUnfolded, Dictionaries dicts) { migrate(prefs); - _globalConfig = new Config(prefs, res, handler, foldableUnfolded); + _globalConfig = new Config(prefs, res, foldableUnfolded, dicts); LayoutModifier.init(_globalConfig, res); } |
