abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/KeyEventHandler.java
AgeCommit message (Collapse)AuthorFilesLines
2024-01-13Refactor: New namespace for preference classesJules Aguillon1-1/+1
2023-08-26Fix regression on Ctrl on space bar sliderJules Aguillon1-2/+8
This makes Ctrl+move_cursor the same as before 5123ce5.
2023-08-26Disable automatically Shift when pressing CtrlJules Aguillon1-0/+23
Automatic capitalisation might interferes with keyboard shortcuts.
2023-08-17Fix slider movements changing input focusJules Aguillon1-28/+88
The slider was repeatedly sending arrow keys, which change the focused input when the end of a text box is hit. A new key is added that implements cursor movements using the `InputConnection` API. The new keys are defined as `KeyValue.Editing`, which are no longer only context menu actions. The behavior when a selection has started is changed. The selection is modified instead of cleared even when shift isn't pressed or the selection would become empty. Fallbacks to sending arrow keys for editors that do not support the API, like Termux.
2023-06-03Refactor: Handle Event keys in Keyboard2Jules Aguillon1-40/+2
The `KeyEventHandler` class is intended to handle every keys and to call into the main class through a limited API. However, this is not true for `Event` keys, which in practice had each a corresponding API call.
2023-06-03Add Voice Typing keyJules Aguillon1-0/+2
The new key switches to any installed "voice" input method. If several input methods matches, no effort is made to choose. Might misbehave with some input methods other than Google's on API < 28. It is placed on the middle of the arrows on the bottom bar. It is enabled by default and can be removed in the "Extra keys" option. The key is not removed from the keyboard if no voice input method exists.
2023-02-12Option to switch to the previous input methodJules Aguillon1-2/+4
A new option changes the "change_method" into the new "change_method_prev". It switch to the previously used input method. A long press on "change_method_prev" sends "change_method". A new section is added in the settings and existing options are moved.
2023-01-30Modification step for the special layoutJules Aguillon1-12/+15
Refactor, follow up of 90b7944. Add a modification step to the "special" layouts: numpad, greekmath, pin entry. Remove the apply_key0 function, which is not expressive enough. Add an enum instead of yet an other "switch_" function.
2023-01-15Avoid switching back from secondary layout automaticallyJules Aguillon1-2/+3
Stay on the secondary layout after a config refresh or onStartInputView. The information is kept until the keyboard is restarted. Additionally, move tweaking the secondary layout to the Config class now that physical equality is not needed.
2022-12-30Add keys for every context menu actionsJules Aguillon1-7/+20
The most requested keys are undo and redo. Unfortunatly redo doesn't work reliably. The other context menu actions like share, assist and autofill are added even thought they are rarely useful or implemented.
2022-12-29Fix inaccessible text layout from pinJules Aguillon1-2/+2
The "main" layout can now be pin layout. 'SWITCH_TEXT' and 'SWITCH_SECOND_BACK' don't mean to use that.
2022-11-13Add editing keys: copy, paste, cut, select allJules Aguillon1-0/+18
2022-11-13Refactor: Move editing code from to KeyEventHandlerJules Aguillon1-32/+80
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-3/+4
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-10-23Add the capslock keyJules Aguillon1-0/+2
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-07-09Add key for switching to the greekmath paneJules Aguillon1-0/+2
The key is placed on the 3rd row of the numeric pane, by taking some space from the shift key.
2022-06-05Refactor: Separate Events and Keyevents and use enumsJules Aguillon1-19/+17
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: Merge KeyValue.char and code fieldsJules Aguillon1-2/+0
These two fields couldn't have an interesting value at the same time. As we can no longer rely on a special value to distinguish between what's the kind, the kind of the key is explicitly encoded in the two most significative bits of the _flags field. Extra nice thing: This removes the special values 'EVENT_NONE' and 'CHAR_NONE'.
2022-06-05Refactor: Associate key events in KeyModifierJules Aguillon1-21/+0
Two advantages: - No need to distinguish modifiers in KeyEventHandler. The KeyValue is enough to decide what action to do. - Keys are never a Char and Event at the same time, fields can be merged.
2022-06-05Refactor: Abstract KeyValue fieldsJules Aguillon1-25/+37
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-24/+47
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-04-03Add the Programming Layout optionJules Aguillon1-4/+6
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-19Allow modifiers to hide keysJules Aguillon1-1/+0
Modifiers can temporarily remove a key from the layout by returning 'null'. Make sure pointer handling code handle these modified keys gracefully and doesn't trigger a key event and a vibration for the removed key.
2022-03-13Avoid showing some symbols twice in Fn modeJules Aguillon1-0/+2
2022-02-22Send key events for the modifiersJules Aguillon1-15/+36
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-06Add the Meta keyJules Aguillon1-1/+3
Currently using the diamond symbol like the history meta key: https://en.wikipedia.org/wiki/Meta_key However, this key is actually interpreted as the Super/Windows key but Android calls it "meta" internally.
2022-01-09Add the Action keyJules Aguillon1-0/+2
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.
2021-12-28Separate "handler" codeJules Aguillon1-0/+76
As with the previous commit, remove casts of the context. The "handler" object is referenced in the "config" object for now.