Helium314 / HeliBoard

Customizable and privacy-conscious open-source keyboard
Apache License 2.0
2.21k stars 84 forks source link

Improve key swipe interface #962

Open Helium314 opened 1 month ago

Helium314 commented 1 month ago

Currently key swipes (not gesture typing) work only on space an delete keys. Space swipe can be customized somewhat, delete swipe can only be enabled/disabled. Changing the interface to a more flexible onKeySwipe(keyCode, direction) and onEndSwipe(keyCode) would allow simpler, more contained and also more customizable swipe actions:

There are some things to consider though: There is a single KeyboardActionListener, but mulitple PointerTrackers (to allow multi-touch). This means the KeyboardActionListener needs to be careful when keeping track of the swiping state. Maybe swipe actions will need to provide the pointer tracker id. Using multiple KeyboardActionListeners will not work here, because currently the KeyboardActionListenerImpl keeps track of the meta state (ctrl/alt/...), which should be global (though meta state could possible be handled in another place). Maybe the KeyboardActionListener(Impl) could internally use multiple KeySwipeListeners (which would handle the key swipes, and nothing else), one per pointer tracker. Using such a KeySwipeListener with different implementations might also be useful for avoiding convoluted code when dealing with mutually exclusive key swipe styles. The whole thing should also consider performance, as onKeySwipe can be called very often.

devycarol commented 1 month ago

I'll PR more delete keys soon, which includes a word-delete slider. That would be a nice option for the regular delete key, similar to Gboard.