Commit Graph

421 Commits

Author SHA1 Message Date
Eluc
6cb6f2541b
Add Bitcoin symbol to Fn+b (#434) 2023-08-18 12:14:20 +02:00
Jules Aguillon
5123ce5417 Fix slider movements changing input focus
The slider was repeatedly sending arrow keys, which change the focused
input when the end of a text box is hit.

A new key is added that implements cursor movements using the
`InputConnection` API.
The new keys are defined as `KeyValue.Editing`, which are no longer only
context menu actions.

The behavior when a selection has started is changed. The selection is
modified instead of cleared even when shift isn't pressed or the
selection would become empty.

Fallbacks to sending arrow keys for editors that do not support the API,
like Termux.
2023-08-17 12:47:44 +02:00
Jules Aguillon
2dc0ce066d Fix inconsistent initial spacing between keys
Settings defined with `get_dip_pref` had a wrong default value on first
launch.

The "right" default value was used after the shared preferences are
populated.
2023-08-16 18:25:20 +02:00
Jules Aguillon
5822f98bbb Migrate layouts preferences
The new `layouts` preference replaces three previous preferences:

    layout
    second_layout
    custom_layout

Add a preference migration function, which first migration is to
migrate layouts into the new preference.

The migration must also be called from the SettingsActivity as it might
use a different preference store due to the boot-aware preference copy.
2023-08-16 12:21:40 +02:00
Jules Aguillon
613aa283bd LayoutsPreference: Remove cross button for custom layouts
Remove the cross button on the right of custom layouts to reduce
accidental removal.
A remove button is added in the dialog for modifying the layout.
2023-08-16 12:21:38 +02:00
Jules Aguillon
ddceb69d4e LayoutsPreference: Modify custom layout
Clicking on a custom layout opens a dialog for modifying the layout
description instead of the dialog for selecting a layout.
2023-08-16 12:21:25 +02:00
Jules Aguillon
4584e8289b Remove unused class LayoutListPreference
This class is not used since the introduction of [LayoutsPreference].
2023-08-16 12:21:25 +02:00
Jules Aguillon
febc23776f ListGroupPreference: Fix change items
[Preference.onClick] is apparently not called on [Item]s, though it is
on [AddButton].

Workaround this by listening on click events on the view.
2023-08-16 12:21:25 +02:00
Jules Aguillon
500f4e41d3 Allow multiple custom layouts
This merges the "Layouts" option with the "Custom layout" option.
A custom layout becomes an item in the "Layouts" list among the other
layouts. It's possible to add several custom layouts.

Selecting the "Custom layout" item in the list opens a second dialog for
entering the layout description.

Layouts are serialized as JSON object and are decoded solely in the
LayoutsPreference class.
2023-08-16 12:21:23 +02:00
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