How to embed the camera screen in the part of the main form? - codenameone

I've some trouble regarding camera feature in codenameone.
I can use camera as full screen as follow:
com.codename1.capture.Capture.capturePhoto();
This opens full camera screen, however, I want it to be embedded in special part(e.g. square) of the main form.
I've heard native interface is needed for this. But I couldn't know the detail source code.
Is there any way to do this or to get any source code?
(PS: I'm looking for the solution for iOS/Android.)

This is now possible with a new cn1lib: https://github.com/codenameone/CameraKitCodenameOne
Original answer below:
Codename One didn't support z-ordering of peer components until recently so this was not reasonably possible until a couple of months ago when we introduced that feature.
This is now available in all supported Codename One platforms and thus it should be possible to create a cn1lib that will allow you to do just that.
We hope to build such a cn1lib ourselves but with our current workload I'm not sure when we'll get around to do it.

Related

Designing window frames (of real houses) with React

In my new project with React, I need to implement an environment for designing doors and windows so that the user can design frames through the browser (like the two figures below) and then save it on the server-side. Then I have to fetch and display it in the mobile application that is implemented with React Native. I searched for it but couldn't find anything special that would work. I even found "konvajs" that has done some work in this area but it doesn't work for me and I think I need to develop this feature myself. If you know of any tools or technologies for this, please let me know. If not, what do you think I can do about it?
picture-1
picture-2

Basic text formatting during text input with Codename One

I know that is possible to programmatically format a text in Codename One using something like "Rich Text View". But in my use case the user can do basic formatting of the text.
For example, see the following two screenshots of the Protonmail app. How can I do something similar with Codename One?
In the first screenshot, "Taglia" means "Cut" and "Copia" means "Copy".
In the second screenshot, "Grassetto" means "Bold" and "Corsivo" means "Italic".
We don't support that. This behavior is very inconsistent between platforms and pretty limited in all native platforms so implementing it in a cross platform way isn't practical.
However, since all platforms have good HTML5 support it's pretty easy to implement it with a WebView by embedding a web based rich edit widget. Since these consistently work with HTML the results are cross platform and should be easy to work with. In the past we had a CKEditor cn1lib but I think it's out of date by now. The core concept should work though and should be much easier to implement as we now support the html package for deploying web resources. So you can take any HTML based text editor and just place the files under the src/html directory then open that hierarchy for editing.

Can i use Lottie animation in Codenameone apps

I am wanting to render a short piece of animation on the splash screen of my CN1 app but am struggling.
The Lottiefiles website contains a lot of good animation content, but the closest example i can find to using it is within XCode. I have the downloaded JSON file, of the animation, but am wanting to know if anyone has figured a way of incorporating into a CN1 Java app?
I can see that developers have used in Java, but CN1 wouldn't allow the LottieAnimationView component on it's layout manager i would guess.
https://steemit.com/utopian-io/#fahrulhidayat/beautiful-animation-for-android-application-using-lottie-library
Any pointers appreciated. Thanks
The "right way" would probably be to wrap the native implementations for the various OS's in a cn1lib so you can use lottie in a cross platform way. There's a long tutorial about wrapping native code in the developer guide and Steve did a 3 part video series on the subject a few years back: https://www.codenameone.com/blog/integrating-3rd-party-native-sdks-part-3.html
It's mostly mechanical so it shouldn't be too hard. If you want to take a shortcut you can probably use the web version of the API in a BrowserComponent and call it a day.

Add badge for android with codenameone

We tried more time to find badges with android using codename one, but I found some comments in stackoverflow is only working on IOS and not working on android, if true so when will it become available on android?.
Thanks in advance
When we created the badge code Android didn't support that UI paradigm. Arguably it still doesn't but some vendors include that functionality with a special API.
Currently the main thing holding this back is that no one asked for it or implemented it. First of all I suggest filing an RFE which will give you a way to track the schedule for adding this. You can add an RFE on http://github.com/codenameone/CodenameOne/issues/
You can also just implement this yourself and submit a pull request as explained in this post: https://www.codenameone.com/blog/how-to-use-the-codename-one-sources.html
This should be relatively easy although you will need to be careful with using the right API level options and might need to use reflection to avoid SDK dependencies which we don't want.
Other than that it's just a matter of interest if we need to implement it. If you have an enterprise account then make sure to let us know through the account of your interest in this feature. We also take pro account requests more seriously when assigning a feature.

How to Implement Fingerprint Lock Screen in Codenameone

Does anyone have an idea to implementing lock screen that uses fingerprint to unlock the screen on a codenameone app. Any ideas at all will be welcomed. Majority of ideas i have seen are basically cheat concepts that does not implement the concept. You ideas, resources, links etc are welcomed even if it requires a 3rd party service butt I think java native code may be able to do this, i just dont have a clear idea yet.
Global lock screen can't be implemented in Codename One since its very specific to Android and has no portable alternative. You might as well just write a native app.
You will need to write a native interface to access the fingerprint reader hardware:
https://www.codenameone.com/how-do-i---access-native-device-functionality-invoke-native-interfaces.html
https://www.codenameone.com/blog/integrating-3rd-party-native-sdks-part-1.html
Using the native touch ID should be pretty strait forward e.g.: http://www.devfright.com/touch-id-tutorial-objective-c/

Resources