Page 1 of 1

Get if an overlay is shown or not

Posted: 16 Dec 2017 00:23
by mbirth
I can't seem to find a way to check if an overlay is currently displayed on the screen or not.

Re: Get if an overlay is shown or not

Posted: 16 Dec 2017 09:26
by Desmanto
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.

Re: Get if an overlay is shown or not

Posted: 16 Dec 2017 12:43
by mbirth
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.

Re: Get if an overlay is shown or not

Posted: 16 Dec 2017 12:53
by digitalstone
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.

Re: Get if an overlay is shown or not

Posted: 15 May 2018 17:09
by regissg
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?

Re: Get if an overlay is shown or not

Posted: 15 May 2018 17:18
by digitalstone
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.