Commit e7497d8d by Oscar Fuentes

Fix plugin helper

parent 38bd6038
...@@ -43,17 +43,19 @@ public class PluginHelper { ...@@ -43,17 +43,19 @@ public class PluginHelper {
return; return;
} }
mInstance.open(context);
mInstance.setScanCallback(new Barcode2DWithSoft.ScanCallback() { mInstance.setScanCallback(new Barcode2DWithSoft.ScanCallback() {
@Override @Override
public void onScanComplete(int i, int length, byte[] data) { public void onScanComplete(int i, int length, byte[] data) {
Log.i(TAG, "onScanComplete() i=" + i); Log.i(TAG, "onScanComplete() i=" + i);
if (length < 1) { if (length < 1) {
return; return;
} }
String barCode = new String(data); String barCode = new String(data);
barCode = barCode.replaceAll("\u0000", "");
Log.i(TAG, barCode); Log.i(TAG, barCode);
mInstance.stopScan(); mInstance.stopScan();
...@@ -63,25 +65,25 @@ public class PluginHelper { ...@@ -63,25 +65,25 @@ public class PluginHelper {
} }
}); });
mInstance.open(context); mInstance.scan();
//
boolean bContinuous = false; // boolean bContinuous = false;
Log.i("ErDActivity", "scan() "); // Log.i("ErDActivity", "scan() ");
//
executor = cordova.getThreadPool(); // executor = cordova.getThreadPool();
//
if (threadStop) { // if (threadStop) {
//
int iBetween = 0; // int iBetween = 0;
//
// thread = new Thread(new GetBarcode(bContinuous, iBetween)); // // thread = new Thread(new GetBarcode(bContinuous, iBetween));
// thread.start(); // // thread.start();
//
executor.execute(new GetBarcode(bContinuous, iBetween)); // executor.execute(new GetBarcode(bContinuous, iBetween));
//
} else { // } else {
threadStop = true; // threadStop = true;
} // }
} }
private static class GetBarcode implements Runnable { private static class GetBarcode implements Runnable {
......
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