aggiunta configurazione scanner barcode tramite preferenze app

This commit is contained in:
2022-09-26 11:52:24 +02:00
parent f8c0852cb7
commit 0e6f4a7892
18 changed files with 300 additions and 77 deletions

View File

@@ -3,9 +3,11 @@ package it.integry.pointmobilescannerlibrary;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Pair;
import android.view.KeyEvent;
import java.nio.charset.StandardCharsets;
import java.util.List;
import device.common.DecodeResult;
import device.common.ScanConst;
@@ -46,8 +48,8 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface {
@Override
public void init(Runnable onDeviceReady) throws BarcodeAdapterNotFoundException {
if(isRightAdapter()){
try{
if (isRightAdapter()) {
try {
mScanManager.aDecodeSetTerminator(ScanConst.Terminator.DCD_TERMINATOR_NONE);
mScanManager.aDecodeSetResultType(ScanConst.ResultType.DCD_RESULT_USERMSG);
@@ -92,27 +94,27 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface {
if (mOnScanSuccessfull != null) {
//try {
if(mDecodeResult.symName.equalsIgnoreCase("READ_FAIL")){
//if(mOnScanFailed != null) mOnScanFailed.run(new Exception("Barcode non riconosciuto"));
return;
if (mDecodeResult.symName.equalsIgnoreCase("READ_FAIL")) {
//if(mOnScanFailed != null) mOnScanFailed.run(new Exception("Barcode non riconosciuto"));
return;
}
if (mDecodeResult != null) {
String stringValue = null;
if (mDecodeResult.decodeValue != null && mDecodeResult.decodeValue.length > 0) {
stringValue = new String(mDecodeResult.decodeValue, StandardCharsets.UTF_8);
}
if(mDecodeResult != null) {
String stringValue = null;
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
.setByteValue(mDecodeResult.decodeValue)
.setStringValue(stringValue)
.setType(BarcodeType.fromInt(mDecodeResult.symType))
.setName(mDecodeResult.symName)
.setDecodingTime(mDecodeResult.decodeTimeMillisecond);
if(mDecodeResult.decodeValue != null && mDecodeResult.decodeValue.length > 0) {
stringValue = new String(mDecodeResult.decodeValue, StandardCharsets.UTF_8);
}
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
.setByteValue(mDecodeResult.decodeValue)
.setStringValue(stringValue)
.setType(BarcodeType.fromInt(mDecodeResult.symType))
.setName(mDecodeResult.symName)
.setDecodingTime(mDecodeResult.decodeTimeMillisecond);
mOnScanSuccessfull.run(barcodeScanDTO);
}
mOnScanSuccessfull.run(barcodeScanDTO);
}
//} catch (Exception ex) {
// Log.e(TAG, ex.getMessage());
@@ -125,5 +127,9 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface {
}
}
@Override
public void changeSettings(List<Pair<String, Object>> settings) {
}
}