Commit Graph

551 Commits

Author SHA1 Message Date
Jules Aguillon
1eea9e25d2 Remove the Accents option
This option makes less sense since per-script extra keys. It's also
getting in the way of an eventual "dead-key or accented-letters" option.
2023-08-06 17:15:35 +02:00
Jules Aguillon
45905f5f3b Replace dead-keys when there's one alternative
The dead-key is replaced by its alternative if there's only one
specified.
Extra keys from every subtypes must be merged together to be able to
make this check.
2023-08-06 17:14:23 +02:00
Jules Aguillon
cd95c589de Extra keys alternatives
For each extra key, a list of alternative can be specified. An extra key
won't be added to the keyboard if all its alternatives are already
present on it.

This is useful to avoid having the dead key for an accent and the
accented letters at the same time.
2023-08-06 17:14:23 +02:00
Jules Aguillon
dcbb4c484c Modify arabic and persian numbers info function keys
And add function keys placeholders in the layouts.
2023-08-05 19:40:13 +02:00
Jules Aguillon
ae791ab292 Translatable key descriptions
Key descriptions are shown in the "extra keys" option and can now be
translated.
2023-08-05 16:45:57 +02:00
Jules Aguillon
4abea0e878 Settings: Increase vibration values 2023-08-02 21:02:07 +02:00
Jules Aguillon
be97364b34 font: Move glyphs into the PUA
Glyphs in the Private Use Area at uE000 will no longer conflict with
fallback fonts in the "extra keys" option.
2023-08-02 20:39:37 +02:00
Jules Aguillon
9bd8b08544 ListGroupPreference: Allow to modify items 2023-07-30 23:34:48 +02:00
Jules Aguillon
dad5f57a03 Allow more than 2 layouts
The two layout selection options are replaced by a ListGroupPreference
that allow to enter an arbitrary amount of layouts.

The "switch_second" and "switch_second_back" keys are replaced by
"switch_forward" and "switch_backward", which allow to cycle through the
selected layouts in two directions.

Layouts are changed to place these two key on the space bar.
The backward key is not shown if there's only two layouts.
2023-07-30 21:44:14 +02:00
Jules Aguillon
818aa4c7d5 ListGroupPreference: Allow hide the "remove" button 2023-07-30 21:34:01 +02:00
Jules Aguillon
b4a1ac48bb ListGroupPreference: Overrideable "add" button 2023-07-30 21:34:01 +02:00
Jules Aguillon
0856fb4e31 Refactor: Split out ListGroupPreference
Split out the implementation of a string-list preference from
CustomExtraKeysPreference.

Allows to share the implementation with future preferences.
2023-07-29 18:42:36 +02:00
Ben Slusky
0a114bd2bc
Add dagger, double dagger, section mark, and pilcrow as extra keys on QWERTY-like layouts (#410)
* Add section mark as an extra key in QWERTY-like layouts that don't have it already

* Add dagger (also double dagger) as an extra key in QWERTY-like layouts
2023-07-29 18:42:20 +02:00
Jules Aguillon
fce8ff7ce2 Add option to disable pin entry layout
The pin entry layout might be inferior for some usecases and people
might be more used to the numeric layout.
2023-07-29 17:29:45 +02:00
Jules Aguillon
8b2c07c9cb Refactor: Centralize logging in a static class
This new class will help write more logs. The LogPrinter is no longer
created everytime the keyboard is opened.

An error log is added if failing to load the custom extra keys.
2023-07-19 23:30:58 +02:00
Jules Aguillon
458e17bf31 Add custom extra keys preference
This is a new section in the extra keys option that allows to enter
arbitrary strings which are then added to the keyboard.

A new string is needed for the title of the section, Android's icons and
strings are used as much as possible to avoid adding more strings.

Keys are stored in the preferences as a JSON array of strings.
2023-07-19 23:30:58 +02:00
Jules Aguillon
324aa26ba4 Refactor: Make KeyValue.makeStringKey public 2023-07-19 23:30:58 +02:00
Jules Aguillon
6747669c2d Refactor: Use a PreferenceCategory for extra keys
This removes the need for a layout definition and adds a title before
the prefs.
It's a prerequise for the custom keys preference.
2023-07-19 23:30:58 +02:00
Jules Aguillon
4669192a01 Refactor: Don't define extra keys in xml
The current approach is hard to maintain, for example the last key
"autofill" was not displayed.

This implements a PreferenceGroup that contains the check boxes for
every extra keys without involving listing the preferences in
settings.xml.

A custom layout is used to remove the 'title' text view.
The list of extra keys is moved into the new class.
'ExtraKeyCheckBoxPreference' becomes a nested class.
2023-07-09 18:14:43 +02:00
Jules Aguillon
a2957a43d6 Add symbol ₴ to Fn+h and to Ukrainian 2023-07-09 16:12:13 +02:00
Jules Aguillon
37d4a523bb Remove use of Arrays.copyOf
The function has been added in API 9.
2023-07-05 18:58:27 +02:00
Validbit
ef4477d50c
Updated/Added Czech translation + 2 common Fn keys (#387) 2023-07-02 16:12:19 +02:00
Jules Aguillon
e025fddf2f Accept some escaped keys in custom layouts
These symbols have special meaning when in `res/xml` and are escaped in
standard layouts.
The backslash is not stripped when parsed from the custom layout option.

Treat these backslashed keys specifically to allow standard layouts to
be passed back to the custom layout option.
2023-06-28 18:04:32 +02:00
Jules Aguillon
434f9aaf2d Fix crash when the layout has less than 3 rows 2023-06-28 17:50:32 +02:00
Jules Aguillon
c0833de37c Add hardcoded charmaps for most accents
`KeyCharacterMap.getDeadChar` may not be aware of the same dead keys in
older version of Android.
Hardcoded charmaps are more predictable.
2023-06-25 20:00:29 +02:00
Jules Aguillon
15c608b8cd Use generated arrays in Config.layout_of_string
This function is no longer an hardcoded list of layout ids. It's
replaced by a linear scan of the previously generated array and a new
corresponding array of resource ids.
2023-06-25 16:34:05 +02:00
Jules Aguillon
f36864533c
Standard layout names (#386)
The names are comprised of: script, layout name, country code.

Co-authored-by: grim <verdastelo9604@hotmail.com>
2023-06-25 13:40:20 +02:00
Vasile Chelban
5cfbc6ed5b
Added Romanian layout and translations with special romanian characters (#358)
Added Romanian characters to the keyboard layout and changed the positioning
corner for the secondary characters that were conflicting with the
newly-introduced romanian characters

Added Romanian translations
2023-06-25 12:19:00 +02:00
Sabbir
8160b1ac05
Add Bengali Provat Layout (#357)
* Add Bengali Provat Layout

I added bengali_provat layout and renamed old bengali to actual layout name.
2023-06-25 12:12:46 +02:00
Jules Aguillon
9bcfec8bd1 Per-script extra keys
Allows to define a locale's script in 'method.xml' and use that to add
the extra keys for a locale to layouts of the same script only.

A locale of an undefined script will add its extra keys to every
layouts. A layout of an undefined script will have the extra keys of all
the enabled locales.
2023-06-24 23:29:24 +02:00
Jules Aguillon
5fc68373d3 Allow to specify a layout script
Add the `script` attribute, which will be used to implement
script-specific extra keys.
2023-06-22 20:14:20 +02:00
Jules Aguillon
a26a535729 Fix _localeTextLayout null on API < 12
On API level < 12 or on some rare cases, `refreshSubtypeLayout` was not
called, making `_localeTextLayout` uninitialized.

This might also happen if `getExtraValueOf` returns an invalid layout name.
eg. `method.xml` contains an invalid layout name.
2023-06-10 18:07:23 +02:00
Jules Aguillon
3400a96c4f Increase vibration values 2023-06-04 23:33:04 +02:00
KuRa KuRd
53acdf7df7
Add Kurdish Layout (#353)
Add Kurdish Keyboard Layout Qwerty Based Without Shift.
2023-06-04 23:21:14 +02:00
Jules Aguillon
01bfe73fc7 Explicitly map dead key for ñ
`KeyCharacterMap.getDeadChar` seems to not give the expected result on
Android 4.0. This might affect many more dead key combinations that are
not fixed by this commit.
2023-06-04 23:07:35 +02:00
Jules Aguillon
e5ae4816df Add automated checks on layouts
The script `check_layout.py` checks some properties about layouts.
No check is an error.

The result of running this script on every layouts is stored in the file
`check_layout.output`, which is useful to track changes.

Add make rules to run this script as well as `sync_translations`.
2023-06-03 21:03:05 +02:00
Jules Aguillon
f451902efa Refactor: Remove dimens used as option defaults
The conversion into px was done twice, leading to wrong values.
2023-06-03 20:20:09 +02:00
Jules Aguillon
a83a19a0a8 Refactor: Handle Event keys in Keyboard2
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-03 20:06:44 +02:00
Jules Aguillon
59b3341eaf Hide the voice typing key if no suitable IM
Implemented similarly to the IM switching key.
2023-06-03 18:35:16 +02:00
Jules Aguillon
85cdb9b2b5 Add Voice Typing key
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-06-03 18:11:42 +02:00
Jules Aguillon
69e0b4c2a2 More control over vibration
The newer haptic feedback API that is used instead of the vibrator
service since ef03dfe doesn't work for everyone.

The new vibration option allow to choose both the newer API ("system")
and the older API ("strong", "medium", "light").
2023-06-03 11:15:19 +02:00
Jules Aguillon
6f418727cf Launcher activity: Don't handle the back button 2023-06-03 10:00:16 +02:00
Jules Aguillon
22d407c46a Per-layout shift modmap
Specify the behavior of shift for a layout. This is intended for locales
that use the same alphabet but have different capital letters (eg.
Bengali).

The modmap is defined like this:

    <keyboard>
      <modmap>
        <shift a="a" b="A"/>
      </modmap>
    </keyboard>
2023-06-03 09:37:59 +02:00
vladgba
62943ba4d3
Fix gravity of keyboard in full screen (#363)
Set keyboard bottom gravity and adjust inputArea height so it doesn't appear on top in fullscreen.
2023-05-24 19:23:28 +02:00
Reza Hosseinzadeh
e3347a166f
Pull request to add new layout Persian (#342)
* Add persian layout

* Change layoutId_of_string to layout_of_string

* Add translation for Persian
2023-04-23 01:47:25 +02:00
Jules Aguillon
fc901bae9b Launcher activity: Fix crash on API < 28 2023-04-10 13:15:59 +02:00
doak
d4be979696 Do not lock modifiers if sliding a key
This unconditionally removes all pointers (touches) pressing modifiers
which are not already locked, avoiding that the (currently) latched
modifier will be locked aventually.

This can be verfified while sliding the space bar to move the cursor
left or right.

Closes #319.
2023-04-10 13:14:50 +02:00
Jules Aguillon
351355b3a7 Launcher activity: Input box
For trying the keyboard without having to mess with an other app.
2023-04-02 13:29:53 +02:00
Jules Aguillon
3caca59ff4 Refactor: Remove unecessary method KeyboardData.load_pin_entry 2023-03-28 11:55:24 +02:00
Jules Aguillon
35b4e442ab Add a launchable explanatory activity
This activity points to the system settings page for enabling input
methods. This is purely a shortcut but is expected by many users.

It could be made more useful in the future or hidden whenever the
keyboard is enabled.
2023-03-28 11:22:17 +02:00
Jules Aguillon
2f938dc6f4 Correct pointer direction
The previous algorithm did not cut the circle into 16 equal parts.
The division by 2pi yielded numbers smaller than 16, which no longer
made sense after the cast to int.
2023-03-13 03:06:43 +01:00
Mostafa Ayesh
ce51df6f5a
Add Arabic layout (#314)
* add arabic keyboard
* use unicode values for special characters
* add alternate layout
* use arabic numbers
2023-03-11 16:54:20 +01:00
Luke Videckis
6aaa497393
New Hindi layout (#313)
* New Hindi layout
* Update default layout for Marathi, Nepali
* Consistent naming for Devanagari layouts
2023-03-11 16:43:17 +01:00
Jules Aguillon
18d3fd3c84 Refactor: Remove KeyboardData.Corner
The Corner class is removed. The "localized" flag for all the corners is
held in a bitfield.
2023-03-05 23:08:35 +01:00
Jules Aguillon
c56ad425f6 Remove the 'edgekeys' attribute 2023-03-05 20:08:56 +01:00
Jules Aguillon
a6fe5cae00 Allow 8 symbols per key
'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-03 19:44:05 +01:00
Jules Aguillon
1f9e92ed60 Fix caps lock stopped by auto-capitalisation
Auto-capitalisation triggers when the backspace key is used. Make sure
to not remove a locked shift pointer.
2023-03-02 11:40:22 +01:00
Jules Aguillon
0da02d60c4 Do not remove numpad keys from the layout
This removes keys like '.' and '-' from their usual place, which is
pretty annoying.

The feature is retained for the number row.
2023-03-02 10:57:58 +01:00
Jules Aguillon
798494e701 Fix miscalculated keyboard height with number row
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-02-26 11:31:08 +01:00
JackDotJS
9523b158b3
Add theme "Alternative Black" (#297)
* Add alternative black theme
2023-02-26 09:47:31 +01:00
Jules Aguillon
0f62b3044c Option to switch to the previous input method
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-02-12 23:20:11 +01:00
Jules Aguillon
c46e3b6c61 Modify keys after a long press 2023-02-12 23:14:57 +01:00
Kazoku
5fac3459aa
Added missing accent that can combine with horn_accent (#293) 2023-02-09 23:38:55 +01:00
Kazoku
b54f9c5797
Vietnamese keyboard (#291)
Added missing accent (horn, hook, dot below)
Added layout
Added accent font svg (by modified existing accent)
2023-02-09 18:40:48 +01:00
Jules Aguillon
72249b8a42 Fix arrow keys not repeating
The special handling of arrow keys have been removed in 854eff2. Key
repeat was not starting when the key0 was empty.
2023-02-08 22:38:01 +01:00
Ram Kromberg
0fe27ef486
Add theme 'ePaper' (#287)
* Add theme 'ePaper'
2023-01-31 20:11:36 +01:00
Ram Kromberg
51ce2ccdf1 Add layouts 'he_il_1452_1' and 'he_il_1452_2' 2023-01-31 20:07:30 +01:00
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