Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use keyup/keydown ECP commands instead of keypress for a smoother operation. #45

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

pupitetris
Copy link
Contributor

I first noticed there was a problem with RoMote when trying the Retaliate game on Roku, but I've seen that it affects more common use cases, such as doing ff or rew while playing a video on YouTube or any other player, or navigating quickly on content collections.

This patch changes RoMote so that it sends keyup/keydown commands instead of single kepress commands every 400ms.

RepeatingImageButton class is no longer used and all remote buttons use VibratingImageButton, which was modified to listen to Touch events. Click events are still handled in case the buttons are clicked using a non-touch device.

Haptic vibrations were retouched a bit, allowing for the new Effects API to be used, with a gracious fallback for older devices. The vibration is now more subtle, as they are now produced using EFFECT_TICK.

instead of onclick + keypress. This allows for a smoother control for
situations where holding a button down is handled (as a test case,
check the Retaliate Roku Game).
instead of onclick + keypress. This allows for a smoother control for
situations where holding a button down is handled (as a test case,
check the Retaliate Roku Game, or scrolling through videos on YouTube
and moving through a video replay).

Even the main Roku menu uses rew/ff buttons as PgUp/PgDn alternatives
to skip options by screenfulls, and changing the behaviour of the
buttons here has an impact too. Same case for back in standard
navigation.

So, this is the only behaviour for buttons that emmit key events now.
with a fallback for old platform versions.

Also, new private getVibrator and code factorization to avoid
repetition between the new provideHapticEffect and
provideHapticFeedback.
to allow for haptic feedback just as the button is touched instead of
at the end on the click process, and to allow for the click process to
be prevented so that finer keyup and keydown commands can be sent to
the Roku while preventing a duplicitous keypress to be sent at the end
of the interaction. A click/keypress can still be used in case the
button is "clicked" by different means than touch input.

VIBRATE_DURATION_MS reduced to 25ms, and provideHapticFeedback calls
were replaced with provideHapticEffect with EFFECT_TICK for a more
subtle vibration pattern.
with VibratingImageButton, as the RepeatingImageButton behaviour is no
longer needed: finer keyup/keydown commands sent on touch events
render the timed keypresses obsolete. All buttons, including the dpad
can be implemented with VibratingImageButton directly.
RepeatingImageButton class no longer needed.

All buttons have their listeners configured with linkButton, which
sets up click and touch listeners.
just to respect the original order of the code.
as it doesn't make sense to do so, and this prevented special buttons
such as Power from working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant