Skip to content

Commit 8838096

Browse files
Add files via upload
1 parent fe09c20 commit 8838096

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+8140
-0
lines changed

android/AndroidManifest.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="net.sourceforge.zbar.android"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
<application android:label="@string/app_name" >
7+
<activity android:name="ACTIVITY_ENTRY_NAME"
8+
android:label="@string/app_name">
9+
<intent-filter>
10+
<action android:name="android.intent.action.MAIN" />
11+
<category android:name="android.intent.category.LAUNCHER" />
12+
</intent-filter>
13+
</activity>
14+
</application>
15+
</manifest>

android/ChangeLog

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version 0.1:
2+
* Add initial support for Android platform

android/README

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
ZBar Android SDK
2+
================
3+
4+
ZBar Bar Code Reader is an open source software suite for reading bar
5+
codes from various sources, such as video streams, image files and raw
6+
intensity sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128,
7+
Code 93, Code 39, Codabar, Interleaved 2 of 5, QR Code and
8+
DataBar. These are the JNI wrappers for developing the library on
9+
Android platform.
10+
11+
Check the ZBar home page for the latest release, mailing lists, etc.
12+
http://zbar.sourceforge.net/
13+
14+
Copyright and License
15+
---------------------
16+
Licensed under the GNU Lesser General Public License, version 2.1.
17+
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
18+
19+
Copyright 2008-2012 � Jeff Brown <[email protected]> et al
20+
21+
The Android distribution also includes pre-compiled binaries of
22+
supporting libaries, for which copyright, license and source code
23+
locations are as follows:
24+
* The GNU libiconv character set conversion library
25+
Copyright (C) 1999-2011 Free Software Foundation, Inc.
26+
This distribution includes GNU libiconv version 1.14, licensed under
27+
the LGPL version 2. The source code is available from
28+
http://www.gnu.org/software/libiconv
29+
30+
See included files COPYING and LICENSE for details.
31+
32+
33+
Installation
34+
------------
35+
36+
After downloading the ZBar-Android-Lib-<version>.zip file, you need to
37+
unzip the file and add it to your Android project. Unzip the file
38+
using your favorite method (ie: command-line, finder, windows
39+
explorer...)
40+
41+
Follow one of the two options.
42+
Option 1 - via command line
43+
cd <android project>
44+
cp -r ZBar-Android-SDK-<version>/libs .
45+
46+
Option 2 - via Eclipse
47+
Right click on Android Project
48+
Select "Import" -> "File System"
49+
Select "Browse" (next to "From directory File" and select the
50+
ZBar-Android-SDK-<verion>/libs directory and click "Open".
51+
Click the check box next to "libs" and the "Options" "Create top-level folder"
52+
check box (below).
53+
Then click "Finish".
54+
55+
You should then see a "libs" folder under your project.
56+
57+
Building
58+
--------
59+
60+
Via Eclipse
61+
You have to add the zbar.jar file to your build path
62+
1) select zbar.jar under libs
63+
2) right-click, select "Build Path" -> "Add to Build Path"
64+
65+
Via command-line
66+
You are all set; ant will automatcially find jar files under the "libs"
67+
subdirectory.
68+
69+
Documentation
70+
-------------
71+
TDB
72+
73+
Examples
74+
--------
75+
76+
You should be able to open and build the examples directly from the
77+
unzipped directory. You will need to run the android tools to setup
78+
the local.properties file which sets sdk.dir.
79+
1) cd <unzip dir>/examples/CameraTest
80+
2) android update project --path .
81+
3) ant debug install
82+
83+
If you have problems with this, please create a new Android project
84+
and copy the necessary files from the examples.
85+
86+
examples/CameraTest is a simple demonstration of how to integrate the
87+
ZBar image scanner with the camera.
88+
89+
Manually building ZBar JNI library
90+
----------------------------------
91+
First download and unzip the iconv library source from
92+
http://www.gnu.org/software/libiconv/
93+
94+
Then kick off the build from the ZBar android directory. You will
95+
need to run the android tools to setup the local.properties file which
96+
setups sdk.dir.
97+
98+
1) cd <zbar project>/android
99+
2) android update project --path .
100+
3) ant -Dndk.dir=<NDK path> -Diconv.src=<iconv library src> zbar-all
101+
102+
This will rebuild all source files, create zbar.jar and
103+
ZBarAndroidSDK.zip file (which bundles the jar and shared
104+
libraries). From here, you can follow the steps for "Integrating ZBar
105+
JNI library in Android project".
106+
107+
To clean run:
108+
ant -Dndk.dir=<NDK path> zbar-clean
109+
110+
See build-ndk.xml for additional target options.
111+
112+

android/ant.properties

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used to override default values used by the Ant build system.
2+
#
3+
# This file must be checked in Version Control Systems, as it is
4+
# integral to the build system of your project.
5+
6+
# This file is only used by the Ant script.
7+
8+
# You can use this to override default values such as
9+
# 'source.dir' for the location of your java source folder and
10+
# 'out.dir' for the location of your output folder.
11+
12+
# You can also use it define how the release builds are signed by declaring
13+
# the following properties:
14+
# 'key.store' for the location of your keystore and
15+
# 'key.alias' for the name of the key to use.
16+
# The password will be asked during the build when you use the 'release' target.
17+

android/build-ndk.xml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!--
2+
Ant build file to compile the ZBar JNI files using Android NDK tool
3+
targets:
4+
zbar-clean - removes build generated files, build dir, jar and zip files
5+
zbar-ndk-build - builds the zbarjni and iconv shared libraries
6+
zbar-compile - builds the zbar java files
7+
zbar-jar - builds and jars the zbar java files
8+
zbar-zip - Creates ZBarAndroidSDK-x.y.zip of jar, .so, etc
9+
zbar-all - performs all the above :)
10+
-->
11+
<project name="zbar">
12+
<property name="project.name" value="zbar" />
13+
<property name="project.sdk.name" value="ZBarAndroidSDK" />
14+
15+
<target name="zbar-clean">
16+
<delete dir="../java/build"/>
17+
<delete file="libs/${project.name}.jar"/>
18+
<delete file="${ant.project.name}.zip"/>
19+
<exec executable="${ndk.dir}/ndk-build" failonerror="true">
20+
<arg value="clean"/>
21+
</exec>
22+
</target>
23+
24+
<target name="zbar-ndk-build">
25+
<exec executable="${ndk.dir}/ndk-build" failonerror="true">
26+
<arg value="ICONV_SRC=${iconv.src}" />
27+
</exec>
28+
</target>
29+
30+
<target name="zbar-compile" depends="zbar-ndk-build">
31+
<mkdir dir="../java/build" />
32+
<javac srcdir="../java/net" destdir="../java/build" />
33+
</target>
34+
35+
<target name="zbar-jar" depends="zbar-compile">
36+
<jar destfile="libs/${project.name}.jar" basedir="../java/build">
37+
</jar>
38+
</target>
39+
40+
<target name="zbar-zip">
41+
<if><condition><not><isset property="version"/></not></condition><then>
42+
<property name="version" value="0.2" />
43+
</then></if>
44+
<zip destfile="${project.sdk.name}-${version}.zip" >
45+
<zipfileset dir="../" prefix="${project.sdk.name}-${version}" includes="COPYING, LICENSE"/>
46+
<zipfileset dir="." prefix="${project.sdk.name}-${version}" includes="README"/>
47+
<zipfileset dir="libs" prefix="${project.sdk.name}-${version}/libs"/>
48+
<zipfileset dir="examples" prefix="${project.sdk.name}-${version}/examples"/>
49+
<zipfileset dir="libs" prefix="${project.sdk.name}-${version}/examples/CameraTest/libs"/>
50+
</zip>
51+
</target>
52+
53+
<target name="zbar-all" depends="zbar-jar">
54+
<if><condition><not><isset property="version"/></not></condition><then>
55+
<property name="version" value="0.2" />
56+
</then></if>
57+
<zip destfile="${project.sdk.name}-${version}.zip" >
58+
<zipfileset dir="../" prefix="${project.sdk.name}-${version}" includes="COPYING, LICENSE"/>
59+
<zipfileset dir="." prefix="${project.sdk.name}-${version}" includes="README"/>
60+
<zipfileset dir="libs" prefix="${project.sdk.name}-${version}/libs"/>
61+
<zipfileset dir="examples" prefix="${project.sdk.name}-${version}/examples"/>
62+
<zipfileset dir="libs" prefix="${project.sdk.name}-${version}/examples/CameraTest/libs"/>
63+
</zip>
64+
</target>
65+
</project>
66+

android/build.xml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="ZBarAndroidSDK" default="help">
3+
4+
<!-- The local.properties file is created and updated by the 'android' tool.
5+
It contains the path to the SDK. It should *NOT* be checked into
6+
Version Control Systems. -->
7+
<property file="local.properties" />
8+
9+
<!-- The ant.properties file can be created by you. It is only edited by the
10+
'android' tool to add properties to it.
11+
This is the place to change some Ant specific build properties.
12+
Here are some properties you may want to change/update:
13+
14+
source.dir
15+
The name of the source directory. Default is 'src'.
16+
out.dir
17+
The name of the output directory. Default is 'bin'.
18+
19+
For other overridable properties, look at the beginning of the rules
20+
files in the SDK, at tools/ant/build.xml
21+
22+
Properties related to the SDK location or the project target should
23+
be updated using the 'android' tool with the 'update' action.
24+
25+
This file is an integral part of the build system for your
26+
application and should be checked into Version Control Systems.
27+
28+
-->
29+
<property file="ant.properties" />
30+
31+
<!-- The project.properties file is created and updated by the 'android'
32+
tool, as well as ADT.
33+
34+
This contains project specific properties such as project target, and library
35+
dependencies. Lower level build properties are stored in ant.properties
36+
(or in .classpath for Eclipse projects).
37+
38+
This file is an integral part of the build system for your
39+
application and should be checked into Version Control Systems. -->
40+
<loadproperties srcFile="project.properties" />
41+
42+
<!-- quick check on sdk.dir -->
43+
<fail
44+
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
45+
unless="sdk.dir"
46+
/>
47+
48+
49+
<!-- extension targets. Uncomment the ones where you want to do custom work
50+
in between standard targets -->
51+
<!--
52+
<target name="-pre-build">
53+
</target>
54+
<target name="-pre-compile">
55+
</target>
56+
57+
/* This is typically used for code obfuscation.
58+
Compiled code location: ${out.classes.absolute.dir}
59+
If this is not done in place, override ${out.dex.input.absolute.dir} */
60+
<target name="-post-compile">
61+
<copy file="${out.absolute.dir}/classes.jar" tofile="${jar.libs.dir}/zbar_android.jar" />
62+
</target>
63+
-->
64+
65+
<!-- Import the actual build file.
66+
67+
To customize existing targets, there are two options:
68+
- Customize only one target:
69+
- copy/paste the target into this file, *before* the
70+
<import> task.
71+
- customize it to your needs.
72+
- Customize the whole content of build.xml
73+
- copy/paste the content of the rules files (minus the top node)
74+
into this file, replacing the <import> task.
75+
- customize to your needs.
76+
77+
***********************
78+
****** IMPORTANT ******
79+
***********************
80+
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
81+
in order to avoid having your file be overridden by tools such as "android update project"
82+
-->
83+
<!-- version-tag: 1 -->
84+
<import file="build-ndk.xml" />
85+
<import file="${sdk.dir}/tools/ant/build.xml" />
86+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="net.sourceforge.zbar.android.CameraTest"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
<uses-sdk android:minSdkVersion="8" />
7+
<uses-permission android:name="android.permission.CAMERA" />
8+
<uses-feature android:name="android.hardware.camera" />
9+
<uses-feature android:name="android.hardware.camera.autofocus" />
10+
<application android:label="@string/app_name" >
11+
<activity android:name="CameraTestActivity"
12+
android:label="@string/app_name">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
<category android:name="android.intent.category.LAUNCHER" />
16+
</intent-filter>
17+
</activity>
18+
</application>
19+
</manifest>
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used to override default values used by the Ant build system.
2+
#
3+
# This file must be checked in Version Control Systems, as it is
4+
# integral to the build system of your project.
5+
6+
# This file is only used by the Ant script.
7+
8+
# You can use this to override default values such as
9+
# 'source.dir' for the location of your java source folder and
10+
# 'out.dir' for the location of your output folder.
11+
12+
# You can also use it define how the release builds are signed by declaring
13+
# the following properties:
14+
# 'key.store' for the location of your keystore and
15+
# 'key.alias' for the name of the key to use.
16+
# The password will be asked during the build when you use the 'release' target.
17+

0 commit comments

Comments
 (0)