-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of the camera kit demo
- Loading branch information
0 parents
commit 0a2a3ac
Showing
16 changed files
with
2,259 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
*.jar | ||
nbproject/private/ | ||
build/ | ||
nbbuild/ | ||
dist/ | ||
lib/CodenameOne_SRC.zip | ||
lib/impl/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# | ||
#Sun Mar 25 12:58:34 IDT 2018 | ||
CodenameOneJar=9 | ||
CodenameOne_SRCjar=2 | ||
CodeNameOneBuildClientJar=4 | ||
CLDC11Jar=3 | ||
JavaSEJar=9 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# | ||
#Sun Mar 25 12:58:30 IDT 2018 | ||
codename1.vendor=CodenameOne | ||
codename1.arg.android.gradleDep=compile 'com.wonderkiln\:camerakit\:0.13.1'; | ||
codename1.displayName=CameraKitCN1 | ||
codename1.icon=icon.png | ||
codename1.arg.build.incSources=1 | ||
codename1.arg.java.version=8 | ||
codename1.languageLevel=5 | ||
codename1.ios.debug.certificatePassword= | ||
codename1.secondaryTitle=CodenameOne_Template | ||
codename1.version=1.0 | ||
codename1.mainName=CameraApp | ||
codename1.ios.certificatePassword= | ||
codename1.ios.release.provision= | ||
codename1.arg.ios.newStorageLocation=true | ||
codename1.rim.signtoolDb= | ||
codename1.ios.release.certificatePassword= | ||
codename1.ios.certificate= | ||
codename1.android.keystorePassword= | ||
codename1.ios.appid=Q5GHSKAL2F.com.codename1.camerakit | ||
codename1.ios.release.certificate= | ||
codename1.j2me.nativeTheme=nbproject/nativej2me.res | ||
codename1.rim.signtoolCsk= | ||
codename1.ios.debug.certificate= | ||
codename1.arg.ios.debug.archs=armv7 | ||
codename1.arg.ios.NSCameraUsageDescription=We need camera access to grab pictures and videos | ||
codename1.arg.android.proguardKeep=-dontwarn com.google.android.gms.** | ||
codename1.android.keystore= | ||
codename1.android.keystoreAlias= | ||
codename1.rim.certificatePassword= | ||
codename1.arg.android.buildToolsVersion=27 | ||
codename1.ios.debug.provision= | ||
codename1.ios.provision= | ||
codename1.packageName=com.codename1.camerakit |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
X-COMMENT: Main-Class will be added automatically by build | ||
|
Binary file added
BIN
+1.69 KB
native/internal_tmp/com/codename1/camerakit/impl/CameraNativeAccessImpl.class
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
build.xml.data.CRC32=65812561 | ||
build.xml.script.CRC32=c17a4175 | ||
build.xml.stylesheet.CRC32=28e38971@1.44.1.45 | ||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | ||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | ||
nbproject/build-impl.xml.data.CRC32=65812561 | ||
nbproject/build-impl.xml.script.CRC32=3705395b | ||
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.1.48 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
annotation.processing.enabled=true | ||
annotation.processing.enabled.in.editor=false | ||
annotation.processing.run.all.processors=true | ||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output | ||
application.title=CameraKitCN1 | ||
application.vendor=Codename One | ||
build.classes.dir=${build.dir}/classes | ||
build.classes.excludes=**/*.java,**/*.form | ||
# This directory is removed when the project is cleaned: | ||
build.dir=build | ||
build.generated.dir=${build.dir}/generated | ||
build.generated.sources.dir=${build.dir}/generated-sources | ||
# Only compile against the classpath explicitly listed here: | ||
build.sysclasspath=ignore | ||
build.test.classes.dir=${build.dir}/test/classes | ||
build.test.results.dir=${build.dir}/test/results | ||
# Uncomment to specify the preferred debugger connection transport: | ||
#debug.transport=dt_socket | ||
debug.classpath=\ | ||
${run.classpath} | ||
debug.test.classpath=\ | ||
${run.test.classpath} | ||
# This directory is removed when the project is cleaned: | ||
dist.dir=dist | ||
dist.jar=${dist.dir}/CameraKitCN1.jar | ||
dist.javadoc.dir=${dist.dir}/javadoc | ||
endorsed.classpath= | ||
excludes= | ||
file.reference.native-internal_tmp=native/internal_tmp | ||
file.reference.CLDC11.jar=lib/CLDC11.jar | ||
file.reference.CodenameOne.jar=lib/CodenameOne.jar | ||
file.reference.CodenameOne_SRC.zip=lib/CodenameOne_SRC.zip | ||
file.reference.CameraKitCN1-override=override | ||
file.reference.impl-cls=lib/impl/cls | ||
file.reference.impl-stubs=lib/impl/stubs | ||
file.reference.JavaSE.jar=JavaSE.jar | ||
includes=** | ||
jar.compress=true | ||
javac.classpath=\ | ||
${file.reference.CLDC11.jar}:\ | ||
${file.reference.CodenameOne.jar}:\ | ||
${file.reference.CodenameOne_SRC.zip}:\ | ||
${file.reference.CameraKitCN1-override}:\ | ||
${file.reference.impl-cls}:\ | ||
${file.reference.impl-stubs} | ||
# Space-separated list of extra javac options | ||
javac.compilerargs= | ||
javac.deprecation=false | ||
javac.processorpath=\ | ||
${javac.classpath} | ||
javac.source=1.8 | ||
javac.target=1.8 | ||
javac.test.classpath=\ | ||
${file.reference.JavaSE.jar}:\ | ||
${javac.classpath}:\ | ||
${build.classes.dir} | ||
javac.test.processorpath=\ | ||
${javac.test.classpath} | ||
javadoc.additionalparam= | ||
javadoc.author=false | ||
javadoc.encoding=${source.encoding} | ||
javadoc.noindex=false | ||
javadoc.nonavbar=false | ||
javadoc.notree=false | ||
javadoc.private=false | ||
javadoc.splitindex=true | ||
javadoc.use=true | ||
javadoc.version=false | ||
javadoc.windowtitle= | ||
main.class=com.codename1.impl.javase.Simulator | ||
manifest.file=manifest.mf | ||
meta.inf.dir=${src.dir}/META-INF | ||
mkdist.disabled=false | ||
platform.active=default_platform | ||
run.classpath=\ | ||
${file.reference.JavaSE.jar}:\ | ||
${javac.classpath}:\ | ||
${build.classes.dir}:\ | ||
${file.reference.native-internal_tmp} | ||
# Space-separated list of JVM arguments used when running the project | ||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value | ||
# or test-sys-prop.name=value to set system properties for unit tests): | ||
run.jvmargs= | ||
run.test.classpath=\ | ||
${javac.test.classpath}:\ | ||
${build.test.classes.dir} | ||
source.encoding=UTF-8 | ||
src.dir=src | ||
test.src.dir=test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://www.netbeans.org/ns/project/1"> | ||
<type>org.netbeans.modules.java.j2seproject</type> | ||
<configuration> | ||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3"> | ||
<name>CameraKitCN1</name> | ||
<source-roots> | ||
<root id="src.dir"/> | ||
</source-roots> | ||
<test-roots> | ||
<root id="test.src.dir"/> | ||
</test-roots> | ||
</data> | ||
</configuration> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package com.codename1.camerakit; | ||
|
||
|
||
import com.codename1.components.FloatingActionButton; | ||
import com.codename1.components.SpanLabel; | ||
import com.codename1.components.ToastBar; | ||
import static com.codename1.ui.CN.*; | ||
import com.codename1.ui.Display; | ||
import com.codename1.ui.Form; | ||
import com.codename1.ui.Dialog; | ||
import com.codename1.ui.Label; | ||
import com.codename1.ui.plaf.UIManager; | ||
import com.codename1.ui.util.Resources; | ||
import com.codename1.io.Log; | ||
import com.codename1.ui.Toolbar; | ||
import java.io.IOException; | ||
import com.codename1.ui.layouts.BoxLayout; | ||
import com.codename1.ui.Button; | ||
import com.codename1.ui.Container; | ||
import com.codename1.ui.FontImage; | ||
import com.codename1.ui.layouts.BorderLayout; | ||
import com.codename1.ui.layouts.LayeredLayout; | ||
|
||
/** | ||
* This file was generated by <a href="https://www.codenameone.com/">Codename One</a> for the purpose | ||
* of building native mobile applications using Java. | ||
*/ | ||
public class CameraApp { | ||
|
||
private Form current; | ||
private Resources theme; | ||
private CameraKit ck; | ||
|
||
public void init(Object context) { | ||
ck = CameraKit.create(); | ||
|
||
// use two network threads instead of one | ||
updateNetworkThreadCount(2); | ||
|
||
theme = UIManager.initFirstTheme("/theme"); | ||
|
||
// Enable Toolbar on all Forms by default | ||
Toolbar.setGlobalToolbar(true); | ||
|
||
// Pro only feature | ||
Log.bindCrashProtection(true); | ||
|
||
} | ||
|
||
public void start() { | ||
if(ck != null && !ck.isStarted()) { | ||
ck.start(); | ||
} | ||
if(current != null){ | ||
current.show(); | ||
return; | ||
} | ||
Form hi = new Form("Native Camera", new LayeredLayout()); | ||
hi.setScrollableY(false); | ||
if(ck != null) { | ||
ck.addCameraListener(new CameraListener() { | ||
@Override | ||
public void onError(CameraEvent ev) { | ||
// We currently get some errors on Android | ||
Log.p(ev.getMessage() + " : " + ev.getExceptionMessage()); | ||
} | ||
|
||
@Override | ||
public void onImage(CameraEvent ev) { | ||
ToastBar.showInfoMessage("Captured image bytes"); | ||
} | ||
|
||
@Override | ||
public void onVideo(CameraEvent ev) { | ||
ToastBar.showInfoMessage("Captured video: " + ev.getFile()); | ||
} | ||
}); | ||
hi.add(ck.getView()); | ||
Button video = new Button(); | ||
FontImage.setMaterialIcon(video, FontImage.MATERIAL_VIDEOCAM); | ||
video.addActionListener(e -> { | ||
Boolean b = (Boolean)video.getClientProperty("capturing"); | ||
if(b == null) { | ||
video.putClientProperty("capturing", Boolean.TRUE); | ||
ck.captureVideo(); | ||
FontImage.setMaterialIcon(video, FontImage.MATERIAL_VIDEOCAM_OFF); | ||
} else { | ||
video.putClientProperty("capturing", null); | ||
ck.stopVideo(); | ||
FontImage.setMaterialIcon(video, FontImage.MATERIAL_VIDEOCAM); | ||
} | ||
}); | ||
FloatingActionButton fab = FloatingActionButton.createFAB(FontImage.MATERIAL_CAMERA); | ||
fab.bindFabToContainer(hi, CENTER, BOTTOM); | ||
fab.addActionListener(e -> ck.captureImage()); | ||
|
||
Button toggleCamera = new Button(); | ||
FontImage.setMaterialIcon(toggleCamera, FontImage.MATERIAL_CAMERA_FRONT); | ||
Button toggleFlash = new Button(); | ||
FontImage.setMaterialIcon(toggleFlash, FontImage.MATERIAL_FLASH_ON); | ||
toggleCamera.addActionListener(e -> ck.toggleFacing()); | ||
toggleFlash.addActionListener(e -> ck.toggleFlash()); | ||
Container buttons = BoxLayout.encloseY(video, toggleCamera, toggleFlash); | ||
buttons.setScrollableY(true); | ||
hi.add(BorderLayout.east(buttons)); | ||
} else { | ||
hi.add(BorderLayout.north(new SpanLabel("Loading native camera view"))); | ||
} | ||
hi.show(); | ||
} | ||
|
||
public void stop() { | ||
if(ck.isStarted()) { | ||
ck.stop(); | ||
} | ||
current = getCurrentForm(); | ||
if(current instanceof Dialog) { | ||
((Dialog)current).dispose(); | ||
current = getCurrentForm(); | ||
} | ||
} | ||
|
||
public void destroy() { | ||
} | ||
|
||
} |
Binary file not shown.