Commit Graph

434 Commits

Author SHA1 Message Date
Jules Aguillon
540384bb0a Add optional number row
An option is added to enable an extra number row at the top of the
keyboard. Digits are removed from the keyboard while the number row is
visible.
2023-01-30 23:58:47 +01:00
Jules Aguillon
c7184303e9 Remove the digits when numpad is visible 2023-01-30 23:54:39 +01:00
Jules Aguillon
78a461f740 Modification step for the special layout
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-30 23:46:02 +01:00
Jules Aguillon
90b7944129 Apply modify_layout to text layout only
Refactor. Allows to remove the 'extra_keys' and 'num_pad' flags and to
implement more complicated transformations to the layouts.
2023-01-30 22:33:01 +01:00
Jules Aguillon
2539feadcd Fix placeholder key not replaced
Since fecc4dd, placeholder keys can't be compared by reference.
Add a placeholder kind and defined placeholder values.
2023-01-30 21:29:59 +01:00
Jules Aguillon
fecc4dd70a Remove the explicit hashmap in KeyValue
Refactoring. Predefined keys are represented by a big switch statement
rather than added into a hashmap.
2023-01-29 19:38:54 +01:00
Jules Aguillon
7bc93c470e Don't send event at end of sliding
A sliding pointer going up must not cause a key event to be sent. This
caused an extra cursor movement and cleared the latched modifiers.
2023-01-29 18:49:44 +01:00
Jules Aguillon
854eff211d Move cursor by sliding on the space bar
Send key events for the left or right arrow as the finger slides on the
space bar.
Can be used to select text by holding shift. Works under Termux.

Events are sent linearly as the finger travels. The distance between
each events is defined from the swiping distance divided by 4.

'slider="true"' can be set on a key that have 'edgekeys="true"'.
'key2' and 'key3' represent the right and left keys.
2023-01-22 23:21:21 +01:00
Jules Aguillon
f4032e3be9 Remove the modulated repeat
It allowed to modulate the repeat speed of some keys (arrow, backspace,
delete) by move the finger farther or closer to the key.

In practice, this wasn't pratical and doesn't seem popular. It is
removed in favor of a better mechanism for moving the cursor.
2023-01-22 23:20:04 +01:00
Jules Aguillon
6126578111 Avoid switching back from secondary layout automatically
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.
2023-01-15 23:19:09 +01:00
Jules Aguillon
fd0f0d5476 Separate option for bottom margin in landscape mode
A large margin in portrait mode is desirable but generally not in
landscape mode.
2023-01-15 19:19:07 +01:00
Jules Aguillon
a199962117 Separate option for horizontal margin in landscape mode
A separate option is needed, the +25dp offset wasn't enough.
2023-01-15 19:11:08 +01:00
Jules Aguillon
e190394b47 Add layout 'qwertz_sk'
Co-authored-by: Jozef Kundlak <ingjozefkundlak@gmail.com>
2023-01-14 23:31:37 +01:00
Jules Aguillon
c5f5a23d75 Fix dimensions going off after rotation
Values like 'characterSize' and 'horizontalMargin' can't be fed back into the default value because they are not of the same unit.
To avoid this happening again, change the way the default value is defined for every options.
The 'key_height' dimension was no longer used.
2022-12-31 14:00:38 +01:00
Jules Aguillon
e333eb06fd Add keys for every context menu actions
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-30 15:29:18 +01:00
Jules Aguillon
764cd882d2 Fix inaccessible text layout from pin
The "main" layout can now be pin layout. 'SWITCH_TEXT' and
'SWITCH_SECOND_BACK' don't mean to use that.
2022-12-29 12:43:02 +01:00
Jules Aguillon
8f972113ca Fix pin entry layout not showing up
The regular text layout was showing instead of the pin entry due to a
misuse of the 'switch' syntax.
2022-12-14 15:33:44 +01:00
Jules Aguillon
c61b31168c Fix a crash on API < 12
'extra_keys_subtype' can be none on API level < 12 when the "accents"
option is tweaked.
2022-12-14 15:09:46 +01:00
Jules Aguillon
7d6306fbc9 Fix keyboard not showing up after rotation
'setInputView()' must be called on every 'onStartInputView()', not just
when the view is re-created.

This is broken since bf31872.
2022-12-14 15:04:11 +01:00
Chasm Solacer
90cad963ec
Make the keyboard transparent (#252)
* 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-11 22:10:00 +01:00
Jules Aguillon
bf31872955 Handle configuration change quickly
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-12-11 21:57:40 +01:00
Jules Aguillon
199ca5cf03 Improve emoji pane layout
The measurement function was wrong in some situations. Set a width for
columns and properly configure the GridView.
2022-12-11 16:26:50 +01:00
Jules Aguillon
87d21685ca Fix keyboard not reacting to changed preferences
The callback might not be called if the "default" shared preferences is
different from the shared preferences actually used. This is unexpected
but seems to happen half of the time on Android 12.

Since f1ce6ab, this callback is critical to update the keyboard.
Restarting the application can no longer solve these issues.
2022-12-11 14:55:32 +01:00
Chasm Solacer
8665d002bf
Added qwerty_pl layout (#251)
* Updated pl translation

* Added qwerty_pl.xml – QWERTY (Polski) layout
2022-12-11 14:49:22 +01:00
Jules Aguillon
c17b53ce7f Add option 'numpad_layout'
Allow choosing whether to show the high or the low digits first. The
numeric pane and the numpad are affected by the option.
2022-12-10 19:39:22 +01:00
Jules Aguillon
804ea84981 Correctly handle pointer cancel events
The cancel event ends the motion, it doesn't apply to a single pointer
like it was previously expected.
2022-12-04 18:21:59 +01:00
Jules Aguillon
19c38ca6a2 Improve glyph of accent_bar
The small bar on the middle of the dotted circle looked like a small
arrow. Make the bar span the whole circle, not on the middle.
2022-11-26 23:05:55 +01:00
Jules Aguillon
e745c81269 Allow using a custom layout
Add an option for specifying an XML layout description as a string.

The option is a bit rough at the moment:

- No documentation, users have to be aware of the keyboard's code to use
  this option.
- No error are shown, the layout will fallback to qwerty on error.
2022-11-26 22:30:45 +01:00
Jules Aguillon
09d984a1ab Refactor: Use XmlPullParser directly
XmlResourceParser is convenient but cannot be easily instantiated.
2022-11-26 22:16:48 +01:00
Jules Aguillon
69994a55c5 Refactor: Pass layout as a KeyboardData instead of ID
Parse layouts sooner.
2022-11-26 22:14:29 +01:00
Jules Aguillon
122a9c23d0 Make fake pointers not lockable
Especially annoying now that modifiers are not locked by a double tap.
2022-11-26 17:22:31 +01:00
Jules Aguillon
6fb15b3f16 Stop using deprecated 'shouldOfferSwitchingToNextInputMethod'
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-26 15:46:45 +01:00
Jules Aguillon
f7e16c0345 Fix missing version check
setSystemGestureExclusionRects is API 29. Broken since d644d2b, which
almost got into the release!
2022-11-13 20:59:40 +01:00
Jules Aguillon
64c7c8ce20 Draw borders and update themes
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-13 20:53:06 +01:00
Jules Aguillon
c1751578ef Highlight activated keys label
Rendering change only.
2022-11-13 18:03:01 +01:00
Jules Aguillon
2aa98de7aa Add editing keys: copy, paste, cut, select all 2022-11-13 16:45:57 +01:00
Jules Aguillon
078dbcd5ff Refactor: Move editing code from to KeyEventHandler
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-13 16:28:39 +01:00
Jules Aguillon
22a7df6632 Refactor: Use enum values in KeyValue.Kind
instead of maintaining a separate set of constants and a conversion
function.
2022-11-13 15:19:50 +01:00
Jules Aguillon
e213834f67 Don't depend on dpi values in swipe distance
The dpi values "xdpi" and "ydpi" can have wildly different values on
different devices.

The new computation defines a baseline and only take into account the
dpi values as a ratio.

On a 480dpi screen (in both directions), this decrease the value by
about 18%. This new distance felt better during testing.
2022-11-13 14:43:53 +01:00
Jules Aguillon
b102ad9078 Fix localized keys appearing on secondary layout 2022-11-13 00:39:31 +01:00
Jules Aguillon
51b330c616 Allow switching quickly between two layouts
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-13 00:24:23 +01:00
Jules Aguillon
815e30a505 Add option for brightness of labels
The brightness value is used as the alpha value when drawing the labels.
2022-11-11 19:47:37 +01:00
Jules Aguillon
4d99bd4f4b Dim secondary keys
Reduce the constrast of "secondary" labels. Modifiers (except
diacritics), event and keyevent keys are considered secondary.
2022-11-11 19:18:22 +01:00
Jules Aguillon
d644d2bf0e Disable the back-gesture on the keyboard area
as well as other system gestures that would interfere with the
keyboard's own swipe gesture.
2022-11-11 16:14:44 +01:00
Jules Aguillon
ef34303c7e Avoid crashing in direct-boot mode
The settings activity can't open in direct-boot mode. The emoji pane
opens without the "last used" data.
2022-11-11 15:39:28 +01:00
Jules Aguillon
f1ce6abe5a Direct-boot aware preferences
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-11 14:27:02 +01:00
Jules Aguillon
30198acddd Enable pin layout for decimal and signed inputs
Decimal and signed inputs are more common than expected. Adding a few
keys is enough to support these.
2022-11-06 19:54:55 +01:00
Jules Aguillon
96db0397f0 Fix adding two pointers for the same key 2022-11-06 19:49:30 +01:00
Jules Aguillon
d2128e777e Remove option "Lockable modifiers" 2022-11-06 19:34:57 +01:00
Jules Aguillon
6a7fbf5e50 Add combinations to 'accent_slash' and show in settings
The 'accent_slash' was missing in the extra keys setting.

Allow to type more latin letters "with oblique stroke" or "with stroke"
that visually have an oblique bar, that were not added to 'accent_bar'.
2022-11-05 19:33:46 +01:00
Jules Aguillon
1e067c9863 Add the bar diacritic dead key
Allows to type many of the "with stroke" or "with bar" latin letters.
2022-11-05 19:26:49 +01:00
Jules Aguillon
ebe66eb740 Apply Fn first
It's otherwise impossible to type Ctrl+F keys.
2022-11-05 10:29:36 +01:00
Jules Aguillon
d2328d4b9a Automatic day night theme in settings activity
There seems to be no "DayNight" theme compatible with older version of
android outside of the androidx library.

Using 'Theme.DeviceDefault' which is a dark theme, even if it doesn't
sounds like. Detect if a light theme should be used at activity
creation.
2022-11-05 10:13:35 +01:00
Jules Aguillon
7edfd81db1 Use '₹' instead of '₨' in Hindi
₨ is Shift+₹.
2022-11-01 21:44:49 +01:00
Jules Aguillon
4f3fcfe64b Add the 'qwertz_de' layout
Similar to 'qwertz' but is wider to show äöü on dedicated keys. Some
punctuations are rebalanced to use the space better.
The default layout for de_DE is changed.
2022-11-01 21:29:18 +01:00
Jules Aguillon
2e598a4d47 Draw letter indication on the pin layout
There is no way to type letters on the pin layout, the indication are
decoration only.
Use the E.161 standard.
2022-10-24 00:27:49 +02:00
Jules Aguillon
e01a2733b1 Add the pin entry layout
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-24 00:17:55 +02:00
Jules Aguillon
e1145d3851 Disable Alt and Meta by default
The Meta key is not useful.
The Alt key can be used in a terminal but is not useful to a part of
terminal users.
2022-10-23 23:09:58 +02:00
Gero Streng
baec5a76ee Add optional NumPad
Shows a NumPad depending on preference:
   Never/Landscape/Always
2022-10-23 22:51:36 +02:00
Jules Aguillon
ea0b873dd8 Make the shift symbol bigger 2022-10-23 22:02:41 +02:00
Jules Aguillon
ff0c0354d6 Show keys description in settings
The symbols alone might be hard to understand when scrolling through the
"extra keys" option.
2022-10-23 21:51:43 +02:00
Jules Aguillon
344df4c5c1 Refactor: Remove boilerplate for symbol keys 2022-10-23 21:42:03 +02:00
Jules Aguillon
36e10a792f Add the capslock key
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-23 21:37:04 +02:00
Jules Aguillon
f56b926857 Autocapitalisation: Avoid trigerring when Ctrl+Del
Autocapitalisation could trigger while repeatedly typing Ctrl+Del to
remove several words.
2022-10-16 22:34:21 +02:00
Jules Aguillon
75df3afda6 Allow to disable Alt and Meta keys
The keys are marked "loc" in the layouts and are handled like the other
extra keys.
The only difference is that they are enabled by default (for now).
2022-10-16 01:07:24 +02:00
Jules Aguillon
158a3577be Disable fullscreen mode
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-16 00:42:28 +02:00
Jules Aguillon
138e59f13a Fix literal tab key
Broken since 31d6a70d.
2022-10-16 00:04:06 +02:00
Jules Aguillon
db347c665c Add the breve diacritic 2022-10-15 23:28:36 +02:00
lpv
8be80eecd4
Basic greek layout. (#207)
* Basic greek layout.
2022-10-15 23:22:19 +02:00
Jules Aguillon
d9a8688237 Fix crash due to auto capitalisation
It is unclear how _autocap.started is not called first but nothing is
preventing to initialize things earlier.
2022-10-15 16:19:27 +02:00
Raj9039852537
1909f2fcb4
Added Hindi language layout (#211)
* Hindi Keyboard Layout

Hindi keyboard layout added
Basic symbols like brackets, colons etc are useful. This includes ( ) { } [ ] \ / ÷ - + = ! % : ; . , ?
2022-10-11 22:13:40 +02:00
Jules Aguillon
fc8bb3a539 Allow to type İ on the Turkish layout
In Turkish, upper case of 'iı' is 'İI' but Java's toUpperCase will
return 'II'.
To make 'İ' accessible, make it the shift of 'ı'. This has the
inconvenient of swapping i and ı on the keyboard.
2022-10-04 10:12:22 +02:00
Jules Aguillon
64e263a1af Fix an unexplained crash encountered in the wild
For some reason, 'subtype' can be null. Perhaps because the keyboard is
started before the IMM is ready.
2022-09-24 23:34:50 +02:00
Validbit
5169472dfc
Added Czech translation and layout (#198)
* Added Czech translation and layout

Translated keyboard and created Czech multilingual "practical" layout for faster typing and typing in commonly used languages (German, Slovak + French w/accents)

* Update (Rephrase) full_description.txt

... to better suit the language and naturally promote keyboard's features and possibilities to a wider audience.
2022-09-24 22:44:10 +02:00
Jules Aguillon
3081af5190 Improve the auto capitalisation
- Detect when the input box is cleared
- Avoid looking up keys on the keyboard every time the shift state needs
  to change.
2022-09-24 22:36:06 +02:00
Jules Aguillon
c778b4e8a2 Fix autocapitalisation randomly not triggered
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-24 18:53:37 +02:00
Quantenzitrone
65210fb14f
Bone keyboard layout (#155) 2022-09-24 16:17:10 +02:00
Jules Aguillon
2fc40512c6 Add switch_greekmath to the extra keys
The Fn+switch_numeric shortcut might be hard to discover or too slow for
heavy users.

A location is allocated for the key so it has a consistent placement.
2022-09-24 16:02:54 +02:00
Jules Aguillon
5811643562 Add more possible locations for extra keys
Avoid dropping some keys on crowded layouts.
2022-09-24 16:02:54 +02:00
Piotrek Marciniak
a365fdc6a3
Add white e-ink oriented theme (#193)
* Add white e-ing oriented theme

Co-authored-by: Jules Aguillon <jules@j3s.fr>
2022-09-24 13:13:51 +02:00
ChristianGynnild
b0a2298899
Added Norwegian keyboard layout (#202) 2022-09-24 11:44:01 +02:00
Md Rasel Hossain
81f07b427f
Bengali Keyboard Layout (#201)
* Bangla Layout
2022-09-24 11:40:10 +02:00
Jules Aguillon
25a6e71ee8 Add the Extra Keys option
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-09-19 11:41:18 +02:00
Jules Aguillon
bc8bcce82a Fix crash when auto-capitalisation runs too soon
This is unexpected but happens once.
2022-07-30 18:19:28 +02:00
Jules Aguillon
4f5ce66347 Fix auto-capitalisation interfering with caps lock
Add a flag to recognize fake pointers and avoid clearing the
intentionally locked shift key.
2022-07-30 18:14:05 +02:00
Jules Aguillon
85d798299e Standard auto-capitalisation only after space
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-30 17:56:31 +02:00
Jules Aguillon
53b9afa973 Hold any modifier to lock
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-24 23:55:00 +02:00
Jules Aguillon
081e9a6e53 Add an option to control auto capitalisation 2022-07-24 23:44:37 +02:00
Jules Aguillon
bfde31da6e Avoid automatic capitalisation when using arrows
Disable capitalisation just after an arrow kind is pressed to avoid
interrupting navigation.
2022-07-24 23:32:14 +02:00
Jules Aguillon
324756535e Automatic capitalisation at beginning of sentences
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-24 20:02:48 +02:00
quantenzitrone
3033091f9d Add alternative greek and math symbols 2022-07-09 17:40:20 +02:00
Quantenzitrone
fdd640ef09 added uppercase ẞ of ß 2022-07-09 17:35:17 +02:00
Jules Aguillon
13a13ecbb6 Switch to greekmath with Fn+switch_numeric
Add a shortcut to switch to the greekmath pane directly from the main
layout.
2022-07-09 17:31:44 +02:00
Jules Aguillon
d5836ebb97 Add key for switching to the greekmath pane
The key is placed on the 3rd row of the numeric pane, by taking some
space from the shift key.
2022-07-09 17:30:26 +02:00
Andrew Cat
1d406e948f
Add ukrainian layout (#172) 2022-07-03 23:07:06 +02:00
Jules Aguillon
1ddd089166 Compatibility with API level < 24
The Math.floorMod method was added on API level 24.
2022-07-03 22:59:05 +02:00
Jules Aguillon
ff01678ba6 Revert "Remove the vibration settings"
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 ef03dfed5c.
2022-06-24 22:00:23 +02:00
Jules Aguillon
d74e8f3b08 Fix F12 being turned into F11
The "f11_placeholder" and "f12_placeholder" keys were equals since
31d6a70.

Add an incrementing id into the unused key value to differentiate
placeholder values.
2022-06-24 20:56:04 +02:00
Jules Aguillon
ab987c776c Fix localized key not in predefined position
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-24 20:26:27 +02:00
Jules Aguillon
402bf4990e Remove the interval between vibrations
This is no longer necessary since repeating key no longer cause a
vibration.
2022-06-06 20:40:53 +02:00
Jules Aguillon
ef03dfed5c Remove the vibration settings
Instead of using the vibrator directly, use performHapticFeedback, which
will integrate better with the system settings.
2022-06-06 17:04:50 +02:00
Jules Aguillon
e0131fa6b0 Fix inconsistent text size in landscape mode
Dimens weren't refreshed when the orientation changed. Dimens are not
the right solution anyway, use scaling factors instead.
2022-06-06 16:17:43 +02:00
Jules Aguillon
b236a74b64 Increase horizontal spacing in landscape mode
Space between the keys and margin on the left and right edges of the
screen.
2022-06-06 16:15:35 +02:00
Jules Aguillon
f6338a652b New setting: Keyboard height in landscape mode
The previous fixed value of 55% was too high. The new default value is
50% and it is customizable.
2022-06-06 15:33:39 +02:00
Jules Aguillon
9a42fa4dca Don't add extra keys to the numeric pane 2022-06-06 01:02:30 +02:00
Jules Aguillon
4d104eacf3 Remove the option "Show every accents"
This option cannot be implemented easily now that the set of "accents"
(localized keys) isn't defined.
2022-06-06 00:55:16 +02:00
Jules Aguillon
31d6a70dfb Refactor: Remove KeyValue.name
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-06 00:23:45 +02:00
Jules Aguillon
7462955507 Fix "REMOVED" key appearing when typing Fn and Shift
Since cc571ea
2022-06-05 20:15:11 +02:00
Jules Aguillon
9aac7900c0 Refactor: Make KeyValue final
The class has a complicated internal logic, it is no longer reasonable
to extend it.
2022-06-05 20:14:16 +02:00
Jules Aguillon
088d46d6e6 Refactor: Merge KeyValue._code and _flags fields
With a small number of flags now, it's possible to remove one more
field.
2022-06-05 19:55:55 +02:00
Jules Aguillon
5cc7fdf6d7 Refactor: Separate Events and Keyevents and use enums
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-05 19:30:53 +02:00
Jules Aguillon
cc571ea1ca Refactor: Merge KeyValue.char and code fields
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-05 18:14:50 +02:00
Jules Aguillon
c1a816d3d4 Refactor: Associate key events in KeyModifier
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-05 17:46:28 +02:00
Jules Aguillon
e10c587dc5 Refactor: Abstract KeyValue fields
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-05 17:46:22 +02:00
erqan
d03e96da3e
Turkish layout & translation (#151)
* Turkish layout & translation
2022-06-05 15:04:54 +02:00
Jules Aguillon
02124dd71f Add combining 'accent_arrow_right'
It's the first modifier that uses combining diacritics. Whether it
should be represented as a modifier or a new kind of key can be
reconsidered later.
2022-06-05 13:51:09 +02:00
Jules Aguillon
e4e54628b7 Add the 'accent_slash' modifier
Might be useful for some math characters.
2022-06-05 12:02:35 +02:00
Jules Aguillon
4127aa6f03 Stop using flags for modifiers
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-06-05 01:43:58 +02:00
Djuric
9b154a2495
Add colemak layout (#135) 2022-06-04 15:23:52 +02:00
Jules Aguillon
815025aaa9 Add layout: QWERTY (Hungarian) 2022-05-29 17:31:12 +02:00
Jules Aguillon
2e81cb5cf7 Automatically place localized keys on the layouts
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-29 12:27:46 +02:00
Jules Aguillon
eb42943327 Specify localized keys in each layouts
Each layouts can chose which key are localized instead of specifying it
globally for each key.

Important keys are no longer removed from layouts if the 'extra_keys'
mechanism is not working properly. This can happen if language tags
specified in method.xml don't match the user's language.

Removed some currency symbols from some layouts. They are all in the Fn
layer.
2022-05-08 17:35:24 +02:00
Jules Aguillon
121a2ba76f Find closest key further
The previous limit was checking d-1 and d+1, the new limit also tries
d-2 and d+2.
2022-05-08 16:56:34 +02:00
Jules Aguillon
82d3290c6a Fix vibration when pointer move slightly
Fix the bug introduced in the parent commit.
2022-05-08 16:55:03 +02:00
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
9a48acfe3e Improve nearest key computation
getAtDirection was too hard to maintain and might contain bugs.
Change slightly the meaning of directions and implement a the nearest
key calculation as a loop.
2022-05-08 16:55:03 +02:00
Rodrigo Batista de Moraes
bce0a98f62 only vibrate when the swipe key changes 2022-05-08 16:55:03 +02:00
Rodrigo Batista de Moraes
a27c64479f use the closest swipe key on swipe
fix a direction
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
Tibor Billes
8cb1789eeb
Add support for Hungarian layout (#127) 2022-05-01 22:51:11 +02:00
Jules Aguillon
04a7ec4bb8 Fix latched pointers accumulating on the same key
It was possible to latch and lock the same modifier several time at the
same time independently. Remove that.
2022-05-01 00:11:52 +02:00
Jules Aguillon
8e0d38c257 Fix crash when IME not enabled
This is unexpected but happened to a user. Perhaps because the OS
returned bogus or fake results in imm.getEnabledInputMethodList ?
2022-05-01 00:00:15 +02:00
Jules Aguillon
b72635b887 Fix modifiers not cleared when presses overlap
When typing fast, a second key might be pressed before the first is
released.

Clearing modifiers earlier would prevent this but would break modifiers
placed in corners (especially the accent keys). Instead, don't take
latched modifiers into account when registering the second press.

A new flag is needed to not interfere with holding modifers, which is
merged with the norepeat flag.
2022-04-30 23:47:09 +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
39952f8bdf Remove build dependency on Fontforge
The required version of fontforge (from 2020!) is not available in many
distros. This is an annoying for contributors and greatly complicated
the CI and F-Droid scripts.

The generated font file is now included in the sources. Fontforge is
still needed when adding new glyphs but this is not a common operation.
2022-04-24 20:52:36 +02:00
matthiakl
e52e537fd7
Added neo 2 layout (#125)
* Added neo 2 layout

* Move accents away from screen edge into second row
2022-04-24 19:58:33 +02:00
Jules Aguillon
2900e8d197 Add Double acute diacritic
Will be used by the Hungarian language.
2022-04-24 01:15:41 +02:00
Jules Aguillon
d8e475467a Fix cedilla glyph is inverted 2022-04-24 00:49:48 +02:00
Jules Aguillon
fec3f109c9 Add support for Lithuanian
Requires two new diacritics: ogonek and dot_above.

The new accents are also added to the Latvian layout as the two language
can be close but not to the other localized layouts. A new mechanism is
needed to reproducibly add extra keys to layouts without manual
placement.
2022-04-24 00:41:49 +02:00
Jules Aguillon
9a8c4f291d Fix compatibility with Android 6
Android 6 uses Java 1.7, the only incompatible feature in use was
lambdas.
2022-04-16 23:36:54 +02:00
Jules Aguillon
5562ee1391 Fix mismatch layout name
The Korean layout id was not consistent and this caused a crash.
2022-04-06 09:50:33 +02:00
Jules Aguillon
120c0a9d23 Fix compat with older version of Android
Resources.getFloat is new from API 29.
2022-04-06 09:50:33 +02:00
Jules Aguillon
aa78229b2a Add the Programming Layout option
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-04-03 17:15:12 +02:00
Jules Aguillon
9411f59ed5 Rename the Meta key
The symbol isn't clear enough.
2022-04-03 12:49:14 +02:00
Jules Aguillon
b85b67c2f0 Swap Ctrl and switch_numeric keys
The switch_numeric key is generally more important, especially in the
numeric pane.
2022-04-03 12:48:29 +02:00
Raphael
b995da9985 Update Space Glyph
Revert to previous version, the original google material icon,
which is not rounded, and it looks better with the rest of the keyboard,
also more correct to represent the open box unicode space char,
instead of a smile
2022-04-02 17:36:10 +02:00
Jules Aguillon
5f47beb5b0 Add currency symbols under the Fn key
Fn+e = €
Fn+l = £
Fn+r = ₹
Fn+y = ¥
Fn+c = ¢
Fn+p = ₱
2022-04-02 16:56:40 +02:00
Raphael
2dda39f453
Arrows and Box system (#114)
* Add `Arrows` and `Box` accent system
2022-04-02 16:42:40 +02:00
nickid
fbf8901bdb
Add Korean layout (#115)
* Add Korean layout
2022-04-02 16:33:32 +02:00
Jules Aguillon
2b6c2b98e0 Compute the swipe distance from the physical dpi
The previous computation was very different depending on the device's
screen and accessibility options.
Given that the keyboard is supposed to fill all the space in one
dimension, the dpi unit makes little sense.

The formula doesn't mean anything in particular, it takes into account
both dimensions (x and y) and should be close to the dpi in the
diagonals (which is the direction of swipe).

This changes the actual value, on a 1920x1080 480dpi screen, the value
is increased by 20%.
2022-04-02 16:16:24 +02:00