abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Keyboard2View.java
AgeCommit message (Collapse)AuthorFilesLines
2023-03-05Refactor: Remove KeyboardData.CornerJules Aguillon1-5/+5
The Corner class is removed. The "localized" flag for all the corners is held in a bitfield.
2023-03-03Allow 8 symbols per keyJules Aguillon1-19/+21
'Keyboard.Key' now contains an array of size 9, giving each keyvalue an index. The algorithm for finding the nearest key during a swipe now needs 16 segments, which are now calculated as an angle. The algorithm does one more interation instead of 2 more, slightly reducing the sensitivity of corner values. The 'getAtDirection' function is moved into the Pointers class to clearly separate the two systems. The 'edgekey' attribute is now obsolete but is kept for compatibility. The flag is removed internally, key index are simply translated. Similarly, the 'slider' attribute now act on keys at index 5 and 6 instead of 2 and 3.
2023-03-02Fix caps lock stopped by auto-capitalisationJules Aguillon1-0/+9
Auto-capitalisation triggers when the backspace key is used. Make sure to not remove a locked shift pointer.
2023-02-26Fix miscalculated keyboard height with number rowJules Aguillon1-1/+0
The 'keysHeight' field needs to be updated. As this class is not intended to be mutable, copy the list of rows and call the constructor. Also remove an unecessary component of the keyboard height calculation.
2023-01-30Apply modify_layout to text layout onlyJules Aguillon1-1/+1
Refactor. Allows to remove the 'extra_keys' and 'num_pad' flags and to implement more complicated transformations to the layouts.
2023-01-15Separate option for bottom margin in landscape modeJules Aguillon1-2/+2
A large margin in portrait mode is desirable but generally not in landscape mode.
2023-01-15Separate option for horizontal margin in landscape modeJules Aguillon1-5/+5
A separate option is needed, the +25dp offset wasn't enough.
2022-12-11Make the keyboard transparent (#252)Chasm Solacer1-2/+6
* Add option for keyboard opacity (transparency). Keyboard background, keys and pressed keys can be adjusted separately. * Make the borders transparent as well * Moved setAlphas outside drawKeyFrame to top of onDraw method
2022-12-04Correctly handle pointer cancel eventsJules Aguillon1-1/+1
The cancel event ends the motion, it doesn't apply to a single pointer like it was previously expected.
2022-11-13Fix missing version checkJules Aguillon1-7/+10
setSystemGestureExclusionRects is API 29. Broken since d644d2b, which almost got into the release!
2022-11-13Draw borders and update themesJules Aguillon1-3/+37
Themes can define the color of each borders independently. Every borders must have the same width for now. It's possible to set a different width when the key is activated, thought this is only used to remove borders. The 4 themes are updated to take advantage of borders.
2022-11-13Highlight activated keys labelJules Aguillon1-3/+2
Rendering change only.
2022-11-13Refactor: Move editing code from to KeyEventHandlerJules Aguillon1-2/+2
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-11Add option for brightness of labelsJules Aguillon1-0/+2
The brightness value is used as the alpha value when drawing the labels.
2022-11-11Dim secondary keysJules Aguillon1-4/+6
Reduce the constrast of "secondary" labels. Modifiers (except diacritics), event and keyevent keys are considered secondary.
2022-11-11Disable the back-gesture on the keyboard areaJules Aguillon1-0/+16
as well as other system gestures that would interfere with the keyboard's own swipe gesture.
2022-10-24Draw letter indication on the pin layoutJules Aguillon1-1/+18
There is no way to type letters on the pin layout, the indication are decoration only. Use the E.161 standard.
2022-10-23Add optional NumPadGero Streng1-2/+6
Shows a NumPad depending on preference: Never/Landscape/Always
2022-10-23Add the capslock keyJules Aguillon1-2/+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-09-24Improve the auto capitalisationJules Aguillon1-17/+15
- Detect when the input box is cleared - Avoid looking up keys on the keyboard every time the shift state needs to change.
2022-07-30Fix crash when auto-capitalisation runs too soonJules Aguillon1-0/+2
This is unexpected but happens once.
2022-07-24Hold any modifier to lockJules Aguillon1-1/+3
Modifiers can be locked with a long press. The key repeat mechanism is re-used and the press timeout is the same. Every modifiers can be locked that way, not only the "lockable" ones. The previous behavior can be enabled in the settings (for shift only) but the default is changed.
2022-07-24Automatic capitalisation at beginning of sentencesJules Aguillon1-0/+21
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-06-24Revert "Remove the vibration settings"Jules Aguillon1-0/+2
Bring back the "Vibration" option. The duration option isn't added back because the vibration settings are still handled by Android. In fact, the option has no effect if the vibration are disabled in the system settings. This partially reverts commit ef03dfed5c802a855c4655204eee39a8769cfed7.
2022-06-24Fix localized key not in predefined positionJules Aguillon1-12/+16
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 interval between vibrationsJules Aguillon1-12/+3
This is no longer necessary since repeating key no longer cause a vibration.
2022-06-06Remove the vibration settingsJules Aguillon1-11/+4
Instead of using the vibrator directly, use performHapticFeedback, which will integrate better with the system settings.
2022-06-05Refactor: Abstract KeyValue fieldsJules Aguillon1-6/+6
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-11/+11
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-08Fix vibration when pointer move slightlyJules Aguillon1-14/+5
Fix the bug introduced in the parent commit.
2022-05-08Better handling of removed keys and swipe getureJules Aguillon1-1/+3
The "closest key" logic must be careful not to reveal keys removed by a modifier. Must check [_handler.onPointerSwipe] for every candidate values. [selected_value] is changed back to [selected_direction]. This adds a new bug: When the direction change, the selected value might not change but a vibration will be triggered anyway.
2022-05-07Set the color of the navigation barJules Aguillon1-0/+29
Since SDK 21, applications can set the background color of the navigation bar. This is normally simply an item in a theme but it is more complicated for keyboards.
2022-04-30Record activated modifiers on key downJules Aguillon1-8/+8
The View no longer keeps flags for something other than rendering.
2022-03-19Allow modifiers to hide keysJules Aguillon1-6/+7
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-15Handle CANCEL touch eventsJules Aguillon1-3/+6
Handling this event is part of the API but was never done. This caused unstoppable key-repeat. This event isn't common, the only way I found on Android 10 is to switch to the emoji keyboard while holding a key. Some apps might cause this event more often.
2022-03-13Avoid showing some symbols twice in Fn modeJules Aguillon1-24/+17
2022-03-05Improve the code for dynamic updates of the layoutJules Aguillon1-22/+1
2022-02-27Reduce the text size for some keysJules Aguillon1-2/+2
The symbols are now smaller for Shift, Space, Backspace, Delete and some keys on the bottom row. The previous rule was to make the text smaller for symbols made of several characters. This is changed to a flag approach.
2022-02-27Compute text size depending on actual row heightJules Aguillon1-19/+25
Use the height of the row currently being rendered instead of the base row size. Concretely, the bottom row is slightly smaller and will get slightly smaller text. Also: - Rewrite the label rendering code - Render labels at the middle of the key (was slightly off)
2022-02-27Compute text size relative to key heightJules Aguillon1-5/+6
Instead of a fixed size that don't work at all for bigger screens. Other tweaks: - Use the value-land dimens to vary 'extra_horizontal_margin' - Move label size to Config, because it can change at runtime (rotation) - Slightly decrease the size of "long" symbols
2022-02-20Move pointer handling code to its own classJules Aguillon1-267/+91
Separate the concerns and have a clearer interface between the two parts of the code.
2022-02-06Allow egde keys instead of corner keys (swipe vertically/horizontally)Max Schillinger1-16/+54
Add a new boolean parameter "edgekeys" for defining keys that have the additional (swipe) keys on the edges (top, right, left, bottom) instead of at the corners (top left, top right, bottom left, bottom right).
2022-01-30Improve Action key detectionJules Aguillon1-8/+1
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-15Fix miscalculation of the space between the keysJules Aguillon1-7/+7
'keyVerticalInterval' was mistakenly used to compute the height of the keyboard and the vertical position of keys. While the code handling pointers did not use this value, the hit box of the bottom row was shifted by several pixels. Make sure 'keyVerticalInterval' is only used for rendering and not for placing the keys.
2022-01-10Swap the Enter and Action keys when neededJules Aguillon1-2/+11
When IME_FLAG_NO_ENTER_ACTION is set.
2022-01-09Add the Action keyJules Aguillon1-2/+11
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-2/+2
Add the "FLAGS_LANGS" set of flags, which will be used to hide individual keys that are not accents.
2021-12-30Improve the "precision" optionJules Aguillon1-2/+2
Now named "swiping distance". Changed to a dropdown.
2021-12-30Move the border radius from Config to ThemeJules Aguillon1-4/+2
Also, draw activated keys with a round border too.
2021-12-28Separate "handler" codeJules Aguillon1-2/+2
As with the previous commit, remove casts of the context. The "handler" object is referenced in the "config" object for now.