Commit 4b693015 by Oscar Fuentes

Fix callbacl and tags

parent 9849a1c2
......@@ -47,7 +47,7 @@ public class PluginHelper {
e.printStackTrace();
callbackContext.sendPluginResult(new PluginResult(Status.ERROR, ""));
}
if (device == "scanner") {
if (device.equalsIgnoreCase("scanner")) {
mInstance.setScanCallback(new Barcode2DWithSoft.ScanCallback() {
@Override
public void onScanComplete(int i, int length, byte[] data) {
......@@ -66,62 +66,11 @@ public class PluginHelper {
});
mInstance.scan();
} else if (device == "camera") {
} else if (device.equalsIgnoreCase("camera")) {
BarcodeScanner barcodeScanner = new BarcodeScanner();
barcodeScanner.cordova = cordova;
barcodeScanner.webView = webView;
barcodeScanner.execute("scan", new JSONArray(), callbackContext);
}
}
private static class GetBarcode implements Runnable {
private boolean isContinuous = false;
String barCode = "";
private long sleepTime = 1000;
Message msg = null;
public GetBarcode(boolean isContinuous) {
this.isContinuous = isContinuous;
}
public GetBarcode(boolean isContinuous, int sleep) {
this.isContinuous = isContinuous;
this.sleepTime = sleep;
}
@Override
public void run() {
do {
mInstance.scan();
Log.i("MY", "barCode " + barCode.trim());
msg = new Message();
if (StringUtility.isEmpty(barCode)) {
msg.arg1 = 0;
msg.obj = "";
} else {
msg.arg1 = 1;
msg.obj = barCode;
}
if (isContinuous) {
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} while (isContinuous && !threadStop);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment