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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Allow specifying a layout for programming and add a key for switching to
it easily.
The switching key is placed on the top edge of the space bar.
The option has no effect by default because the ergonomic isn't ideal,
it needs to be enabled explicitly.
Users of Latin-script languages certainly prefer to use one layout (for
programming or not). This feature might be removed in favor of a better
language-switching mechanisms in the future.
Before sending a key event while modifiers are active, send events for
the modifier keys.
Some applications don't look at the "metaState" flags but instead keep
track of the up and down events for the modifiers.
For example, the basic text views that are in every applications
correctly handle the "metaState" flags except for one binding:
Selecting text with the arrows while pressing shift.
Show these characters only for users that have the corresponding locale
installed (a supported eu language for €, en-GB for £).
Add these characters to most layouts.
There were two problems:
- The Action key was swapped when it shouldn't be. The flag
'IME_FLAG_NO_ENTER_ACTION' wasn't interpreted correctly for inputs
that specified both an action and this flag.
- The value 'IME_ACTION_UNSPECIFIED' should remove the Action key.
It is placed on the top-right of the enter key on every layouts.
It sends a special event (performEditorAction) instead of writing a
newline.
The "actionId" is passed through the EditorInfo object in an obfuscated
way so it's not clear whether it's using the right one.