Recent

Author Topic: New Component jZCamView  (Read 475 times)

Guser979

  • Jr. Member
  • **
  • Posts: 64
New Component jZCamView
« on: September 06, 2024, 03:59:39 am »
I am attaching a component to replace JcustomCam . In Android 14, I was unable to get a preview image with it.

The new component will be registered in Android Bridges Extras. The base of the component is ZbarcodeScannerView .

Note : It is customized for my project and does what I need perfectly. But of course it can be improved in several aspects to meet each person's needs.

The zip file contains all the files to be placed in the corresponding folders of your LAMW. Don't forget to back up what is affected in case there are problems.

I have tested enough to make sure there are no errors. Clean installations of the component mainly.

I hope it is useful. Using the device's camera is not always ideal. It depends on each app.

In case of errors, I can try to help.

If JmPessoa gets the time, I'm sure he'll be able to make it a perfect component.


https://youtu.be/G8Z5hPhfF18




UPDATE   




I made a change: I deleted the Scan (bitmap) method and inserted the TakePicture ( _filename) method.

How to use it?

After granting permission to the camera...
Code: Pascal  [Select][+][-]
  1. // Initialize the camera
  2. ZCamView1.Scan();
  3.  
  4. // take picture .... attention...filename without extension
  5. Zcamview1.TakePicture('filename');
  6.  
  7. // fullpath from picture is obtained in codedata ... Just ignore codeformat
  8. ZCamView1ScannerResult(Sender: TObject;
  9. codedata: string; codeformat: TBarcodeFormat);
  10.  
Remember that I modified an existing component ( ZbarcodeScannerView). Feel free to remove the remnants of it.



Suggestion for use with floating buttons... Flash and Take Picture



Caution: included the lamwdesigner.pas unit

Without it, it will be impossible to change any property related to the component's Layout (Anchor, LayoutParam, etc.)

Make sure to compile lazandroidwizardpack.lpk and tfpandroidbridge_pack.lpk for the changes to take effect.
« Last Edit: September 07, 2024, 05:29:00 am by Guser979 »

c4p

  • Full Member
  • ***
  • Posts: 163
Re: New Component jZCamView
« Reply #1 on: September 09, 2024, 02:06:39 pm »
Congrats!
This looks like a really useful component!
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle.

Guser979

  • Jr. Member
  • **
  • Posts: 64
Re: New Component jZCamView
« Reply #2 on: September 09, 2024, 07:49:22 pm »
My app needed to take more photos in a given time. Using jcamera, it always displays a "Repeat or OK" dialog for each photo and jcustomcam dont work.

When I have time, I'll improve it, but for now it's working.

Tips that work in my app:
Use a specific form for the component.
Use a timer (500 ms) when the form opens to activate the camera.
Set the visibility of the button (take) to false and only when the form closes (when the full path of the photo is returned) set the visibility to true.

This helped to avoid errors.

 

TinyPortal © 2005-2018