Closed buisiss12 closed 1 month ago
In the interface there should be a Flic2ButtonClick...
Maybe, somewhat counterintuitively, there are 3 boolean flags: isSingleClick isDoubleClick isHold
only one can be true at any one time. So double click and isDoubleClick==true and hold, isHold==true
line 182 in the example code handles it, not very pretty, but hopefully enough to let you carry on?
in my personal project, I quickly convert to an enum: if (buttonClick.isSingleClick) { provider.informListeners(ClickPattern.double, clickSource); } if (buttonClick.isDoubleClick) { provider.informListeners(ClickPattern.single, clickSource); } if (buttonClick.isHold) { provider.informListeners(ClickPattern.long, clickSource); }
On Mon, 25 Sept 2023 at 00:14, Y @.***> wrote:
I appreciate the work you guys do. Is there any way I can use double click and hold??
— Reply to this email directly, view it on GitHub https://github.com/DarkerWaters/flic_button/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKMPQG5MP3OV3ZJF7SIHD3X4C5GJANCNFSM6AAAAAA5FH465E . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thank you very much! I understand them clearly.
May I ask one more question? Is there a function that does not use double-click, for example, "FLICButtonTriggerModeClickAndHold" in the official library? I would like to be able to ignore double clicks like this, but not two single clicks. I would like to be able to use this function when I hit flic2 repeatedly for click counting. if (isSpecialMode && buttonClick.isDoubleClick) { return; }
There's nothing like that, but you could listen to the 'onButtonUpOrDown' function and do your own click counting to get what you want.
I haven't checked, you might want to look at debouncing, but other than that, using the time it went down and up again you should be able to handle as many clicks as you want.
Warning though; the button itself can register a click, double click etc while disconnected. On connection, it then sends those past events to you. I don't think onButtonUpOrDown will manage that, working only while connected live. So maybe handle flic's click counters and then the button up down calls to count more?
On Wed, 27 Sept 2023 at 22:34, Y @.***> wrote:
May I ask one more question? Is there a function that does not use double-click, for example, "FLICButtonTriggerModeClickAndHold" in the official library? I would like to be able to ignore double clicks like this, but not two single clicks. I would like to be able to use this function when I hit flic2 repeatedly for click counting. if (isSpecialMode && buttonClick.isDoubleClick) { return; }
— Reply to this email directly, view it on GitHub https://github.com/DarkerWaters/flic_button/issues/10#issuecomment-1738108442, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKMPQFBFFCADYFKQIEDVFTX4SLW3ANCNFSM6AAAAAA5FH465E . You are receiving this because you commented.Message ID: @.***>
I was actually able to implement a hold with isDown using Timer. >Warning though; the button itself can register a click, double click etc while disconnected. On connection, it then sends those past events to you. I don't think onButtonUpOrDown will manage that, working only while connected live. So maybe handle flic's click counters and then the button up down calls to count more?< I just confirmed that phenomenon and will try to implement that idea when needed. Thank you very much!!
I appreciate the work you guys do. Is there any way I can use double click and hold??