Get if an overlay is shown or not

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
User avatar
mbirth
Posts: 80
Joined: 17 Mar 2016 00:02
Location: Berlin, Germany
Contact:

Get if an overlay is shown or not

Post by mbirth » 16 Dec 2017 00:23

I can't seem to find a way to check if an overlay is currently displayed on the screen or not.
BlackBerry KEY2, Android 8.1.0

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

Re: Get if an overlay is shown or not

Post by Desmanto » 16 Dec 2017 09:26

You can use a script to accompany every show/hide widget to detect the widget state. So before/after showing the widget, set the glovar to "show", and before/after hiding the widget, set the glovar to "hide". Something like that. To check the widget state, check the value of the glovar.
Or to omit the glovar, you can set one of the widget's element visibility to false when hiding and true when showing. Use getElementWidgetProperty() to check the true/false state.

That is the workaround for now. It is still better to have a separate condition to check if the overlay is showing or not. So plus 1 for this.
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.

User avatar
mbirth
Posts: 80
Joined: 17 Mar 2016 00:02
Location: Berlin, Germany
Contact:

Re: Get if an overlay is shown or not

Post by mbirth » 16 Dec 2017 12:43

Desmanto wrote:You can use a script to accompany every show/hide widget to detect the widget state. So before/after showing the widget, set the glovar to "show", and before/after hiding the widget, set the glovar to "hide". Something like that. To check the widget state, check the value of the glovar.
Thanks! Yes, this is what I'm doing at the moment - but it is cumbersome compared to having a function that I can query and that returns the actual state.
BlackBerry KEY2, Android 8.1.0

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Get if an overlay is shown or not

Post by digitalstone » 16 Dec 2017 12:53

Yes, just do it with a global variable.
I have 1 set up like "global_widgetAntiBlue_OnOff".

When i want to set it's state, i use a script like: global_widgetAntiBlue_OnOff = true;

But as a con: It also populates the global variables pool.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

User avatar
regissg
Posts: 22
Joined: 23 Apr 2018 13:13

Re: Get if an overlay is shown or not

Post by regissg » 15 May 2018 17:09

To follow up on that topic I was wondering if getWidgetElementProperty could provide the show/hide state of a specific widget. If yes what is the getWidgetElementProperty syntax?

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Get if an overlay is shown or not

Post by digitalstone » 15 May 2018 17:18

I think not. The widget sits in it's own 'container'.
Creating/setting/getting the widget itself is all being done within that container.
That 'container' would then be the "overlay" that is being held by Android.

Not sure what the possibilities are from there.
My bet is that the overlay is mostly in the hands of Android.

As a work-around you could make the needed widget-elements transparant.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

Locked