Android development reports lazarus / 43-Android ---------------------------------------------------------------------- felipemdc · 2012-03-23 07:44 23rd March friday - This week was very interresting when it comes to Android development. I fixed a major problem which was a memory corruption due to a double free which caused strange crashes. Now LCL- CustomDrawn can already run large projects like the Virtual Magnifying Glass! (although it still needs improvements to run it perfectly) This nasty issue was bug 21274 This fix also opens the door to the using the Android style in LCL- CustomDrawn-Android, although there are still issues before this can work perfectly. Right now the font drawing generates some white pixels, and I'm not sure how to fix, maybe with a filter to remove from the drawing those pixels or with a migration to non-native text rendering (too risky right now). When it comes to the native Android look I advanced a lot the following controls: *CheckBox *RadioButton Although they still work better directly via TCDCheckBox and TCDRadioButton instead of via TCheckBox/TRadioButton in LCL- CustomDrawn Merged large changes to LazFreeType which implement TextHeight Implemented the painting of "Erase Background" in all wincontrols in LCL-CustomDrawn. This fixes TNotebook which is now perfect =) I also started 2 new FPC branches for Android development: http://p-tools.svn.sourceforge.net/viewvc/p-tools/fpc4android/ with FPC 2.5.1 which requires FPC 2.4.4 to build and is finished http://p-tools.svn.sourceforge.net/viewvc/p-tools/fpc4android_2_6/ which is FPC 2.6.1 and requires FPC 2.6.0 to build. This one is work in progress, don't use it yet. I also fixed the Z-order of event handling for overlapping controls, which was previously wrong. Just thought people would like to know how we are progressing =) ---------------------------------------------------------------------- Takeda · 2012-03-23 08:28 Cool.. Excellent works.. Salute for you.. Well, for your branch FPC 2.6.x -> it's mean your FPC 2.6.x didn't yet ready to compiled for android? Regards, takeda. ---------------------------------------------------------------------- Daniel Simoes · 2012-03-23 12:16 Congratulations... Great work Felipe... ---------------------------------------------------------------------- felipemdc · 2012-03-23 13:46 Quote from: Takeda on March 23, 2012, 09:28:06 amWell, for your branch FPC 2.6.x -> it's mean your FPC 2.6.x didn't yet ready to compiled for android? Exactly, it is not yet ready. ---------------------------------------------------------------------- fredycc · 2012-03-23 14:20 Amazing progress  Felipe, thanks Regards ---------------------------------------------------------------------- felipemdc · 2012-03-30 15:28 Second report, 30 march. This week I implemented: *Support for native menus *Improved drawing speed by 20% (tested in the Virtual Magnifying Glass) by detecting elements which are fully covered and not drawing them *Improved the drawing of Android style controls *Fixed crashes in the emulator *Fixed TSQLQuery crash And most importantly: Achieved together with Daniel a full solution to build APK packages in Windows without ant. Putting this together with my precompiled FPC4Android 2.5.1 one needs only the following tools to build LCL Android applications: *FPC4Android 2.5.1 pre-compiled or compiled by oneself *Android SDK and NDK *Lazarus SVN And ready =) Nothing else is needed and you can already build your APK projects directly in Windows via a batch script without the need for the VirtualBox VM image. So I am loosing interrested in the VM image, it would be good to know if people still would like a newer version of the VM image, because that one is light years behind the current state, so it needs a large rework. Or if people are happy with the native Windows solution and the VM image is no longer necessary. Check also the new look of the Android LCL example: http://wiki.lazarus.freepascal.org/File:lcl_android_30_mar.png ---------------------------------------------------------------------- tatamata · 2012-03-30 19:05 Felipe, there are some of us eagerly waiting for being able to cross- compile our Lazarus applications from Linux to Android : ---------------------------------------------------------------------- bambamns · 2012-03-31 02:24 Nice job, keep on moving forward, Felipe - you are making history steps for the future. ---------------------------------------------------------------------- Leledumbo · 2012-03-31 03:16 QuoteAchieved together with Daniel a full solution to build APK packages in Windows without ant.Yaaaay!!! Something that I really love, bye2 ant!!! ---------------------------------------------------------------------- LA.Center · 2012-03-31 06:22 felipe, an updated VM image would be still very helpful I think. ---------------------------------------------------------------------- CC · 2012-03-31 20:14 Felipe, I was delighted to see that windows development for android is quite easy now. Though it is kind of painful to see that you seem to carry the Android platform mostly by yourself. Anyways, congrats! ---------------------------------------------------------------------- felipemdc · 2012-04-02 13:03 Quote from: CC on March 31, 2012, 10:14:01 pmI was delighted to see that windows development for android is quite easy now. Though it is kind of painful to see that you seem to carry the Android platform mostly by yourself. Anyways, congrats! Well, in terms of writing code indeed I am currently writing 99%+ of the Android support till now, but you should not underestimate the value of the community financial support which helps me push this at a much faster pace then I normally could if I had to do this without only has a hobby (bringing bread to the table takes priority). This comes via direct bounties but also via articles in magazines like Blaise Pascal and FreeX. So it I am not exactly alone on this one =) If you consider that, I think we are doing quite fine and the Android support will only get better and better from now on. There are code contributors in non-Android sides of CustomDrawn: Giuliano is working in the X11 backend and I had some patches from lainz for the custom drawn controls ---------------------------------------------------------------------- felipemdc · 2012-04-02 13:07 It would be good if people can test the pre-compiled compiler from today for Windows: https://sourceforge.net/projects/p- tools/files/Free%20Pascal%20for%20ARM/Windows/? It looks like the build from march30 had some issues, but now they should be fixed. ---------------------------------------------------------------------- Rustam Asmandiarov · 2012-04-04 09:56 Hello! Could you add some changes to add non-native opengl? For example, with the flag "openGL" to remove the Canvas drawing with replacement Opengl on the Java level. Здраствуйте! не могли бы вы добавить некоторые изменения для добавления ненативного opengl? Например с флагом "openGL" убрать Canvas отрисовку с заменой на Opengl на Java уровне. ---------------------------------------------------------------------- felipemdc · 2012-04-04 13:18 Quote from: Rustam Asmandiarov on April 04, 2012, 11:56:17 amHello! Could you add some changes to add non-native opengl? For example, with the flag "openGL" to remove the Canvas drawing with replacement Opengl on the Java level. In the beginning I was using OpenGL because I thought it would be magically faster, but no. It is not faster for 2D graphics, so in the end I found no reason to keep using OpenGL and remove it's usage. jnigraphics can be very efficient. ---------------------------------------------------------------------- Rustam Asmandiarov · 2012-04-04 13:28 so how can I use OpenGL in your widget? так, как я могу использовать OpenGL в вашем виджете? ---------------------------------------------------------------------- felipemdc · 2012-04-04 13:30 How much OpenGL do you want? Do you want to mix OpenGL with LCL controls or do you want to have only OpenGL? ---------------------------------------------------------------------- Rustam Asmandiarov · 2012-04-04 13:45 Only opengl, so simple! A new window, and it only OpenGL! And it would be nice to implement context management in native code, for example, to specify the attributes for the context of color, depth, control the activation and so on. Только опенгл, так проще! Новое окно и в нем только OpenGL! И было бы неплохо реализовать управление контекстом на нативном коде например задавать атрибуты для контекста цвета, глубины, управления активацией и прочее. ---------------------------------------------------------------------- felipemdc · 2012-04-04 14:01 You don't need the LCL to work with pure OpenGL, you can use the JNI OpenGL example and work from there: http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus- ccr/bindings/android-ndk/examples/opengltest/ Please start a new thread in the Android section for discussing the example if you want to follow up. ---------------------------------------------------------------------- CC · 2012-04-05 19:58 Quote from: felipemdc on April 02, 2012, 03:03:37 pmQuote from: CC on March 31, 2012, 10:14:01 pmI was delighted to see that windows development for android is quite easy now. Though it is kind of painful to see that you seem to carry the Android platform mostly by yourself. Anyways, congrats! Well, in terms of writing code indeed I am currently writing 99%+ of the Android support till now, but you should not underestimate the value of the community financial support which helps me push this at a much faster pace then I normally could if I had to do this without only has a hobby (bringing bread to the table takes priority). This comes via direct bounties but also via articles in magazines like Blaise Pascal and FreeX. So it I am not exactly alone on this one =) If you consider that, I think we are doing quite fine and the Android support will only get better and better from now on. There are code contributors in non-Android sides of CustomDrawn: Giuliano is working in the X11 backend and I had some patches from lainz for the custom drawn controls Good to hear! From what you have written it seems you are quite enjoying doing this. ---------------------------------------------------------------------- CC · 2012-04-06 12:01 Quote from: felipemdc on April 02, 2012, 03:07:39 pmIt would be good if people can test the pre-compiled compiler from today for Windows: https://sourceforge.net/projects/p- tools/files/Free%20Pascal%20for%20ARM/Windows/? It looks like the build from march30 had some issues, but now they should be fixed. How can i get it's  source? ---------------------------------------------------------------------- felipemdc · 2012-04-06 12:38 Quote from: CC on April 05, 2012, 09:58:31 pmGood to hear! From what you have written it seems you are quite enjoying doing this. Indeed =) Quote from: CC on April 06, 2012, 02:01:08 pmHow can i get it's  source? http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#FPC4 Android_2.5.1 ---------------------------------------------------------------------- felipemdc · 2012-04-06 12:52 6th April This week I implemented many drawing optimizations. Those were designed to speed up large desktop applications, but you can feel the difference in Android too. Now fullscreen desktop applications are much faster: http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface#Drawing_opti mization_roadmap Of course, it still should be even much faster, so sometime later I will give another go in optimizing, but for now the speed should be good enough for most applications. I advanced a bit in getting the SQlite example working, but it still doesn't work. I'll try next week after eastern to work further on this. I think that working in the threading system could make it finally work (hopefully). And some new things implemented: *Now the Align property works *Now resized controls are invalidated, fixes a bug which could be noticed when rotating the device *Implemented FrameRect *Implemented StretchDraw with the linear filter *Improved the screenshot support *Advanced a lot the support for regions *Many other minor stuff which I forgot already *Started working in support for TDBGrid and TStringGrid, they are starting to work already, but aren't finished *Started bitmap mask transparency, not finished Some large applications are already starting to work, for example: *The Virtual Magnifying Glass (except for the system tray icon and bitmap mask transparency) See magnifier.sourceforge.net I want to make the next Mac OS X release with LCL-CustomDrawn and maybe the next Linux release too *lazarus/examples/canvastest