Page 1 of 1
SET_VOLUME_KEY_LONG_PRESS_LISTENER
Posted: 13 Apr 2019 09:50
by anuraag
@Martin
Can you please add this to your to do list? SET_VOLUME_KEY_LONG_PRESS_LISTENER was added in oreo source code and can be used as trigger with screen off too.
for ref
https://www.xda-developers.com/skip-mus ... s-no-root/
Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER
Posted: 15 Apr 2019 01:24
by Desmanto
Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER
Posted: 15 Apr 2019 15:12
by Martin
Sure
Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER
Posted: 05 Jun 2019 08:28
by Pepy
@Martin, would it also be possible to customize the duration of the long-press for the trigger to activate as well?
Using the Hardware Key Event, a key_duration variable was provided. Perhaps the same can be done with this one.
Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER
Posted: 08 Jun 2019 07:58
by Martin
The system controls when the Down action is sent to Automagic and I don't see a way to configure this. But you could add a condition to the flow to execute different actions based on variable key_duration for the Up action.
e.g. a condition Expression: key_duration > 1500 to execute subsequent actions only when the duration was longer than 1500ms.
Delaying detection of the down event would also work but it's slightly more complicated since it requires to detect and ignore the down event when the delay is not reached. Something like this might work to execute an action when VOLUME_DOWN is pressed and hold more than initalDelay+500ms:
Flow 1:
-Trigger Volume Long Press Event: VOLUME_DOWN Down
-Action Sleep: 500ms
-Action ...
Flow 2:
-Trigger Volume Long Press Event: VOLUME_UP Up
-Action Stop Flows: Flow 1
I add a TODO item to integrate this feature directly into the trigger.
Regards,
Martin
Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER
Posted: 17 Sep 2019 02:00
by Pepy
Martin wrote: ↑08 Jun 2019 07:58
The system controls when the Down action is sent to Automagic and I don't see a way to configure this. But you could add a condition to the flow to execute different actions based on variable
key_duration for the Up action.
e.g. a condition
Expression: key_duration > 1500 to execute subsequent actions only when the duration was longer than 1500ms.
That's the method I'm currently using now
Unfortunately, it only works when the screen is on.
Martin wrote: ↑08 Jun 2019 07:58
Delaying detection of the down event would also work but it's slightly more complicated since it requires to detect and ignore the down event when the delay is not reached. Something like this might work to execute an action when VOLUME_DOWN is pressed and hold more than initalDelay+500ms:
Flow 1:
-Trigger
Volume Long Press Event: VOLUME_DOWN Down
-Action
Sleep: 500ms
-Action ...
Flow 2:
-Trigger
Volume Long Press Event: VOLUME_UP Up
-Action
Stop Flows: Flow 1
So in this case, wouldn't I need a condition to check if Flow 1 is still running?
Martin wrote: ↑08 Jun 2019 07:58
I add a TODO item to integrate this feature directly into the trigger.
Are you referring to the delay?