One of the often requested features in Codename One is zip support, we had some issues with it until a couple of years back when we added tar and gzip support. But people still asked for standard zip file support which was missing.
So I "ported" the zipme project to Codename One here. I’m quoting the word "ported" because I did almost nothing. I just copied the sources into a new cn1lib project and it "just worked" for the most part.
I did have to fix one thing in the iOS builds though. Some hackers use
String objects to store binary data in rather creative ways to save a bit of syntax. This practice is rather inefficient when compared to just using arrays but it is still widely practiced. In this case this code was used:
String bitReverse = "\000\010\004\014\002\012\006\016\001\011\005\015\003\013\007\017";
That is the exceedingly rare octal notation in Java strings… Unfortunately because the data includes many "invalid" characters translating this into a C string is really hard. So our VM choked on that.
Normally we’d fix something like this but since it’s both rare and slow when compared to just using an array we chose to just fix the code and be done with it.
My code is littered with code that looks like:
// error handling code block...
Dialog.show("Error", "Generic error message", "OK", null);
This is in catch blocks, if statements etc.
I’m sure your code is full of that too and this was getting on my nerves. It’s great to have an error message but why do we need to dismiss it or even have it in a
So I wrote some code that shows it in a ToastBar and then it dawned on me that this should really replace Dialog for this specific use case.
So we added these two static methods:
ToastBar.showErrorMessage(String msg, int timeout)
These methods effectively make showing an error message stupid trivial. they also include a nice error icon on the side from the material font…
This cuts down on the boilerplate code and shows something that is "pretty" & modern by default which is important.