Style problems on Android

81 views
Skip to first unread message

Carlos Verdier

unread,
Dec 29, 2015, 8:56:58 AM12/29/15
to CodenameOne Discussions
Hi

I'm writing this in a rush so i'm afraid i'm not providing too much info, but I wanted to give a first impression of the recent issues I'm having with my app on Android. None of these issues shows on simulator nor on my production app released just a month ago.

- Can't style Forms with background images anymore. If I do, the whole screen darkens a bit. It's ok, because I can style containers.
- Can't use transparency on background colors now; if I do, the foreground get the transparency as well.
- If I remove a TextField form a container, I get a null pointer on Android. 

Furthermore, Part of my screen is messed where it was fine only some weeks ago. I can't give more details as I don't have a clue of what is causing these problems, but I believe it has to do with the issues commented above.

Thanks

hebert....@gmail.com

unread,
Dec 29, 2015, 9:52:26 AM12/29/15
to CodenameOne Discussions
Yes . I have similar problems like you. I think it is related to the latest update.



Mario Barón

unread,
Dec 29, 2015, 10:03:25 AM12/29/15
to CodenameOne Discussions
I'm having the same issues

Carlos Verdier

unread,
Dec 29, 2015, 10:08:50 AM12/29/15
to CodenameOne Discussions
Updates:

Point 3 is solved by calling Display.getInstance().stopEditing before removing the textfield but this was an unrelated issue.

The styling remains the same. As I said, it seems that setting transparency to 255 or not overriding solves the problem. Also, using styling for Forms seems to be causing problems.

Steve CN1 Hannah

unread,
Dec 29, 2015, 11:13:49 AM12/29/15
to codenameone...@googlegroups.com

Point 3 is solved by calling Display.getInstance().stopEditing before removing the textfield but this was an unrelated issue.

I believe this is fixed in Git already so you shouldn't need this workaround anymore once the build server has been updated to the latest.  

Steve

Mario Barón

unread,
Dec 29, 2015, 11:24:45 AM12/29/15
to CodenameOne Discussions
Hey Steve,

that seems like a relief, thank god you guys respond quickly. Out of curiosity, when will the build server be updated? I'm kind of held back to turning in a new version to my client.

Thanks again for your quick response.

Steve CN1 Hannah

unread,
Dec 29, 2015, 11:26:15 AM12/29/15
to codenameone...@googlegroups.com
On Tue, Dec 29, 2015 at 8:24 AM, Mario Barón <mario...@gmail.com> wrote:
Hey Steve,

that seems like a relief, thank god you guys respond quickly. Out of curiosity, when will the build server be updated? I'm kind of held back to turning in a new version to my client.

Whenever Shai does the next update.  Should be soon -- usually 24 to 48 hours.

Steve

Carlos Verdier

unread,
Dec 29, 2015, 11:39:28 AM12/29/15
to CodenameOne Discussions
Hi Steve

The fix you are talking about is related to the textfield problem or the styling? Thanks

Steve CN1 Hannah

unread,
Dec 29, 2015, 11:42:24 AM12/29/15
to codenameone...@googlegroups.com
Just the textfield problem.  I think Shai probably has a better idea on the Style issue.

Steve

--
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-discu...@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/b236259c-9174-456e-9f40-253a4f2ef905%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

Chen Fishbein

unread,
Dec 29, 2015, 12:22:01 PM12/29/15
to CodenameOne Discussions
Hi,
The styling issues are most likely related to the performance improvements we were working on last week.
Most of the work has been reverted now, please check if your app is back to normal and let us know.

Thanks

Steve CN1 Hannah

unread,
Dec 29, 2015, 1:04:35 PM12/29/15
to codenameone...@googlegroups.com
Shai informs me that the server is already up to date, so it is possible that your issue with the text field has not been fixed.  Can you share some sample code to reproduce the issue?

Steve

On Tue, Dec 29, 2015 at 8:39 AM, Carlos Verdier <cver...@gmail.com> wrote:

--
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-discu...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.

Carlos Verdier

unread,
Dec 29, 2015, 1:27:55 PM12/29/15
to CodenameOne Discussions
            Container contenedorElimina = (Container) findBarraIngredientes(f).getComponentAt(posicionSugerencia);
            TextField textoElimina = (TextField) getContenedorSugerencia.getComponentAt(0);
            Display.getInstance().stopEditing(textoElimina);
            f.revalidate();
            contenedorElimina.setX( - contenedorElimina.getWidth() );
            contenedorElimina.setShouldCalcPreferredSize(true);
            findBarraIngredientes(f).animateUnlayoutAndWait(300, 255);                                   
            findBarraIngredientes(f).removeComponent(contenedorElimina);


Yes, the problem is still there, but I think it has to do with the animation. If I just remove the container without animateUnlayoutAndWait it's all fine. I've read on the blog about the new animation manager, so I guess this way of doing things is deprecated now and I have to learn the new way... Also, this code is causing problems now (used to work fine):

contenedorPadre.replaceAndWait(contIzquierda, contDerecha, CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, false, 300), true);


I would be great if you could provide some example to replace the two codes above, since pretty much of my animation relies on this.

Thank you


On Tuesday, December 29, 2015 at 7:04:35 PM UTC+1, Steve CN1 Hannah wrote:
Shai informs me that the server is already up to date, so it is possible that your issue with the text field has not been fixed.  Can you share some sample code to reproduce the issue?

Steve
On Tue, Dec 29, 2015 at 8:39 AM, Carlos Verdier <cver...@gmail.com> wrote:
Hi Steve

The fix you are talking about is related to the textfield problem or the styling? Thanks

On Tuesday, December 29, 2015 at 5:26:15 PM UTC+1, Steve CN1 Hannah wrote:


On Tue, Dec 29, 2015 at 8:24 AM, Mario Barón <mario...@gmail.com> wrote:
Hey Steve,

that seems like a relief, thank god you guys respond quickly. Out of curiosity, when will the build server be updated? I'm kind of held back to turning in a new version to my client.

Whenever Shai does the next update.  Should be soon -- usually 24 to 48 hours.

Steve

--
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+unsub...@googlegroups.com.

Carlos Verdier

unread,
Dec 29, 2015, 1:28:35 PM12/29/15
to CodenameOne Discussions
Thanks Chen, but no change. I still have the problems described in my post.

Steve CN1 Hannah

unread,
Dec 29, 2015, 1:35:42 PM12/29/15
to codenameone...@googlegroups.com

On Tue, Dec 29, 2015 at 10:27 AM, Carlos Verdier <cver...@gmail.com> wrote:
            Container contenedorElimina = (Container) findBarraIngredientes(f).getComponentAt(posicionSugerencia);
            TextField textoElimina = (TextField) getContenedorSugerencia.getComponentAt(0);
            Display.getInstance().stopEditing(textoElimina);
            f.revalidate();
            contenedorElimina.setX( - contenedorElimina.getWidth() );
            contenedorElimina.setShouldCalcPreferredSize(true);
            findBarraIngredientes(f).animateUnlayoutAndWait(300, 255);                                   
            findBarraIngredientes(f).removeComponent(contenedorElimina);


Thanks.  I've reproduced the problem.  Looking into it now.

Steve

Steve CN1 Hannah

unread,
Dec 29, 2015, 1:42:34 PM12/29/15
to codenameone...@googlegroups.com
Though I've reproduced the issue, it doesn't seem to matter whether or not the text field is currently editing.  Here is the full stack trace.  Looks like it is just related to the animation.

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.codename1.ui.Form.deregisterAnimated(com.codename1.ui.animations.Animation)' on a null object reference
12-29 10:34:46.714 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.TextField.deinitialize(TextField.java:1177)
12-29 10:34:46.714 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.Component.deinitializeImpl(Component.java:4233)
12-29 10:34:46.714 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.TextArea.deinitializeImpl(TextArea.java:565)
12-29 10:34:46.714 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.Container.removeComponentImplNoAnimationSafety(Container.java:907)
12-29 10:34:46.714 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.Container$3.updateState(Container.java:890)
12-29 10:34:46.714 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.animations.ComponentAnimation.updateAnimationState(ComponentAnimation.java:80)
12-29 10:34:46.714 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.AnimationManager.updateAnimations(AnimationManager.java:61)
12-29 10:34:46.715 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.Form.repaintAnimations(Form.java:1301)
12-29 10:34:46.715 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.Display.edtLoopImpl(Display.java:1077)
12-29 10:34:46.715 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.Display.mainEDTLoop(Display.java:994)
12-29 10:34:46.715 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
12-29 10:34:46.715 32368-32392/com.codename1.tests.textediting W/System.err:     at com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
12-29 10:34:46.715 32368-32392/com.codename1.tests.textediting W/System.err:     at java.lang.Thread.run(Thread.java:818)


In any case.  I'm looking into this now and should have a fix soon.

Steve

Carlos Verdier

unread,
Dec 29, 2015, 1:45:13 PM12/29/15
to CodenameOne Discussions
Ok, thank you

Shai Almog

unread,
Dec 29, 2015, 11:07:32 PM12/29/15
to CodenameOne Discussions
FYI we removed a *small* part of the optimizations that was flaky. The core of the optimizations is still there.
We're uploading a new server instance that should fix the replace animation issue, that's related to the rewrite of the animation API. Notice that your code is fine and should work as is. We didn't deprecate it, only made some changes to the way it behaves to make it safer.

Carlos Verdier

unread,
Dec 30, 2015, 5:17:29 AM12/30/15
to CodenameOne Discussions
Ok, it's working fine now, thank you.

I've noticed that now animateUnlayoutAndWait + removeComponent need to be the last things in the code or you have odd behaviors if not. 

I had some workarounds that are not needed anymore (like f.revalidate() at the end to ensure the component was really removed, since sometimes it was stuck there after the animation). Removing it has solved some problems I was having.

I even had to move some lines of code before animation (f.addcommand was causing problems as well in that position).

After these changes, my animations are back to normal. 

Now I have another issues, such an odd flickering in some texts, probably related to a list renderer (but I am only guessing). I'll open a new thread if this problem persits.

Shai Almog

unread,
Dec 30, 2015, 11:09:40 PM12/30/15
to CodenameOne Discussions
Check if the flickering still happens in current builds.

Animations should now behave more consistently across platforms so these changes would probably make your code more robust.

Carlos Verdier

unread,
Dec 31, 2015, 8:26:30 AM12/31/15
to CodenameOne Discussions
The flickering is still there, as you can see in this video capture:


(At the end you can see the button problem we discussed on the other thread)

Shai Almog

unread,
Dec 31, 2015, 10:58:23 PM12/31/15
to CodenameOne Discussions
Can you isolate the flickering to a small test case we can work with?
Do you override paint/paint background in any way?
How is the style for the flickering components defined?

Carlos Verdier

unread,
Jan 1, 2016, 3:35:24 PM1/1/16
to CodenameOne Discussions
I have created a small project here:


If you swipe slowly between tabs (and stop in the middle) you can see the effect. I have tested on Android phone.

I think the issue here is styling with true type fonts, but I leave the conclusion to the experts :). Anyway, today it's not that bad as previous days.

Shai Almog

unread,
Jan 2, 2016, 1:24:28 AM1/2/16
to CodenameOne Discussions
I'll try to look at it. Can you also file an issue and link to the project?

Thanks.

Carlos Verdier

unread,
Jan 16, 2016, 10:49:25 AM1/16/16
to CodenameOne Discussions
It's working perfect now, thank you
Reply all
Reply to author
Forward
0 new messages