[codenameone-discussions] Re: Image drawing on iOS is erratic

2016-08-10 Thread Shai Almog
Drawing to images on iOS relies on a buffer which is global so it can't be 
threadsafe. 
You can use a UITimer to create the clocks one by one on the EDT and cancel 
the timer when you are done.

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/47c25375-f5d2-4b70-bcd7-fb2cec9dd302%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: Image drawing on iOS is erratic

2016-08-10 Thread nickkoirala
I'm drawing clocks for a list of events that have different times that need 
to be displayed.

I am caching them so they aren't generated every time but they do need to 
be generated at some point. Currently there are about 20 and it takes under 
a second so it just 'sticks' the UI briefly. 

I was concerned about scalability if there were 100+ but if there is 
nothing that can be done to manage this I'll just put a static loading 
message and block the UI while images are created on the EDT.

There is thread safe drawing on iOS since iOS 4.0 but I don't know enough 
about the details under the hood of the VM to know if its possible with how 
Codename One is handling the drawing.

What are circumstances where invokeAndBlock called from the EDT would be 
useful? I've always used it to show a loading indicator while setting up a 
form in postShow or beforeShow and it seems to work but if its not running 
on the EDT it probably is causing issues.

   Dialog d = new InfiniteProgress().showInifiniteBlocking();
Display.getInstance().invokeAndBlock(() -> {
 //layout the form here, set models for list from local data sources (e.g., 
SQLite), add components to the heirarchy or whatever else can be done 
(without network).
});
d.dispose();




On Wednesday, August 10, 2016 at 5:51:42 PM UTC+12, Shai Almog wrote:
>
> What do you need to draw that will take so long it will require progress 
> indication?
> Drawing to any surface needs the EDT, the rendering pipeline is pretty 
> deep in some OS's and very complex. Making it threadsafe would make it 
> unusable...
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/3003cb92-aeea-40ba-8a4a-92e9abfda0ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: Image drawing on iOS is erratic

2016-07-18 Thread Shai Almog
Yes, I refined the JavaDoc there. We didn't touch it since 2007.
The EDT section in the developer guide explains this better.

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/c6ec0f6d-2390-44ea-9c00-96b8c6ff1a3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: Image drawing on iOS is erratic

2016-07-17 Thread Shai Almog
invokeAndBlock is by definition off the EDT.
iOS is really sensitive to off EDT drawing due to the way offline images 
are drawn there (they use a global context object).

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/8837266f-166a-475b-9cdd-dcd70c0e98f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.