Commit Graph

129 Commits

Author SHA1 Message Date
Jules Aguillon
b15ca662c2 Better handling of removed keys and swipe geture
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-08 16:55:03 +02:00
Jules Aguillon
7da7a5082d Set the color of the navigation bar
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-05-07 23:51:00 +02:00
Jules Aguillon
84af72c222 Record activated modifiers on key down
The View no longer keeps flags for something other than rendering.
2022-04-30 23:17:20 +02:00
Jules Aguillon
e872c58788 Allow modifiers to hide keys
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-19 15:39:20 +01:00
Jules Aguillon
d53ee811d9 Handle CANCEL touch events
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-15 20:44:02 +01:00
Jules Aguillon
a57bdf8cfb Avoid showing some symbols twice in Fn mode 2022-03-13 00:35:15 +01:00
Jules Aguillon
e92504ae92 Improve the code for dynamic updates of the layout 2022-03-05 19:22:01 +01:00
Jules Aguillon
87144fd3a8 Reduce the text size for some keys
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-27 15:23:36 +01:00
Jules Aguillon
1451857c92 Compute text size depending on actual row height
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-27 02:26:45 +01:00
Jules Aguillon
23685ddb3c Compute text size relative to key height
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-27 01:50:24 +01:00
Jules Aguillon
51ff795be4 Move pointer handling code to its own class
Separate the concerns and have a clearer interface between the two parts
of the code.
2022-02-20 13:09:39 +01:00
Max Schillinger
93edc4ac42 Allow egde keys instead of corner keys (swipe vertically/horizontally)
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-02-06 23:49:43 +01:00
Jules Aguillon
2f47d2400b Improve Action key detection
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-30 12:17:31 +01:00
Jules Aguillon
833dfa31bb Fix miscalculation of the space between the keys
'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-15 20:24:27 +01:00
Jules Aguillon
dfec26a93b Swap the Enter and Action keys when needed
When IME_FLAG_NO_ENTER_ACTION is set.
2022-01-10 00:27:22 +01:00
Jules Aguillon
53113cadd9 Add the Action key
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-09 20:26:06 +01:00
Jules Aguillon
23e59c6b09 Allow to hide more keys than just accents
Add the "FLAGS_LANGS" set of flags, which will be used to hide
individual keys that are not accents.
2022-01-09 12:47:47 +01:00
Jules Aguillon
9c82c9cfdc Improve the "precision" option
Now named "swiping distance". Changed to a dropdown.
2021-12-30 22:22:25 +01:00
Jules Aguillon
29367f127d Move the border radius from Config to Theme
Also, draw activated keys with a round border too.
2021-12-30 00:52:50 +01:00
Jules Aguillon
15ce200ce3 Separate "handler" code
As with the previous commit, remove casts of the context.
The "handler" object is referenced in the "config" object for now.
2021-12-28 17:47:18 +01:00
Jules Aguillon
0190cfc29a Turn Config into a singleton object
The goal is to remove a cast of the 'context' into 'Keyboard2'.
2021-12-28 16:47:19 +01:00
Jules Aguillon
dd24ad323b Move Theme code to its own class 2021-12-26 23:55:18 +01:00
Jules Aguillon
1cfecbdf48 Auto-format Java and XML files
Use xmllint.
Re-indent Java files using spaces.
2021-12-19 19:44:27 +01:00
Jules Aguillon
d8d3cf85e5 Avoid using getWidth() from onMeasure() 2021-12-05 19:38:46 +01:00
Jules Aguillon
7a3312fd01 Add the accents preference
This replaces the "disable accent keys" checkbox.
The default should work for anyone: Accents will be hidden unless the
user has the french language installed.

The value "show every accents" is useful for versions of android that
don't have subtypes.
2021-05-09 00:09:10 +02:00
Jules Aguillon
c6a54ed017 Fix rendering of the first label
Caused by a shared Paint not correctly resetted.
2021-05-01 23:26:34 +02:00
Jules Aguillon
743b10165c Highlight activated keys 2021-04-29 01:33:57 +02:00
Jules Aguillon
ec5cda0ce6 Slightly reduce the size of the bottom row 2021-04-29 01:11:18 +02:00
Jules Aguillon
3f0c18612f Fix modifiers
Fixes:
- Toggling off a modifier was not possible in the corners (eg. accents).
- Modifiers on the same key can't be activated at the same time.
- Characters on the same key as a modifier weren't working properly.
2021-04-29 01:06:51 +02:00
Jules Aguillon
d00576ac2d Add the "layout" option again
Some versions of android don't allow to configure several languages.
2021-04-29 01:06:51 +02:00
Jules Aguillon
c86a119448 Tweak dimensions
Increase a bit labels size and reduce empty space between keys.
2021-04-25 00:12:16 +02:00
Jules Aguillon
f7c062d0cb Scale down larger symbols 2021-04-24 23:38:29 +02:00
Jules Aguillon
9bb2642e2c Add the label size option 2021-04-24 23:22:25 +02:00
Jules Aguillon
2dbb3dc28f Allow different sizes
Improve Paint code.
2021-04-24 23:18:16 +02:00
Jules Aguillon
66b7b532c9 Disable vibration when holding keys 2021-04-20 00:35:52 +02:00
Jules Aguillon
5dec9c1215 Add a setting for precise repeat 2021-04-20 00:34:21 +02:00
Jules Aguillon
83b3212d3d Add precise repeat on some keys
Repeat speed increase as the pointer is away from the initial position.
On arrows, backspace and delete.
2021-04-20 00:10:45 +02:00
Jules Aguillon
81803c406a Separate handling of modifiers from KeyValue class
KeyValue defines an ADT and some of its values, it now contains public
final fields and no internal logic.
KeyModifier handles modifiers and accents and creates new instances of
KeyValue when needed.
This operation is now properly cached.
2021-04-18 23:28:49 +02:00
Jules Aguillon
f8bce500ff Hide the input switching key if it's not needed
Android has a new way of switching between input methods and this key
need to be hidden in most cases.
2021-04-18 00:55:31 +02:00
Jules Aguillon
1421bccc7b Remove fixed keyboard width
Remove the constant of keys per rows. Add the 'shift' attribute to
declare eventual alignment/blanks in layouts.
2021-04-17 23:56:51 +02:00
Jules Aguillon
c22ca7302c Stateless KeyboardData class
It was a pain to use. It was also a pain to write this though.
2021-04-15 23:23:31 +02:00
Jules Aguillon
8dc085048a Remove the preview popup
This was a half-finished feature:
- Dangerous when typing passwords
- Caused crash on some devices
- Ugly (on its own but also blinking when sliding and not fixed in size)
2021-01-05 00:18:24 +01:00
jaguillo
162f17a7a0 Move configs to Config object 2015-10-29 12:49:40 +01:00
jaguillo
ffba149934 preview_enabled settings 2015-10-28 22:54:38 +01:00
jaguillo
da72455d35 Improve preview popup 2015-10-28 20:56:28 +01:00
jaguillo
8fbe456074 A bit of style 2015-10-28 17:47:12 +01:00
jaguillo
804e9a7adc Fix some bugs + Try to show a preview popup 2015-10-28 00:39:20 +01:00
jaguillo
8bd0214e26 Emoji pane 2015-10-24 16:32:49 +02:00
jaguillo
db20d52884 Start with emojis 2015-10-23 14:22:43 +02:00
jaguillo
6bb257fd75 Special key font + Esc key 2015-10-13 00:02:34 +02:00
jaguillo
03cc0a5429 Key to switch to numeric pane 2015-10-11 15:30:39 +02:00
jaguillo
549c753450 Perf improvement (small) 2015-10-03 00:19:17 +02:00
jaguillo
81ec226fcf Add margin_bottom, key_height and horizontal_margin configs 2015-09-30 22:48:16 +02:00
juloo
d81509d7ec Accent 2015-08-18 01:25:47 +02:00
juloo
8f3d1a4d38 Fix key repeat on meta keys and empty keys 2015-08-18 00:17:20 +02:00
juloo
9d614bc4fe More settings 2015-08-08 23:07:38 +02:00
juloo
6f09c971c0 SideBarPreference + Continuing settings 2015-08-08 22:33:06 +02:00
juloo
153c384990 Start SettingsActivity 2015-08-08 16:47:22 +02:00
juloo
c29a2a9c9c Todo settings 2015-08-08 15:26:23 +02:00
juloo
117e4a3d4f Improve key repeat 2015-08-05 01:30:56 +02:00
juloo
1be1ec7a4b Add qwerty layout + popup to change layout 2015-08-03 20:01:05 +02:00
juloo
b32f2ce3f3 Fix del key and keyEvent keys 2015-08-03 15:58:13 +02:00
juloo
e9df9bc299 Repeat key on long press 2015-08-03 15:11:11 +02:00
juloo
7dd5845883 Vibrate 2015-08-03 00:01:04 +02:00
juloo
3d3aa4bc98 Nothing 2015-08-02 23:36:22 +02:00
juloo
6737bda402 Fix keys drawing 2015-08-02 22:59:25 +02:00
juloo
12a04ae2c7 Lockable keys 2015-08-02 20:21:53 +02:00
juloo
1115a34a19 Fix mini crash + Can disable on keys 2015-08-02 19:56:23 +02:00
juloo
5bbdbcd522 Implement shift key 2015-08-01 23:54:38 +02:00
juloo
349f0bee6f Send keys to the application 2015-08-01 21:36:40 +02:00
juloo
3b7141e3a0 Stop storing keydown data in KeyboardData.Key 2015-08-01 18:21:10 +02:00
juloo
0942556bad Improve KeyValue 2015-08-01 16:33:30 +02:00
juloo
2537a7b221 Replace key_margin with key_bg_padding + Add {vertical,horizontal}_margin 2015-08-01 01:36:41 +02:00
juloo
90cd2e1c7b Use dimens.xml instead of constants 2015-07-31 23:52:47 +02:00
juloo
56612121f8 Add sub more subkeys + Better drawing 2015-07-31 23:17:07 +02:00
juloo
45ea215bb6 Create KeyboardData class and handle move on keys 2015-07-31 20:48:19 +02:00
juloo
702ae9d0c1 Handle multi touch event 2015-07-31 01:14:35 +02:00
juloo
8265c1c099 Try to handle multi touch event 2015-07-30 22:30:29 +02:00
juloo
90167a986b Initial commit 2015-07-30 20:14:55 +02:00