In the resumed event, if the container is not loaded their size is 0,0.
In the resumed event, if the container is not loaded their size is 0,0.
This is relatively easy to check and do something to fix it.
However, if you have the screen in portrait only, open a horizontal app (it force the device in horizontal) and then go back to the launcher, the returned size is the horizontal one, and this is much more difficult to check (you need to ask the correct size or store it…)
I guess it happen the same when going from vertical to horizontal.
Isn’t any way to force that loaded event to run after the container is loaded, but before it is shown to the user?
]]>
< ![CDATA[
There is a workaround if you use a setTimeout to call the same script. (So when it is run in the resumed event it sets the timeout, otherwise run normally)
Even if you use a 0 milliseconds timeout it works, however you need to pass the event parameters you want to use.
]]>
< ![CDATA[
Here is how things works:
the Android runtime wait for some event. Events are waiting in a queue. Each time an event is available, it is processed and removed from the queue, then the next one is processed. Among these events there are the “created” event, the “resized” events (to simply) or also app generated events such as “timeouts”. Hence, when a function is executed through a setTimeout, it allows the runtime to finish processing of the current event, and analyse the next one, which maybe a “resized” event. This means it may work, but also maybe if the resized event has not yet been received, it may not work 🙁
The only solution would be to have a resized event in the launcher too.
]]>
< ![CDATA[
But can’t you send the ‘created/resized’ event before the ‘run all the resumed scripts’?
]]>
< ![CDATA[
No, because the app follows the sequence of events as imposed by the android framework.
]]>
< ![CDATA[
I plan to make a release soon because there is enough new things in the current version, but I will tackle this issue one way or the other in the next version.
]]>