Recent

Author Topic: LCL-CustomDrawn substitutes LCL-Android  (Read 83536 times)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #30 on: December 13, 2011, 10:38:43 am »
Thanks, you can see the new look of the example here:

http://wiki.lazarus.freepascal.org/images/6/6a/Custom_drawn_android_test1.png

I still have to investigate why it draws text fine in the button but not in the CheckBox.

LA.Center

  • Full Member
  • ***
  • Posts: 244
    • LA.Center
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #31 on: December 13, 2011, 11:56:56 am »
not sure, but from the image it looks like the width of the checkbox is very small, maybe thats it. or maybe just a dumb remark :P

but you rock cant wait to support android with this :)

LA.Center

  • Full Member
  • ***
  • Posts: 244
    • LA.Center
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #32 on: December 13, 2011, 12:00:20 pm »
@felipemdc
on a different note but related, I successfully used vg_scene controls to create a iOS app, do you think we could use vg_scene also for android like a lib and start the lib from java jni?

I am asking because you already work a lot around this subject and maybe your answer will save me like 30 hours of testing :)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #33 on: December 13, 2011, 01:11:39 pm »
Yes, indeed it the checkbox was too small. The autosizing was happening before Activity.OnCreate and also before JNI_OnLoad, so it was too early and it could not communicate with the Java to get the text measurement. I postponed Application.Run and now it works, I'll update the screenshot. I also improve a little bit text rendering.

@felipemdc
on a different note but related, I successfully used vg_scene controls to create a iOS app, do you think we could use vg_scene also for android like a lib and start the lib from java jni?

I am asking because you already work a lot around this subject and maybe your answer will save me like 30 hours of testing :)

What is vg_scene? Does it work on top of OpenGL ES?

joseme

  • Full Member
  • ***
  • Posts: 128
    • Logosoft sistemas
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #34 on: December 13, 2011, 03:07:09 pm »
Hello.
vg_scene was a product from KSDev, a good graphic library for Delphi and Lazarus. Sadly, Embarcadero bought KSDev, and the library is no longer being sold.
un aporte a la comunidad:
http://pascalylazarus.blogspot.com/

LA.Center

  • Full Member
  • ***
  • Posts: 244
    • LA.Center
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #35 on: December 13, 2011, 03:17:26 pm »
yes, we actually wrote a complete new one called 3FX, I have to admit we were very inspired by KSDev but we wrote everything from scratch and eliminated the complexity, and since vg_scene is also not supported anymore it was the only way to go.

My test was actually with 3FX, I just wrote vg_scene to make it more obvious to what I meant. And yes it is based on OpenGL ES, but I am not sure if it would work on Android.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #36 on: December 13, 2011, 03:36:08 pm »
My test was actually with 3FX, I just wrote vg_scene to make it more obvious to what I meant. And yes it is based on OpenGL ES, but I am not sure if it would work on Android.

It should work fine in Android as it supports both OpenGL ES 1.1 and 2.0

You can either use native activity (Pascal example in lazarus-ccr/bindings/android-ndk/opengltest) or go for JNI (Pascal example in lazarus-ccr/bindings/android-ndk/jnitest also LCL-CustomDrawn-Android runs via JNI)

Which way is better is something hard to say, you can try both. I liked JNI more, mostly because the LCL needs to access many SDK APIs, but for an OpenGL application maybe Native Activity is better.
« Last Edit: December 13, 2011, 03:44:19 pm by felipemdc »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #37 on: December 14, 2011, 03:35:26 pm »
Now TLabel and TTimer work too. TCDEdit already shows and the caret blinks. I started text input, but it isn't yet working in TCDEdit. And the virtual keyboard support also needs to be added.

When I started LCL-Android I was skeptical that it could be finished anytime soon and I instead planned on porting my apps to Android by using the Android SDK APIs directly via those Pascal bindings that I had built. But now LCL-CustomDrawn-Android is advancing so fast that I am changing my plans, I'll scrap porting to the SDK APIs and instead use the LCL for all my mobile apps =)

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #38 on: December 17, 2011, 11:17:48 am »

Hi Felipe,
I have just tried to compile the androidlcltest but it complains that error.

/usr/local/bin/arm-linux-ld: cannot find -ljnigraphics

Can you give any hint what is that error related with?
Thanks.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #39 on: December 17, 2011, 03:33:15 pm »
The instructions were not 100% clear, but now I have expanded considerably the instructions here:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Compiling_the_example_LCL_Android_Application

In your particular case you need to change the libraries path to reflect your NDK, as explained in Step 2.

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #40 on: December 17, 2011, 07:03:32 pm »

Thanks for the link Felipe, I have compiled the example with Mac OS X 10.6 and tested under Google Nexus one. It looks wonderful, great progress.
Besides this the Form components look a little bit smaller for the Nexus one screen and keyboard doesnt work for Edit field.
Congratulations.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #41 on: December 17, 2011, 07:14:48 pm »
Thanks =)

Besides this the Form components look a little bit smaller for the Nexus one screen

That's a known missing feature. I will very soon implement DPI Awareness in the LCL, so it will auto-adjust the entire layout for the phone. It will measure your phone width and adjust stretch all controls which have Align=alNone and normal anchors so that they will fit the width without horizontal scrolling.

Then it will stretch all font sizes and all controls Y axis for the DPI, considering your design DPI as 96 it will increase a lot the Y axis for Android phones which have DPIs from 140 to 400...

Effectively the fixed layout which people use with Lazarus will be reinterpreted as a grid layout where what you choose in the X axis is only a percentage of the form Width and what you choose in the Y axis is a value in pixels for the DPI stored in TApplication.DesignTimeDPI (or something similar) which will be stretched if the DPI of the target device does not match it. It will be possible to turn this feature off.

If you check Forms.pp in Lazarus SVN there is already:

Code: [Select]
  TLayoutAdjustmentPolicy = (
    lapDefault,     // widgetset dependent
    lapFixedLayout, // A fixed absolute layout in all platforms
    lapAutoAdjustWithoutHorizontalScrolling, // Smartphone platforms use this one,
                                             // the x axis is stretched to fill the screen and
                                             // the y is scaled to fit the DPI
    lapAutoAdjustForDPI // For desktops using High DPI, scale x and y to fit the DPI
  );

Quote
and keyboard doesnt work for Edit field.

But the virtual keyboard shows, correct? If yes, it is a known bug. OnKeyDown / OnKeyUp is received correctly. I think that OnKeyPress too. It should be easy to fix as soon as I find some time to debug this.
« Last Edit: December 17, 2011, 07:20:20 pm by felipemdc »

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #42 on: December 17, 2011, 08:41:44 pm »

Yes, the virtual keyboard shown as expected and my second examination I found the bug or mistake.
When you first activate or focused to TEdit component the virtual keyboard doesnt work as expected (but shown) after the second touch (mean focused) the virtual keyboard works fine.


LA.Center

  • Full Member
  • ***
  • Posts: 244
    • LA.Center
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #43 on: December 19, 2011, 02:21:09 pm »
@felipemdc

Check your PM, we have a proposition for you :)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LCL-CustomDrawn substitutes LCL-Android
« Reply #44 on: December 19, 2011, 02:54:45 pm »
Yes, the virtual keyboard shown as expected and my second examination I found the bug or mistake.
When you first activate or focused to TEdit component the virtual keyboard doesnt work as expected (but shown) after the second touch (mean focused) the virtual keyboard works fine.

It would be cool if you could check now if the controls are good sized in your device. I just implemented layout auto-adjustment for DPI and form width.

I get issues here with it:

1> First screen rotation does not execute unless I click the screen. very wierd.
2> The secondary form seams to adjust its DPI correctly but not width, but the log doesnt show anything wrong.

The next step now is implementing form scrolling.
« Last Edit: December 19, 2011, 03:00:26 pm by felipemdc »

 

TinyPortal © 2005-2018