Commit Graph

317 Commits

Author SHA1 Message Date
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