diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index 4e3f1957..d168708f 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -147,8 +147,8 @@ diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 99d57087..009b181b 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e32bacf7..c16498b9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -22,7 +22,14 @@ android:name=".MainActivity" android:screenOrientation="portrait" android:theme="@style/Light" - android:windowSoftInputMode="adjustPan"> + android:windowSoftInputMode="adjustPan"> + + + + + + + mBarcodeCallbacksStacktrace = new ArrayList<>(); @@ -27,11 +29,11 @@ public class BarcodeManager { private static Class[] registeredBarcodeReaderInterfaces = new Class[]{ PointMobileBarcodeReader.class, ZebraBarcodeReader.class, - // HoneyWellBarcodeReader.class + HoneyWellBarcodeReader.class }; - public static void init(Context context) { + public static void init(AppCompatActivity context) { BarcodeManager.context = context; initBarcodeReader(); @@ -60,22 +62,26 @@ public class BarcodeManager { if(mCurrentBarcodeInterface != null) { try { - mCurrentBarcodeInterface.init(); + mCurrentBarcodeInterface.init(() -> { + + mCurrentBarcodeInterface.register(data -> { + BarcodeCallbackDTO callback = getValidCallback(); + if(callback != null && mEnabled) { + callback.getOnScanSuccessfull().run(data); + } + }, ex -> { + BarcodeCallbackDTO callback = getValidCallback(); + if(callback != null && mEnabled) { + callback.getOnScanFailed().run(ex); + } + }); + + }); } catch (BarcodeAdapterNotFoundException ex) { UtilityExceptions.defaultException(context, ex); } - mCurrentBarcodeInterface.register(data -> { - BarcodeCallbackDTO callback = getValidCallback(); - if(callback != null && mEnabled) { - callback.getOnScanSuccessfull().run(data); - } - }, ex -> { - BarcodeCallbackDTO callback = getValidCallback(); - if(callback != null && mEnabled) { - callback.getOnScanFailed().run(ex); - } - }); + } } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java b/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java index 79df7b92..45141b68 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java @@ -31,14 +31,12 @@ public class AppContext { public void init() { + this.initUtilities(); + this.initSettings(); this.initCrashlytics(); - this.initBarcode(); - - this.initUtilities(); - this.initLogger(); this.initRecoverColli(); @@ -65,10 +63,6 @@ public class AppContext { } } - private void initBarcode() { - BarcodeManager.init(mContext); - } - private void initUtilities() { UtilityResources.init(mContext); UtilityToast.init(mContext); diff --git a/app/src/main/java/it/integry/integrywmsnative/core/context/MainContext.java b/app/src/main/java/it/integry/integrywmsnative/core/context/MainContext.java index eed2350a..47eb4330 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/context/MainContext.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/context/MainContext.java @@ -6,7 +6,9 @@ import android.text.SpannableString; import java.lang.reflect.Method; import androidx.appcompat.app.AppCompatActivity; + import it.integry.integrywmsnative.core.REST.watcher.ServerStatusChecker; +import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager; import it.integry.integrywmsnative.core.class_router.ClassRouter; import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.utility.UtilityExceptions; @@ -22,6 +24,9 @@ public class MainContext { public void init(Runnable onContextInitialized) { + + BarcodeManager.init(mContext); + this.initDBData(() -> { onContextInitialized.run(); }); diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/vendita/MainVenditaFragment.java b/app/src/main/java/it/integry/integrywmsnative/gest/vendita/MainVenditaFragment.java index 003da239..6f66e781 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/vendita/MainVenditaFragment.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/vendita/MainVenditaFragment.java @@ -121,7 +121,7 @@ public class MainVenditaFragment extends Fragment implements ITitledFragment, IS ButterKnife.bind(this, mBinding.getRoot()); // if(mWaterfallToolbar != null) mWaterfallToolbar.setRecyclerView(mBinding.venditaMainList); - mToolbar.setRecyclerView(mBinding.venditaMainList); + if(mToolbar != null) mToolbar.setRecyclerView(mBinding.venditaMainList); return mBinding.getRoot(); } diff --git a/app/src/main/res/drawable/ic_barcode_96.png b/app/src/main/res/drawable/ic_barcode_96.png deleted file mode 100644 index 05971ffb..00000000 Binary files a/app/src/main/res/drawable/ic_barcode_96.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_black_barcode.xml b/app/src/main/res/drawable/ic_black_barcode.xml new file mode 100644 index 00000000..33e8f061 --- /dev/null +++ b/app/src/main/res/drawable/ic_black_barcode.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_barcode_scanner.xml b/app/src/main/res/drawable/ic_black_barcode_scanner.xml new file mode 100644 index 00000000..0058aea8 --- /dev/null +++ b/app/src/main/res/drawable/ic_black_barcode_scanner.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_download.xml b/app/src/main/res/drawable/ic_black_download.xml new file mode 100644 index 00000000..42e84916 --- /dev/null +++ b/app/src/main/res/drawable/ic_black_download.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_empty_box.xml b/app/src/main/res/drawable/ic_black_empty_box.xml new file mode 100644 index 00000000..acd54434 --- /dev/null +++ b/app/src/main/res/drawable/ic_black_empty_box.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_external.xml b/app/src/main/res/drawable/ic_black_external.xml new file mode 100644 index 00000000..62bb2fae --- /dev/null +++ b/app/src/main/res/drawable/ic_black_external.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_home.xml b/app/src/main/res/drawable/ic_black_home.xml new file mode 100644 index 00000000..4d5dcf67 --- /dev/null +++ b/app/src/main/res/drawable/ic_black_home.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_internal.xml b/app/src/main/res/drawable/ic_black_internal.xml new file mode 100644 index 00000000..94e02013 --- /dev/null +++ b/app/src/main/res/drawable/ic_black_internal.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_latest_delivery.xml b/app/src/main/res/drawable/ic_black_latest_delivery.xml new file mode 100644 index 00000000..214d19e2 --- /dev/null +++ b/app/src/main/res/drawable/ic_black_latest_delivery.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_load_shelf.xml b/app/src/main/res/drawable/ic_black_load_shelf.xml new file mode 100644 index 00000000..3062a0f3 --- /dev/null +++ b/app/src/main/res/drawable/ic_black_load_shelf.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_recover.xml b/app/src/main/res/drawable/ic_black_recover.xml new file mode 100644 index 00000000..6612722f --- /dev/null +++ b/app/src/main/res/drawable/ic_black_recover.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_black_upload.xml b/app/src/main/res/drawable/ic_black_upload.xml new file mode 100644 index 00000000..6edadf8e --- /dev/null +++ b/app/src/main/res/drawable/ic_black_upload.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_download_black_24dp.xml b/app/src/main/res/drawable/ic_download_black_24dp.xml deleted file mode 100644 index 492b41d3..00000000 --- a/app/src/main/res/drawable/ic_download_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_empty_box_96.png b/app/src/main/res/drawable/ic_empty_box_96.png deleted file mode 100644 index bf75102d..00000000 Binary files a/app/src/main/res/drawable/ic_empty_box_96.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_home_black_24dp.xml b/app/src/main/res/drawable/ic_home_black_24dp.xml deleted file mode 100644 index 70fb2910..00000000 --- a/app/src/main/res/drawable/ic_home_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_latest_delivery.xml b/app/src/main/res/drawable/ic_latest_delivery.xml new file mode 100644 index 00000000..9e415ce0 --- /dev/null +++ b/app/src/main/res/drawable/ic_latest_delivery.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_load_shelf_96.png b/app/src/main/res/drawable/ic_load_shelf_96.png deleted file mode 100644 index 7586f3a9..00000000 Binary files a/app/src/main/res/drawable/ic_load_shelf_96.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_recover_96.png b/app/src/main/res/drawable/ic_recover_96.png deleted file mode 100644 index 3fdf95d8..00000000 Binary files a/app/src/main/res/drawable/ic_recover_96.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_upload_black_24dp.xml b/app/src/main/res/drawable/ic_upload_black_24dp.xml deleted file mode 100644 index d6339722..00000000 --- a/app/src/main/res/drawable/ic_upload_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml index 3fdfe622..533e6e94 100644 --- a/app/src/main/res/layout/fragment_main.xml +++ b/app/src/main/res/layout/fragment_main.xml @@ -138,7 +138,7 @@ android:layout_height="30dp" android:layout_marginEnd="16dp" android:adjustViewBounds="true" - android:src="@drawable/ic_recover_96" + android:src="@drawable/ic_black_recover" android:tint="@android:color/white" /> - - - - - - - - - - - + + + + - - - - - - + - - - - - + - - - - - - - - - + - - + + + diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml index 3da1e78a..0131e39b 100644 --- a/app/src/main/res/menu/activity_main_drawer.xml +++ b/app/src/main/res/menu/activity_main_drawer.xml @@ -4,32 +4,32 @@ - - - - + @@ -38,11 +38,11 @@ diff --git a/barcode_base_library/src/main/java/it/integry/plugins/barcode_base_library/interfaces/BarcodeReaderInterface.java b/barcode_base_library/src/main/java/it/integry/plugins/barcode_base_library/interfaces/BarcodeReaderInterface.java index 616869f3..0451cb2e 100644 --- a/barcode_base_library/src/main/java/it/integry/plugins/barcode_base_library/interfaces/BarcodeReaderInterface.java +++ b/barcode_base_library/src/main/java/it/integry/plugins/barcode_base_library/interfaces/BarcodeReaderInterface.java @@ -8,7 +8,7 @@ public interface BarcodeReaderInterface { boolean isRightAdapter(); - void init() throws BarcodeAdapterNotFoundException; + void init(Runnable onDeviceReady) throws BarcodeAdapterNotFoundException; void deinit(); diff --git a/ext_sources/9DBDE980.png b/ext_sources/9DBDE980.png deleted file mode 100644 index ab966c21..00000000 Binary files a/ext_sources/9DBDE980.png and /dev/null differ diff --git a/ext_sources/ICONS/icons8-barcode-scanner.svg b/ext_sources/ICONS/icons8-barcode-scanner.svg new file mode 100644 index 00000000..7f089028 --- /dev/null +++ b/ext_sources/ICONS/icons8-barcode-scanner.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-barcode.svg b/ext_sources/ICONS/icons8-barcode.svg new file mode 100644 index 00000000..9e2776ab --- /dev/null +++ b/ext_sources/ICONS/icons8-barcode.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-database-restore.svg b/ext_sources/ICONS/icons8-database-restore.svg new file mode 100644 index 00000000..3fe607f5 --- /dev/null +++ b/ext_sources/ICONS/icons8-database-restore.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-deliver-food (1).svg b/ext_sources/ICONS/icons8-deliver-food (1).svg new file mode 100644 index 00000000..fbdec32d --- /dev/null +++ b/ext_sources/ICONS/icons8-deliver-food (1).svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-deliver-food.svg b/ext_sources/ICONS/icons8-deliver-food.svg new file mode 100644 index 00000000..b8bff51d --- /dev/null +++ b/ext_sources/ICONS/icons8-deliver-food.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/ext_sources/ICONS/icons8-download.svg b/ext_sources/ICONS/icons8-download.svg new file mode 100644 index 00000000..8441369e --- /dev/null +++ b/ext_sources/ICONS/icons8-download.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-empty-box.svg b/ext_sources/ICONS/icons8-empty-box.svg new file mode 100644 index 00000000..d08c794e --- /dev/null +++ b/ext_sources/ICONS/icons8-empty-box.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-external.svg b/ext_sources/ICONS/icons8-external.svg new file mode 100644 index 00000000..e62d9b49 --- /dev/null +++ b/ext_sources/ICONS/icons8-external.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-home-page.svg b/ext_sources/ICONS/icons8-home-page.svg new file mode 100644 index 00000000..0720cca3 --- /dev/null +++ b/ext_sources/ICONS/icons8-home-page.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-internal.svg b/ext_sources/ICONS/icons8-internal.svg new file mode 100644 index 00000000..96c06bcd --- /dev/null +++ b/ext_sources/ICONS/icons8-internal.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-restart.svg b/ext_sources/ICONS/icons8-restart.svg new file mode 100644 index 00000000..53559186 --- /dev/null +++ b/ext_sources/ICONS/icons8-restart.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/ICONS/icons8-upload.svg b/ext_sources/ICONS/icons8-upload.svg new file mode 100644 index 00000000..b964c1e7 --- /dev/null +++ b/ext_sources/ICONS/icons8-upload.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ext_sources/Screenshots/0_Home.png b/ext_sources/Screenshots/0_Home.png new file mode 100644 index 00000000..394afa7d Binary files /dev/null and b/ext_sources/Screenshots/0_Home.png differ diff --git a/ext_sources/Screenshots/0a_Menu Laterale.png b/ext_sources/Screenshots/0a_Menu Laterale.png new file mode 100644 index 00000000..13886a2b Binary files /dev/null and b/ext_sources/Screenshots/0a_Menu Laterale.png differ diff --git a/ext_sources/Screenshots/1a_Elenco ordini.png b/ext_sources/Screenshots/1a_Elenco ordini.png new file mode 100644 index 00000000..14063ff0 Binary files /dev/null and b/ext_sources/Screenshots/1a_Elenco ordini.png differ diff --git a/ext_sources/Screenshots/1b_Elenco articoli accettazione.png b/ext_sources/Screenshots/1b_Elenco articoli accettazione.png new file mode 100644 index 00000000..0c1a52f8 Binary files /dev/null and b/ext_sources/Screenshots/1b_Elenco articoli accettazione.png differ diff --git a/ext_sources/Screenshots/1c_Input quantita accettazione.png b/ext_sources/Screenshots/1c_Input quantita accettazione.png new file mode 100644 index 00000000..c243d87a Binary files /dev/null and b/ext_sources/Screenshots/1c_Input quantita accettazione.png differ diff --git a/ext_sources/Screenshots/2a_Elenco ordini spedizione.png b/ext_sources/Screenshots/2a_Elenco ordini spedizione.png new file mode 100644 index 00000000..7e0370b1 Binary files /dev/null and b/ext_sources/Screenshots/2a_Elenco ordini spedizione.png differ diff --git a/ext_sources/Screenshots/2b_Elenco articoli spedizione.png b/ext_sources/Screenshots/2b_Elenco articoli spedizione.png new file mode 100644 index 00000000..97b4f88f Binary files /dev/null and b/ext_sources/Screenshots/2b_Elenco articoli spedizione.png differ diff --git a/ext_sources/Screenshots/2c_Input quantita spedizione.png b/ext_sources/Screenshots/2c_Input quantita spedizione.png new file mode 100644 index 00000000..9328a8a6 Binary files /dev/null and b/ext_sources/Screenshots/2c_Input quantita spedizione.png differ diff --git a/ext_sources/box.svg b/ext_sources/box.svg deleted file mode 100644 index 6cd0dc12..00000000 --- a/ext_sources/box.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/honeywellscannerlibrary/build.gradle b/honeywellscannerlibrary/build.gradle index fb28ef3b..b141d6c4 100644 --- a/honeywellscannerlibrary/build.gradle +++ b/honeywellscannerlibrary/build.gradle @@ -20,6 +20,10 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility = '1.8' + targetCompatibility = '1.8' + } } diff --git a/honeywellscannerlibrary/src/main/java/it/integry/honeywellscannerlibrary/HoneyWellBarcodeReader.java b/honeywellscannerlibrary/src/main/java/it/integry/honeywellscannerlibrary/HoneyWellBarcodeReader.java index 357301e4..7632d255 100644 --- a/honeywellscannerlibrary/src/main/java/it/integry/honeywellscannerlibrary/HoneyWellBarcodeReader.java +++ b/honeywellscannerlibrary/src/main/java/it/integry/honeywellscannerlibrary/HoneyWellBarcodeReader.java @@ -1,8 +1,24 @@ package it.integry.honeywellscannerlibrary; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Build; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; import com.honeywell.aidc.AidcManager; +import com.honeywell.aidc.BarcodeFailureEvent; +import com.honeywell.aidc.BarcodeReadEvent; +import com.honeywell.aidc.BarcodeReader; +import com.honeywell.aidc.InvalidScannerNameException; +import com.honeywell.aidc.ScannerUnavailableException; +import com.honeywell.aidc.UnsupportedPropertyException; + +import java.util.HashMap; +import java.util.Map; import it.integry.plugins.barcode_base_library.exception.BarcodeAdapterNotFoundException; import it.integry.plugins.barcode_base_library.extension.RunnableArgs; @@ -11,51 +27,156 @@ import it.integry.plugins.barcode_base_library.model.BarcodeScanDTO; public class HoneyWellBarcodeReader implements BarcodeReaderInterface { - private Context mContext; + private final AppCompatActivity mContext; + private AidcManager manager; + private BarcodeReader barcodeReader; - private boolean canGoOn = false; + private static RunnableArgs mOnScanSuccessfull; + private static RunnableArgs mOnScanFailed; - public HoneyWellBarcodeReader(Context context) { + private static final String TAG = HoneyWellBarcodeReader.class.getName(); + + public HoneyWellBarcodeReader(final AppCompatActivity context) { this.mContext = context; - - AidcManager.create(context, new AidcManager.CreatedCallback() { - @Override - public void onCreated(AidcManager aidcManager) { - canGoOn = true; - } - }); - - while(!canGoOn) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } } @Override public boolean isRightAdapter() { - return false; + String model = Build.MODEL; + if(model.equalsIgnoreCase("EDA50")) { + return true; + } else return false; } @Override - public void init() throws BarcodeAdapterNotFoundException { + public void init(final Runnable onDeviceReady) throws BarcodeAdapterNotFoundException { + if(isRightAdapter()) { + AidcManager.create(mContext, new AidcManager.CreatedCallback() { + + @Override + public void onCreated(AidcManager aidcManager) { + + manager = aidcManager; + + try{ + barcodeReader = manager.createBarcodeReader(); + registerListenersInternal(); + } + catch (InvalidScannerNameException e){ + Toast.makeText(mContext, "Invalid Scanner Name Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show(); + } + catch (Exception e){ + Toast.makeText(mContext, "Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show(); + } + + + onDeviceReady.run(); + } + }); + + } else { + throw new BarcodeAdapterNotFoundException(getAdapterName()); + } } @Override public void deinit() { + if (barcodeReader != null) { + // close BarcodeReader to clean up resources. + barcodeReader.close(); + barcodeReader = null; + } + if (manager != null) { + // close AidcManager to disconnect from the scanner service. + // once closed, the object can no longer be used. + manager.close(); + } } + @Override public void register(RunnableArgs onScanSuccessfull, RunnableArgs onScanFailed) { - + mOnScanSuccessfull = onScanSuccessfull; + mOnScanFailed = onScanFailed; } + @Override public String getAdapterName() { - return null; + return "Honeywell"; + } + + + + + + + private void registerListenersInternal() { + // register bar code event listener + barcodeReader.addBarcodeListener(new BarcodeReader.BarcodeListener() { + @Override + public void onBarcodeEvent(BarcodeReadEvent barcodeReadEvent) { + dispatchEvent(barcodeReadEvent); + } + + @Override + public void onFailureEvent(BarcodeFailureEvent barcodeFailureEvent) { + + } + }); + + + // set the trigger mode to client control + try { + barcodeReader.setProperty(BarcodeReader.PROPERTY_TRIGGER_CONTROL_MODE, + BarcodeReader.TRIGGER_CONTROL_MODE_CLIENT_CONTROL); + } catch (UnsupportedPropertyException e) { + Toast.makeText(mContext, "Failed to apply properties", Toast.LENGTH_SHORT).show(); + } + + Map properties = new HashMap<>(); + + // Set Symbologies On/Off + properties.put(BarcodeReader.PROPERTY_EAN_8_ENABLED, true); + properties.put(BarcodeReader.PROPERTY_EAN_13_ENABLED, true); + properties.put(BarcodeReader.PROPERTY_CODE_39_ENABLED, true); + properties.put(BarcodeReader.PROPERTY_CODE_128_ENABLED, true); + properties.put(BarcodeReader.PROPERTY_GS1_128_ENABLED, true); + properties.put(BarcodeReader.PROPERTY_UPC_A_ENABLE, true); + + + properties.put(BarcodeReader.PROPERTY_EAN_8_CHECK_DIGIT_TRANSMIT_ENABLED, true); + properties.put(BarcodeReader.PROPERTY_EAN_13_CHECK_DIGIT_TRANSMIT_ENABLED, true); + properties.put(BarcodeReader.PROPERTY_UPC_A_CHECK_DIGIT_TRANSMIT_ENABLED, true); + + properties.put(BarcodeReader.PROPERTY_TRIGGER_CONTROL_MODE, BarcodeReader.TRIGGER_CONTROL_MODE_AUTO_CONTROL); + + // Apply the settings + barcodeReader.setProperties(properties); + + + try { + barcodeReader.claim(); + } catch (ScannerUnavailableException e) { + e.printStackTrace(); + } + + } + + + private void dispatchEvent(BarcodeReadEvent barcodeReadEvent) + { + mContext.runOnUiThread(() -> { + + BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO() + .setByteValue(barcodeReadEvent.getBarcodeData().getBytes()) + .setStringValue(barcodeReadEvent.getBarcodeData()) + .setType(HoneywellBarcodeTypeMapper.map(barcodeReadEvent.getCodeId())) + .setName(HoneywellBarcodeTypeMapper.map(barcodeReadEvent.getCodeId()).toString()); + + mOnScanSuccessfull.run(barcodeScanDTO); + }); } } diff --git a/honeywellscannerlibrary/src/main/java/it/integry/honeywellscannerlibrary/HoneywellBarcodeTypeMapper.java b/honeywellscannerlibrary/src/main/java/it/integry/honeywellscannerlibrary/HoneywellBarcodeTypeMapper.java new file mode 100644 index 00000000..4b55a929 --- /dev/null +++ b/honeywellscannerlibrary/src/main/java/it/integry/honeywellscannerlibrary/HoneywellBarcodeTypeMapper.java @@ -0,0 +1,35 @@ +package it.integry.honeywellscannerlibrary; + +import android.util.Log; + +import it.integry.plugins.barcode_base_library.model.BarcodeType; + +public class HoneywellBarcodeTypeMapper { + + public static BarcodeType map(String inputType) { + + switch (inputType) { + case "h": + return BarcodeType.CODE11; + case "j": + return BarcodeType.CODE128; + case "b": + return BarcodeType.CODE39; + + case "d": + return BarcodeType.EAN13; + case "D": + return BarcodeType.EAN8; + + case "c": + return BarcodeType.UPCA; + case "E": + return BarcodeType.UPCE; + default: + Log.d("SCAN TYPE", inputType); + return null; + } + + } + +} diff --git a/pointmobilescannerlibrary/src/main/java/it/integry/pointmobilescannerlibrary/PointMobileBarcodeReader.java b/pointmobilescannerlibrary/src/main/java/it/integry/pointmobilescannerlibrary/PointMobileBarcodeReader.java index bedac4db..566feba7 100644 --- a/pointmobilescannerlibrary/src/main/java/it/integry/pointmobilescannerlibrary/PointMobileBarcodeReader.java +++ b/pointmobilescannerlibrary/src/main/java/it/integry/pointmobilescannerlibrary/PointMobileBarcodeReader.java @@ -5,6 +5,8 @@ import android.content.Context; import android.content.Intent; import android.util.Log; +import androidx.appcompat.app.AppCompatActivity; + import java.nio.charset.StandardCharsets; import device.common.DecodeResult; @@ -18,7 +20,7 @@ import it.integry.plugins.barcode_base_library.model.BarcodeType; public class PointMobileBarcodeReader implements BarcodeReaderInterface { - private Context mContext; + private AppCompatActivity mContext; private static ScanManager mScanManager; private static DecodeResult mDecodeResult; @@ -27,7 +29,7 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface { private static String TAG = PointMobileBarcodeReader.class.getName(); - public PointMobileBarcodeReader(Context context) { + public PointMobileBarcodeReader(AppCompatActivity context) { this.mContext = context; mScanManager = new ScanManager(); @@ -45,11 +47,13 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface { } @Override - public void init() throws BarcodeAdapterNotFoundException { + public void init(Runnable onDeviceReady) throws BarcodeAdapterNotFoundException { if(isRightAdapter()){ try{ mScanManager.aDecodeSetTerminator(ScanConst.Terminator.DCD_TERMINATOR_NONE); mScanManager.aDecodeSetResultType(ScanConst.ResultType.DCD_RESULT_USERMSG); + + onDeviceReady.run(); } catch (Exception ex) { throw new BarcodeAdapterNotFoundException(getAdapterName()); } diff --git a/zebrascannerlibrary/src/main/java/it/integry/zebrascannerlibrary/ZebraBarcodeReader.java b/zebrascannerlibrary/src/main/java/it/integry/zebrascannerlibrary/ZebraBarcodeReader.java index 44d8e3c7..56a9ef0f 100644 --- a/zebrascannerlibrary/src/main/java/it/integry/zebrascannerlibrary/ZebraBarcodeReader.java +++ b/zebrascannerlibrary/src/main/java/it/integry/zebrascannerlibrary/ZebraBarcodeReader.java @@ -6,6 +6,8 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Build; +import androidx.appcompat.app.AppCompatActivity; + import it.integry.plugins.barcode_base_library.exception.BarcodeAdapterNotFoundException; import it.integry.plugins.barcode_base_library.extension.RunnableArgs; import it.integry.plugins.barcode_base_library.interfaces.BarcodeReaderInterface; @@ -13,7 +15,7 @@ import it.integry.plugins.barcode_base_library.model.BarcodeScanDTO; public class ZebraBarcodeReader implements BarcodeReaderInterface { - private final Context mContext; + private final AppCompatActivity mContext; private static RunnableArgs mOnScanSuccessfull; private static RunnableArgs mOnScanFailed; @@ -21,7 +23,7 @@ public class ZebraBarcodeReader implements BarcodeReaderInterface { private static final String TAG = ZebraBarcodeReader.class.getName(); private static final String INTENT_FILTER_STRING = "it.integry.scan_filter"; - public ZebraBarcodeReader(Context context) { + public ZebraBarcodeReader(AppCompatActivity context) { this.mContext = context; } @@ -34,12 +36,14 @@ public class ZebraBarcodeReader implements BarcodeReaderInterface { } @Override - public void init() throws BarcodeAdapterNotFoundException { + public void init(Runnable onDeviceReady) throws BarcodeAdapterNotFoundException { if(isRightAdapter()) { IntentFilter filter = new IntentFilter(); filter.addCategory(Intent.CATEGORY_DEFAULT); filter.addAction(INTENT_FILTER_STRING); mContext.registerReceiver(myBroadcastReceiver, filter); + + onDeviceReady.run(); } else { throw new BarcodeAdapterNotFoundException(getAdapterName()); }