Commit Graph

512 Commits

Author SHA1 Message Date
Jules Aguillon
8611dbcfa0 CustomExtraKeysPreference: Reusable edit text layout
This layout is generically used by CustomExtraKeysPreference and
LayoutsPreference.
2023-08-16 12:20:40 +02:00
Jules Aguillon
03f2b8df70 ListGroupPreference.Serializer: Allow exceptions
(De)serializing might raise exceptions, which are handled by dropping
the failing item.
2023-08-16 12:20:40 +02:00
Jules Aguillon
0269cd65ea ListGroupPreference: Make items abstract
Allow items to be of any class instead of strings.

Item serialization and deserialization methods are in a separate class
because they are also used in a static context.
2023-08-16 12:20:40 +02:00
sdrapha
29106bc69a Add Superscript and Subscript letters 2023-08-07 18:38:53 +02:00
Rapha
f522a678f9 Add superscript, subscript, ª and º to optional extrakeys
And add description strings.
2023-08-07 18:38:53 +02:00
Jules Aguillon
21316b77d7 Don't elide label of non-string keys
Several non-string keys can have a large label that shouldn't be elided,
for example ctrl, meta, send.

Also, change the cutoff to 3 characters as labels are easily colliding.
2023-08-07 13:11:21 +02:00
Jules Aguillon
8d7b3efeb1 LayoutsPreference: Show layout display names
The internal name of layouts was rendered.
2023-08-06 19:54:38 +02:00
Jules Aguillon
ddc4ff1378 Describe editing keys
The new strings are used in the "Add keys to the keyboard" option.
2023-08-06 19:35:06 +02:00
Jules Aguillon
1c59347cca Add glyphs for editing keys
All from Material Design Icons.
2023-08-06 19:17:05 +02:00
Jules Aguillon
eb56c80ffb Elide custom keys labels
Make the font smaller for custom keys with a length above 1.
Draw up to 4 characters on keys.
2023-08-06 18:22:15 +02:00
Jules Aguillon
4d10556d49 Don't replace user selected dead keys
Don't replace dead-keys selected in the "Add keys to the keyboard"
option by an alternative.
2023-08-06 17:15:36 +02:00
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