abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Keyboard2.java
AgeCommit message (Collapse)AuthorFilesLines
2022-12-14Fix pin entry layout not showing upJules Aguillon1-0/+2
The regular text layout was showing instead of the pin entry due to a misuse of the 'switch' syntax.
2022-12-14Fix keyboard not showing up after rotationJules Aguillon1-4/+4
'setInputView()' must be called on every 'onStartInputView()', not just when the view is re-created. This is broken since bf31872.
2022-12-11Handle configuration change quicklyJules Aguillon1-25/+31
setInputView() was not called when the view was re-created through refresh_config(). Also, the refresh_config() function was not able to properly set the current layout. Now keep the default layout (_localeTextLayout) and the current non-text layout (if any, _currentSpecialLayout) separately to be able to refresh them later. setInputView() is called everytime the view is created instead of by onStartInputView() specifically. The setting activity now save the preferences to the protected storage in onStop() instead of listening for onSharedPreferenceChanged.
2022-11-26Refactor: Pass layout as a KeyboardData instead of IDJules Aguillon1-23/+20
Parse layouts sooner.
2022-11-26Stop using deprecated 'shouldOfferSwitchingToNextInputMethod'Jules Aguillon1-1/+4
This function has been introduced in API 19 and deprecated in API 28. There was no version check for API 19 but instead of adding these, simply remove the feature for API under 28.
2022-11-13Refactor: Move editing code from to KeyEventHandlerJules Aguillon1-55/+16
Remove the code dealing with InputMethodConnection from 'Keyboard2' and move it into 'KeyEventHandler', where more editing actions can now be implemented. Autocapitalisation is also moved, the IReceiver interface is simplified.
2022-11-13Allow switching quickly between two layoutsJules Aguillon1-8/+8
A new option allow to choose a secondary layout, the switching key is placed on the top edge of the space bar. The "Programming layout" option was basically doing that but it was possible to choose from a few layouts only. It is improved and renamed. The 'LayoutListPreference' allows setting the string for the first entry but otherwise share the rest of the array. Add nice icons from materialdesignicons.
2022-11-11Direct-boot aware preferencesJules Aguillon1-13/+11
Store preferences in device protected storage, which is available before the device is unlocked. The keyboard was crashing when trying to access the encrypted preferences. The emoji pane uses a separate preferences file, the old data is lost. The SettingsActivity can't easily use the new preferences storage. Instead, it continues to use the "default" preferences store, which is copied back to the protected storage when needed.
2022-11-06Enable pin layout for decimal and signed inputsJules Aguillon1-2/+0
Decimal and signed inputs are more common than expected. Adding a few keys is enough to support these.
2022-10-24Add the pin entry layoutJules Aguillon1-4/+17
The layout is used for phone number and datetime input boxes as well as some numbers. It is easier to use when the full numeric layout is not needed.
2022-10-23Add the capslock keyJules Aguillon1-2/+7
The key enable caps lock immediately. It does nothing if caps lock is already enabled. It is not present on the keyboard by default but a place is defined on every layout, top-right of the shift key. It can be enabled in the settings. The icon is from materialdesignicons.com.
2022-10-16Autocapitalisation: Avoid trigerring when Ctrl+DelJules Aguillon1-1/+1
Autocapitalisation could trigger while repeatedly typing Ctrl+Del to remove several words.
2022-10-16Disable fullscreen modeJules Aguillon1-0/+7
This mode is annoying to some users and is disabled in most text views. The keyboard has a fixed sized relative to the height of the screen in landscape mode. The keyboard can't take more space than expected, currently. This might cause problems in the future and might be hidden behind an option if one is found. Every text views so far seemed to behave fine.
2022-10-15Fix crash due to auto capitalisationJules Aguillon1-2/+3
It is unclear how _autocap.started is not called first but nothing is preventing to initialize things earlier.
2022-09-24Fix an unexplained crash encountered in the wildJules Aguillon1-2/+10
For some reason, 'subtype' can be null. Perhaps because the keyboard is started before the IMM is ready.
2022-09-24Fix autocapitalisation randomly not triggeredJules Aguillon1-12/+7
The autocapitalisation is asking the editor about whether to enable shift and must make sure to ask after the editor is done processing the events.
2022-09-19Add the Extra Keys optionJules Aguillon1-3/+3
Allows to add more keys to the keyboard from a predefined list. The implementation doesn't use MultiSelectListPreference because it doesn't seem possible to change the item layout to properly show the rendered symbols.
2022-07-30Standard auto-capitalisation only after spaceJules Aguillon1-2/+1
Change the capitalisation algorithm to use Android's 'getCursorCapsMode'. This requires a bit of cursor calculations but should feel more standard. The auto completion only triggers after a space is typed or backspace is pressed.
2022-07-24Avoid automatic capitalisation when using arrowsJules Aguillon1-2/+7
Disable capitalisation just after an arrow kind is pressed to avoid interrupting navigation.
2022-07-24Automatic capitalisation at beginning of sentencesJules Aguillon1-2/+25
Keep track of end-of-sentence characters while typing and automatically enable shift when appropriate. The last few characters just before the cursor need to be queried in some cases: Begin of input, cursor has moved or text is deleted. This might have a performance cost. This normally only enable shift but it also needs to disable shift when the cursor moves.
2022-07-09Add key for switching to the greekmath paneJules Aguillon1-0/+5
The key is placed on the 3rd row of the numeric pane, by taking some space from the shift key.
2022-06-24Fix localized key not in predefined positionJules Aguillon1-3/+2
The "loc " prefix for predefining a place for an "extra key" was broken since 31d6a70. The FLAG_LOCALIZED flag cannot be used anymore, as adding it to any key would turn it into a different key that wouldn't be recognized by parts of the code comparing the keys (placing the extra keys). Add an other layer in KeyboardData to store such informations.
2022-06-06Remove the option "Show every accents"Jules Aguillon1-2/+2
This option cannot be implemented easily now that the set of "accents" (localized keys) isn't defined.
2022-06-06Refactor: Remove KeyValue.nameJules Aguillon1-4/+4
This makes KeyValue objects smaller. 'equals' and 'hashCode' are now implemented too. Key names are still used to recognise keys with special meaning, but not for comparing keys anymore.
2022-06-05Refactor: Separate Events and Keyevents and use enumsJules Aguillon1-1/+1
Negative values for internal events are preventing further refactoring. Add a new kind of key and split internal events (now Event) and Android's key events (now Keyevent). Use enums events and modifiers outside of the KeyValue class. Internally, they are converted to and from integer.
2022-06-05Refactor: Abstract KeyValue fieldsJules Aguillon1-1/+3
The meaning of the public fields of KeyValue was quite complicated and not handled consistently accross the app. Make these fields private and add a more abstract API on top. The meaning of these fields changed recently and it wasn't an easy change. I plan on making more changes in the future.
2022-06-05Stop using flags for modifiersJules Aguillon1-1/+1
There was no free bits left to add new modifiers. Instead of increasing the width of the 'flags' field, refactor the way modifiers are represented and used. Modifers are now represented as independent values and stored in the 'code' field. A flag is added to distinguish between modifiers and keys with a key event. The most notable change is that modifiers can no longer be or-ed into a single value but have to be represented as an array.
2022-05-29Automatically place localized keys on the layoutsJules Aguillon1-1/+1
Layouts no longer need to mention every localized keys and dead keys. They are now placed automatically starting from the second row on the bottom-right corner. The "loc " prefix is not removed to still be able to define a more optimal and consistent placement for some extra keys (eg. 'ß' near 's'). Programming layouts no longer need to place every dead keys.
2022-05-01Fix crash when IME not enabledJules Aguillon1-1/+2
This is unexpected but happened to a user. Perhaps because the OS returned bogus or fake results in imm.getEnabledInputMethodList ?
2022-04-16Fix compatibility with Android 6Jules Aguillon1-4/+7
Android 6 uses Java 1.7, the only incompatible feature in use was lambdas.
2022-04-03Add the Programming Layout optionJules Aguillon1-4/+23
Allow specifying a layout for programming and add a key for switching to it easily. The switching key is placed on the top edge of the space bar. The option has no effect by default because the ergonomic isn't ideal, it needs to be enabled explicitly. Users of Latin-script languages certainly prefer to use one layout (for programming or not). This feature might be removed in favor of a better language-switching mechanisms in the future.
2022-03-16Show the switching key if there's several languagesJules Aguillon1-1/+4
Ensure the switching key is shown when there's several subtypes enabled, even if Android says not to show it.
2022-03-15Log editor infos while debuggingJules Aguillon1-0/+19
Useful when debugging why the keyboard doesn't work as expected with a specific app.
2022-03-13Define localized keys as a set instead of flagsJules Aguillon1-14/+18
Using flags for removing keys like € and ß need too many flags and won't scale to more localized keys.
2022-03-05Fix action key not updating when switching fieldJules Aguillon1-1/+2
The keyboard was updated before the action key is.
2022-02-22Send key events for the modifiersJules Aguillon1-4/+2
Before sending a key event while modifiers are active, send events for the modifier keys. Some applications don't look at the "metaState" flags but instead keep track of the up and down events for the modifiers. For example, the basic text views that are in every applications correctly handle the "metaState" flags except for one binding: Selecting text with the arrows while pressing shift.
2022-02-19Localize € and £Jules Aguillon1-0/+2
Show these characters only for users that have the corresponding locale installed (a supported eu language for €, en-GB for £). Add these characters to most layouts.
2022-02-07Define the bottom row separatelyJules Aguillon1-18/+3
Avoid divergences when the bottom row is modified.
2022-01-30Select theme depending on system settingsJules Aguillon1-15/+17
Automatically choose between the Dark and Light themes.
2022-01-30Improve Action key detectionJules Aguillon1-3/+3
There were two problems: - The Action key was swapped when it shouldn't be. The flag 'IME_FLAG_NO_ENTER_ACTION' wasn't interpreted correctly for inputs that specified both an action and this flag. - The value 'IME_ACTION_UNSPECIFIED' should remove the Action key.
2022-01-23Globe key: Open keyboard switching dialogJules Aguillon1-1/+3
instead of immediately switching to the next input method.
2022-01-23Make action key labels translatableJules Aguillon1-6/+8
2022-01-20Fix crash when switching appJules Aguillon1-0/+10
2022-01-15German keyboard added (#20)Moini1-1/+1
* Add German metadata translation * Add German keyboard Co-authored-by: Jules Aguillon <jules@j3s.fr>
2022-01-10Swap the Enter and Action keys when neededJules Aguillon1-0/+3
When IME_FLAG_NO_ENTER_ACTION is set.
2022-01-09Add the Action keyJules Aguillon1-0/+43
It is placed on the top-right of the enter key on every layouts. It sends a special event (performEditorAction) instead of writing a newline. The "actionId" is passed through the EditorInfo object in an obfuscated way so it's not clear whether it's using the right one.
2022-01-09Allow to hide more keys than just accentsJules Aguillon1-14/+13
Add the "FLAGS_LANGS" set of flags, which will be used to hide individual keys that are not accents.
2021-12-30Add themesJules Aguillon1-18/+16
Add a "Theme" option to choose between a dark and light theme. The light theme uses the colors of the dark theme with the luminance inversed. The reloading after a configuration change is changed slightly: - Special handling is needed when the Theme is changed (recreate the views) - The default implementation of 'onConfigurationChanged' is used Which triggers more refresh (but don't recreate the views) - 'onCreateInputView' is no longer needed
2021-12-28Reference the "special key font" in the Theme objectJules Aguillon1-7/+0
Remove the last cast of the context.
2021-12-28Separate "handler" codeJules Aguillon1-56/+40
As with the previous commit, remove casts of the context. The "handler" object is referenced in the "config" object for now.