click and other actions on widget

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

click and other actions on widget

Post by tsolignani » 28 Jan 2020 16:07

Good afternoon everyone.

I know i can have a clickable element on a widget which does a thing if, say, clicked, and another one if double, or long, clicked.

Is there a way I can get to know if that widget has been clicked once, twice, double clicked and so on?

That way I could have a single flow perform a task slightly different according to the way the clickable element has been tapped.

For instance, I can have a flow make reply to a mail if clicked once or reply all if double clicked.

Thank you, this is a great community indeed!

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: click and other actions on widget

Post by Desmanto » 28 Jan 2020 19:13

Yes, check the {gesture} variable. This var only available when the flow is triggered by widget action. Look at this similar topic about combining multiple widget action block into single flow : viewtopic.php?f=4&t=8525

gesture can have 7 values :
CLICK
LONG_CLICK
DOUBLE_CLICK
SWIPE_UP
SWIPE_DOWN
SWIPE_RIGHT
SWIPE_LEFT

You can also check {widget_cell_x} and {widget_cell_y} to find out which block is the source of action. Look at the link above for example how I implemented it. It is much easier to use a map to map each action first, before branching them accordingly using multiple parallel expression.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply