Skip to content

Commit

Permalink
Merge pull request #14 from jkotchoff/master
Browse files Browse the repository at this point in the history
Updated Acktie-Zbar-Android and libiconv.so to fix crashes
  • Loading branch information
Tony Nuzzi authored Jul 14, 2016
2 parents 325e8ab + dde1ff5 commit a9ec9c6
Show file tree
Hide file tree
Showing 22 changed files with 74 additions and 37 deletions.
16 changes: 7 additions & 9 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="build/.apt_generated"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/guava-12.0.jar"/>
<classpathentry kind="lib" path="lib/acktie-scanner-1.2-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="/Users/jason/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/android/android-support-v4.jar"/>
<classpathentry kind="lib" path="/Users/jason/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/android/kroll-apt.jar"/>
<classpathentry kind="lib" path="/Users/jason/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/android/kroll-common.jar"/>
<classpathentry kind="lib" path="/Users/jason/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/android/titanium.jar"/>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/guava-12.0.jar"/>
<classpathentry kind="lib" path="/Users/Nuzzi/adt-bundle-mac/sdk/platforms/android-10/android.jar"/>
<classpathentry kind="lib" path="/Users/Nuzzi/Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA/android/js.jar"/>
<classpathentry kind="lib" path="/Users/Nuzzi/Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA/android/kroll-apt.jar"/>
<classpathentry kind="lib" path="/Users/Nuzzi/Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA/android/kroll-common.jar"/>
<classpathentry kind="lib" path="/Users/Nuzzi/Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA/android/titanium.jar"/>
<classpathentry kind="lib" path="lib/zbar.jar"/>
<classpathentry kind="lib" path="lib/acktie-scanner-1.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="/Users/jason/software/android-sdk-macosx/platforms/android-N/android.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Acktie Mobile QR Reader Module (Android)

***THIS FORK WAS REBUILT WITH THE FIXES FROM THE LATEST Acktie-Zbar-Android PROJECT***

To use this as the Android QR Scanning module in a titanium project, unzip [dist/com.acktie.mobile.android.qr-android-2.1.zip](https://github.com/jkotchoff/Acktie-Mobile-Android-QR-Reader/blob/master/dist/com.acktie.mobile.android.qr-android-2.1.zip?raw=true) into your titanium android modules directory and use it as per the instructions at [Acktie-Mobile-Android-QR-Reader](https://github.com/acktie/Acktie-Mobile-Android-QR-Reader).

This fork addresses stability issues documented at:
[issues/12](https://github.com/acktie/Acktie-Mobile-Android-QR-Reader/issues/12)
[issues/6](https://github.com/acktie/Acktie-Mobile-Android-QR-Reader/issues/6)
[issues/2](https://github.com/acktie/Acktie-Mobile-Android-QR-Reader/issues/2)

Those issues were resolved in the latest [commits](https://github.com/acktie/Acktie-Zbar-Android/commits/master) to the [Acktie-Zbar-Android](https://github.com/acktie/Acktie-Zbar-Android) project

ie. This addresses Android QR crashes like:
```
[ERROR] AndroidRuntime: FATAL EXCEPTION: main
[ERROR] AndroidRuntime: Process: com.geoplus.qrapp, PID: 18765
[ERROR] AndroidRuntime: java.lang.RuntimeException: autoFocus failed
[ERROR] AndroidRuntime: at android.hardware.Camera.native_autoFocus(Native Method)
[ERROR] AndroidRuntime: at android.hardware.Camera.autoFocus(Camera.java:1347)
[ERROR] AndroidRuntime: at com.acktie.mobile.android.camera.CameraManager$2.run(CameraManager.java:232)
[ERROR] AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
[ERROR] AndroidRuntime: FATAL EXCEPTION: main
[ERROR] AndroidRuntime: Process: com.geoplus.qrapp, PID: 31643
[ERROR] AndroidRuntime: java.lang.RuntimeException: Camera is being used after Camera.release() was called
[ERROR] AndroidRuntime: at android.hardware.Camera.native_autoFocus(Native Method)
[ERROR] AndroidRuntime: at android.hardware.Camera.autoFocus(Camera.java:1347)
[ERROR] AndroidRuntime: at com.acktie.mobile.android.camera.CameraManager$2.run(CameraManager.java:232)
[ERROR] AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
[ERROR] AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR] AndroidRuntime: at android.os.Looper.loop(Looper.java:158)
[ERROR] AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.Camera.setPreviewCallback(android.hardware.Camera$PreviewCallback)' on a null object reference
[ERROR] AndroidRuntime: at com.acktie.mobile.android.camera.CameraSurfaceView.surfaceCreated(CameraSurfaceView.java:87)
[ERROR] AndroidRuntime: at android.view.SurfaceView.updateWindow(SurfaceView.java:712)
[ERROR] AndroidRuntime: at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:316)
```

## Example

A working example of how to use this module can be found on Github at
Expand Down
9 changes: 5 additions & 4 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#titanium.platform=/Library/Application Support/Titanium/mobilesdk/osx/1.7.6.v20120320183239/android
#titanium.platform=/Library/Application Support/Titanium/mobilesdk/osx/2.1.0.GA/android
titanium.platform=/Users/Nuzzi/Library/Application Support/Titanium/mobilesdk/osx/2.1.3.GA/android
android.platform=/Users/Nuzzi/adt-bundle-mac/sdk/platforms/android-10
android.ndk=/Users/Nuzzi/adt-bundle-mac/sdk/android-ndk
google.apis=/Users/Nuzzi/adt-bundle-mac/sdk/add-ons/addon-google_apis-google-10
#google.apis=/Users/Nuzzi/adt-bundle-mac/sdk/add-ons/addon-google_apis-google-10
titanium.platform=/Users/jason/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/android
android.platform=/Users/jason/software/android-sdk-macosx/platforms/android-N
android.ndk=/Users/jason/software/android-ndk-r10e
google.apis=/Users/jason/software/android-sdk-macosx/add-ons/addon-google_apis-google-23
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<property name="ti.module.root" location="${basedir}"/>
<property file="build.properties" />

<import file="${titanium.platform}/../module/android/build.xml"/>
<import file="/Users/jason/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/module/android/build.xml"/>
</project>
Binary file modified dist/acktiemobileandroidqr.jar
Binary file not shown.
Binary file added dist/com.acktie.mobile.android.qr-android-2.1.zip
Binary file not shown.
Binary file removed lib/acktie-scanner-1.1-SNAPSHOT.jar
Binary file not shown.
Binary file added lib/acktie-scanner-1.2-SNAPSHOT.jar
Binary file not shown.
Binary file removed lib/zbar.jar
Binary file not shown.
Binary file modified libs/armeabi-v7a/libcom.acktie.mobile.android.qr.so
Binary file not shown.
Binary file modified libs/armeabi-v7a/libiconv.so
Binary file not shown.
Binary file removed libs/armeabi-v7a/libzbarjni.so
Binary file not shown.
Binary file modified libs/armeabi/libcom.acktie.mobile.android.qr.so
Binary file not shown.
Binary file modified libs/armeabi/libiconv.so
Binary file not shown.
Binary file removed libs/armeabi/libzbarjni.so
Binary file not shown.
Binary file modified libs/x86/libcom.acktie.mobile.android.qr.so
Binary file not shown.
Binary file modified libs/x86/libiconv.so
Binary file not shown.
Binary file removed libs/x86/libzbarjni.so
Binary file not shown.
3 changes: 2 additions & 1 deletion manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 2.0
version: 2.1
apiversion: 2
description: Simple Drop in and Use QR code reader for Android
author: Tony Nuzzi
Expand All @@ -14,5 +14,6 @@ copyright: Copyright 2012-2013 Acktie, LLC, All Rights Reserved
name: acktiemobileandroidqr
moduleid: com.acktie.mobile.android.qr
guid: cd56affd-21e4-425e-9c8a-34e6ddeb4541
architectures: armeabi;armeabi-v7a;x86
platform: android
minsdk: 2.1.3.GA
6 changes: 1 addition & 5 deletions src/com/acktie/mobile/android/qr/QRCodeView.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.acktie.mobile.android.qr;

import net.sourceforge.zbar.Symbol;

import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.proxy.TiViewProxy;
import org.appcelerator.titanium.util.TiConvert;
Expand All @@ -21,8 +19,6 @@ public class QRCodeView extends TiUIView {
CameraManager cameraManager = null;


private static int[] QR_CODE_SYMBOL = { Symbol.QRCODE };

public QRCodeView(TiViewProxy proxy, final CameraManager cameraManager,
QRInputArgs args) {
super(proxy);
Expand All @@ -46,7 +42,7 @@ public QRCodeView(TiViewProxy proxy, final CameraManager cameraManager,
TiCompositeLayout layout = new TiCompositeLayout(proxy.getActivity(),
arrangement);

CameraCallback cameraCallback = new CameraCallback(QR_CODE_SYMBOL, qrCodeViewProxy, cameraManager, args);
CameraCallback cameraCallback = new CameraCallback(qrCodeViewProxy, cameraManager, args);
cameraManager.setCameraCallback(cameraCallback);
cameraPreview = new CameraSurfaceView(proxy.getActivity(), cameraCallback, cameraManager);

Expand Down
3 changes: 0 additions & 3 deletions src/com/acktie/mobile/android/qr/QRCodeViewProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ public void handleCreationDict(KrollDict options)
if (hasProperty(QRInputArgs.CANCEL_CALLBACK)) {
args.setCancelCallback((KrollFunction) getProperty(QRInputArgs.CANCEL_CALLBACK));
}
if (hasProperty(QRInputArgs.USE_JIS_ENCODING)) {
args.setUseJISEncoding(TiConvert.toBoolean(getProperty(QRInputArgs.USE_JIS_ENCODING)));
}
if (hasProperty(QRInputArgs.USE_FRONT_CAMERA)) {
if(TiConvert.toBoolean(getProperty(QRInputArgs.USE_FRONT_CAMERA)))
{
Expand Down
34 changes: 20 additions & 14 deletions src/com/acktie/mobile/android/qr/QRInputArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

public class QRInputArgs implements InputArgs{

public static final String USE_JIS_ENCODING = "useJISEncoding";
private boolean useJISEncoding = false;

public static final String SUCCESS_CALLBACK = "success";
private KrollFunction successCallback = null;

Expand All @@ -19,15 +16,8 @@ public class QRInputArgs implements InputArgs{
public static final String USE_FRONT_CAMERA = "useFrontCamera";
private int cameraDevice = CameraManager.AUTO_DETACT_CAMERA_FACING;

private static final boolean USE_ZBAR = true;

public boolean isUseJISEncoding() {
return useJISEncoding;
}

public void setUseJISEncoding(boolean useJISEncoding) {
this.useJISEncoding = useJISEncoding;
}
private boolean isContinuous = false;
private boolean isScanFromImageCapture = false;

public KrollFunction getSuccessCallback() {
return successCallback;
Expand All @@ -54,7 +44,23 @@ public void setCameraDevice(int cameraDevice) {
}

@Override
public boolean scanUsingZBar() {
return USE_ZBAR;
public boolean isContinuous() {
// TODO Auto-generated method stub
return isContinuous;
}

@Override
public boolean isScanFromImageCapture() {
return isScanFromImageCapture;
}

@Override
public void setContinuous(boolean arg0) {
isContinuous = arg0;
}

@Override
public void setScanFromImageCapture(boolean arg0) {
isScanFromImageCapture = arg0;
}
}

0 comments on commit a9ec9c6

Please sign in to comment.