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

Triggering of haptic and audio feedback during cursor movement on spacebar swipe #1035

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ZiemlichUndead
Copy link

I added a line that triggers the default haptic and audio feedback when the cursor is getting moved by swiping over the spacebar.
If keypress sound is enabled the sound might get spammed a bit.

The implementation works well for me like this but I didnt fully understand the method I modified so maybe this doesnt make sense in every case.

Issue 381 also requested this.

Steffen.S added 2 commits August 6, 2024 01:58
Added methods to customize for cursor haptic feedback using TEXT_HANDLE_MOVE and CLOCK_TICK (API <27)
@ZiemlichUndead
Copy link
Author

I have now added methods to make the call using TEXT_HANDLE_MOVE and remove audiofeedback.
TEXT_HANDLE_MOVE isnt available in API <27 so I used CLOCK_TICK in that case which seemed similar to me.

viewToPerformHapticFeedbackOn.performHapticFeedback(
HapticFeedbackConstants.TEXT_HANDLE_MOVE,
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}else {
} else {

@Helium314
Copy link
Owner

Does this work for everyone except me?
It seems like a bunch of HapticFeedbackConstants like CLOCK_TICK or TEXT_HANDLE_MOVE don't actually trigger anything. Others like KEYBOARD_TAP are too strong, as already discussed. Specifying e.g. vibrate(10) works though.
Using Android 10 / LineageOS 17, Samsung A3 2017.

@devycarol
Copy link
Contributor

I actually wrote some haptic mods a while ago for my homebrew. Those are newer API constants, so they do nothing on newer versions. I believe they have IDE warnings because of that.

I've not looked at the code in a while, but there should probably be a central place haptics handling that addresses all the version differences and stuff.

@Helium314
Copy link
Owner

but there should probably be a central place haptics handling that addresses all the version differences and stuff.

Actually there were a few Compat files for various things. I removed a bunch, as we don't need to deal with Android before 5 any mre, but I neglected adding new ones when it would have been useful.
But anyway, I agree putting stuff that deals with API differences should be put in a separate file (or folder).

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.

4 participants