aggiunta configurazione scanner barcode tramite preferenze app
This commit is contained in:
parent
f8c0852cb7
commit
0e6f4a7892
@ -1,14 +1,20 @@
|
||||
package it.integry.integrywmsnative.core.barcode_reader;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Pair;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.interfaces.BarcodeReaderInterface;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeSetting;
|
||||
import it.integry.honeywellscannerlibrary.HoneyWellBarcodeReader;
|
||||
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
||||
import it.integry.keyobardemulatorscannerlibrary.KeyboardEmulatorBarcodeReader;
|
||||
import it.integry.pointmobilescannerlibrary.PointMobileBarcodeReader;
|
||||
import it.integry.zebrascannerlibrary.ZebraBarcodeReader;
|
||||
@ -21,12 +27,7 @@ public class BarcodeManager {
|
||||
private static boolean mEnabled = true;
|
||||
|
||||
|
||||
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
|
||||
PointMobileBarcodeReader.class,
|
||||
ZebraBarcodeReader.class,
|
||||
HoneyWellBarcodeReader.class,
|
||||
KeyboardEmulatorBarcodeReader.class
|
||||
};
|
||||
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{PointMobileBarcodeReader.class, ZebraBarcodeReader.class, HoneyWellBarcodeReader.class, KeyboardEmulatorBarcodeReader.class};
|
||||
|
||||
|
||||
public static void init(Context applicationContext) throws Exception {
|
||||
@ -65,6 +66,18 @@ public class BarcodeManager {
|
||||
}
|
||||
});
|
||||
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(applicationContext);
|
||||
var additionalSettings = new ArrayList<Pair<String, Object>>();
|
||||
var scanDelay = sharedPreferences.getString(MainSettingsFragment.KEY_TRIGGER_SCAN_DELAY, null);
|
||||
var scanDelaySetting = new Pair<String, Object>(BarcodeSetting.P_TRIGGER_SCAN_DELAY, scanDelay);
|
||||
additionalSettings.add(scanDelaySetting);
|
||||
|
||||
var scanMode = sharedPreferences.getString(MainSettingsFragment.KEY_TRIGGER_SCAN_MODE, null);
|
||||
var scanModeSetting = new Pair<String, Object>(BarcodeSetting.P_TRIGGER_SCAN_MODE, scanMode);
|
||||
additionalSettings.add(scanModeSetting);
|
||||
|
||||
BarcodeManager.changeSettings(additionalSettings);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -81,8 +94,7 @@ public class BarcodeManager {
|
||||
}
|
||||
|
||||
public static boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
|
||||
if (mCurrentBarcodeInterface != null)
|
||||
mCurrentBarcodeInterface.onKeyEvent(keyEvent);
|
||||
if (mCurrentBarcodeInterface != null) mCurrentBarcodeInterface.onKeyEvent(keyEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -133,6 +145,9 @@ public class BarcodeManager {
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
public static void changeSettings(List<Pair<String, Object>> settings) {
|
||||
mCurrentBarcodeInterface.changeSettings(settings);
|
||||
}
|
||||
|
||||
public static boolean isKeyboardEmulator() {
|
||||
return mCurrentBarcodeInterface instanceof KeyboardEmulatorBarcodeReader;
|
||||
|
||||
@ -39,7 +39,7 @@ public class MainContext {
|
||||
try {
|
||||
BarcodeManager.init(applicationContext);
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
this.initDBData(() -> {
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class EmptyLUException extends Exception {
|
||||
public EmptyLUException() {
|
||||
super(UtilityResources.getString(R.string.empty_lu));
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,6 @@ import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class NoArtsFoundException extends Exception {
|
||||
public NoArtsFoundException() {
|
||||
super(UtilityResources.getString(R.string.no_result_from_barcode));
|
||||
super(UtilityResources.getString(R.string.no_arts_found));
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,8 +17,8 @@ import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOperationsListener;
|
||||
@ -333,7 +333,7 @@ public class PickingResiViewModel {
|
||||
searchArtFromUL(mtbColt, onComplete);
|
||||
} else this.sendError(new InvalidLUException());
|
||||
} else {
|
||||
this.sendError(new NoArtsFoundException());
|
||||
this.sendError(new NoResultFromBarcodeException(SSCC));
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
@ -417,7 +417,7 @@ public class PickingResiViewModel {
|
||||
|
||||
private void loadMatchedRows(List<WithdrawableDtbDocr> matchedRows) {
|
||||
if (matchedRows == null || matchedRows.size() == 0) {
|
||||
this.sendError(new NoArtsFoundException());
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
} else if (matchedRows.size() == 1) {
|
||||
WithdrawableDtbDocr matchedItem = matchedRows.get(0);
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.preference.EditTextPreference;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
@ -17,7 +18,9 @@ import com.harrysoft.androidbluetoothserial.BluetoothManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeSetting;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
@ -26,6 +29,8 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
||||
private final ArrayList<Runnable> onPreDestroyList = new ArrayList<>();
|
||||
|
||||
public static final String KEY_PALLET_BT_DEVICE = "pallet_scale_bt_device";
|
||||
public static final String KEY_TRIGGER_SCAN_MODE = "TRIG_SCAN_MODE";
|
||||
public static final String KEY_TRIGGER_SCAN_DELAY = "TRIG_SCAN_DELAY";
|
||||
|
||||
private Collection<BluetoothDevice> btPairedDevices;
|
||||
|
||||
@ -39,11 +44,30 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
||||
setPreferencesFromResource(R.xml.app_preferences, rootKey);
|
||||
|
||||
var palletScaleBtDeviceListPref = (ListPreference) findPreference(KEY_PALLET_BT_DEVICE);
|
||||
var triggerScanDelayPref = (EditTextPreference) findPreference(KEY_TRIGGER_SCAN_DELAY);
|
||||
var triggerScanModeListPref = (ListPreference) findPreference(KEY_TRIGGER_SCAN_MODE);
|
||||
setListPreferenceData(palletScaleBtDeviceListPref);
|
||||
palletScaleBtDeviceListPref.setOnPreferenceChangeListener(this);
|
||||
|
||||
triggerScanDelayPref.setOnPreferenceChangeListener(this);
|
||||
triggerScanDelayPref.setSummary(triggerScanDelayPref.getText());
|
||||
|
||||
loadScanModePreferences();
|
||||
triggerScanModeListPref.setOnPreferenceChangeListener(this);
|
||||
triggerScanModeListPref.setSummary(triggerScanModeListPref.getValue());
|
||||
}
|
||||
|
||||
|
||||
protected void loadScanModePreferences() {
|
||||
var triggerScanModeListPref = (ListPreference) findPreference(KEY_TRIGGER_SCAN_MODE);
|
||||
if (triggerScanModeListPref != null) {
|
||||
var scanModes = BarcodeSetting.getTriggerScanModes();
|
||||
triggerScanModeListPref.setEntries(scanModes);
|
||||
triggerScanModeListPref.setEntryValues(scanModes);
|
||||
triggerScanModeListPref.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setListPreferenceData(ListPreference lp) {
|
||||
BluetoothManager bluetoothManager = BluetoothManager.getInstance();
|
||||
if (bluetoothManager == null) {
|
||||
@ -106,6 +130,16 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
||||
final var palletScaleBtDeviceListPref = (ListPreference) preference;
|
||||
updatePalletBtDeviceSummary(palletScaleBtDeviceListPref, (String) newValue);
|
||||
break;
|
||||
case KEY_TRIGGER_SCAN_DELAY:
|
||||
final var scanDelayPref = (EditTextPreference) preference;
|
||||
scanDelayPref.setSummary((String) newValue);
|
||||
updateBarcodeScannerSettings();
|
||||
break;
|
||||
case KEY_TRIGGER_SCAN_MODE:
|
||||
final var scanTriggerMode = (ListPreference) preference;
|
||||
scanTriggerMode.setSummary((String) newValue);
|
||||
updateBarcodeScannerSettings();
|
||||
break;
|
||||
|
||||
}
|
||||
// Set result so knows to refresh itself
|
||||
@ -113,6 +147,14 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateBarcodeScannerSettings() {
|
||||
try {
|
||||
BarcodeManager.init(requireContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updatePalletBtDeviceSummary(ListPreference listPref, String btDeviceAddress) {
|
||||
String btDeviceName = Stream.of(btPairedDevices)
|
||||
|
||||
@ -184,11 +184,12 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
mHandler.postDelayed(() -> {
|
||||
|
||||
if (mDialogInputQuantityV2DTO.isNumCnfEditable()) {
|
||||
mBindings.inputNumCnfText.requestFocus();
|
||||
UtilityFocus.focusTextBox(requireContext(), mBindings.inputNumCnfText);
|
||||
// mBindings.inputNumCnfText.requestFocus();
|
||||
} else {
|
||||
UtilityFocus.focusTextBox(requireContext(), mBindings.inputQtaTotText);
|
||||
}
|
||||
}, 1000);
|
||||
}, 1500);
|
||||
}
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@ -5,8 +5,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.EmptyLUException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
@ -125,7 +125,7 @@ public class DialogScanArtViewModel {
|
||||
onComplete.run(DialogConsts.Results.YES, null, null, mtbColt.getMtbColr());
|
||||
} else this.sendError(new InvalidLUException());
|
||||
} else {
|
||||
this.sendError(new NoArtsFoundException());
|
||||
this.sendError(new EmptyLUException());
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
|
||||
24
app/src/main/res/layout/preference_edit_text.xml
Normal file
24
app/src/main/res/layout/preference_edit_text.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@android:id/edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:singleLine="true"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="21dp"
|
||||
android:layout_marginEnd="21dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@ -413,4 +413,12 @@
|
||||
<string name="scan_lu_to_recover">Scansiona il codice a barre della <b>UL</b> da recuperare</string>
|
||||
<string name="action_print_shipping_SSCC">Stampa etichetta spedizione</string>
|
||||
<string name="action_print_production_SSCC">Stampa etichetta lavorazione</string>
|
||||
<string name="scanner_settings">Impostazioni scanner</string>
|
||||
<string name="scanner_settings_scanner_delay_title">Ritardo scansione</string>
|
||||
<string name="scanner_settings_scanner_delay_summary">Imposta un ritardo di lettura per la scansione</string>
|
||||
<string name="scanner_settings_trigger_scan_mode_title">Modalità scansione</string>
|
||||
<string name="scanner_settings_trigger_scan_mode_summary">Seleziona modalità scansione per lo scanner</string>
|
||||
<string name="action_create_doc">Crea documento</string>
|
||||
<string name="no_arts_found">Nessun articolo compatibile trovato</string>
|
||||
<string name="empty_lu">UL vuota</string>
|
||||
</resources>
|
||||
@ -419,4 +419,12 @@
|
||||
<string name="scan_lu_to_recover">Please scan the <b>LU barcode</b> to recover</string>
|
||||
<string name="action_print_shipping_SSCC">Print shipping label</string>
|
||||
<string name="action_print_production_SSCC">Print production label</string>
|
||||
<string name="scanner_settings">Scanner settings</string>
|
||||
<string name="scanner_settings_scanner_delay_title">Scan delay</string>
|
||||
<string name="scanner_settings_scanner_delay_summary">Set reading scanner delay</string>
|
||||
<string name="scanner_settings_trigger_scan_mode_title">Modalità scansione</string>
|
||||
<string name="scanner_settings_trigger_scan_mode_summary">Select scan mode</string>
|
||||
<string name="action_create_doc">Create document</string>
|
||||
<string name="no_arts_found">No product found</string>
|
||||
<string name="empty_lu">Empty LU</string>
|
||||
</resources>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<androidx.preference.PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<androidx.preference.PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory
|
||||
app:title="@string/accettazione_title_fragment"
|
||||
@ -38,5 +39,29 @@
|
||||
app:title="@string/pallet_scale_bt_device_selection_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
app:title="@string/scanner_settings"
|
||||
app:iconSpaceReserved="false">
|
||||
|
||||
<ListPreference
|
||||
app:iconSpaceReserved="false"
|
||||
app:dialogTitle="@string/scanner_settings_trigger_scan_mode_title"
|
||||
app:key="TRIG_SCAN_MODE"
|
||||
app:summary="@string/scanner_settings_trigger_scan_mode_summary"
|
||||
app:title="@string/scanner_settings_trigger_scan_mode_title" />
|
||||
|
||||
<EditTextPreference
|
||||
android:defaultValue="0"
|
||||
android:dialogLayout="@layout/preference_edit_text"
|
||||
app:iconSpaceReserved="false"
|
||||
app:dialogTitle="@string/scanner_settings_scanner_delay_title"
|
||||
app:key="TRIG_SCAN_DELAY"
|
||||
android:inputType="numberDecimal"
|
||||
android:digits="0123456789"
|
||||
app:summary="@string/scanner_settings_scanner_delay_summary"
|
||||
app:title="@string/scanner_settings_scanner_delay_title" />
|
||||
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
||||
@ -1,8 +1,11 @@
|
||||
package it.integry.barcode_base_android_library.interfaces;
|
||||
|
||||
|
||||
import android.util.Pair;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.exception.BarcodeAdapterNotFoundException;
|
||||
import it.integry.barcode_base_android_library.extension.RunnableArgs;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
@ -21,4 +24,6 @@ public interface BarcodeReaderInterface {
|
||||
|
||||
void onKeyEvent(KeyEvent keyEvent);
|
||||
|
||||
void changeSettings(List<Pair<String, Object>> settings);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package it.integry.barcode_base_android_library.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BarcodeSetting {
|
||||
|
||||
public static final String P_TRIGGER_SCAN_MODE = "TRIG_SCAN_MODE";
|
||||
public static final String V_TRIGGER_SCAN_MODE_READ_ON_RELEASE = "readOnRelease";
|
||||
public static final String V_TRIGGER_SCAN_MODE_ONE_SHOT = "oneShot";
|
||||
public static final String V_TRIGGER_SCAN_MODE_CONTINUOS = "continuous";
|
||||
public static final String V_TRIGGER_SCAN_MODE_READ_ON_SECOND_TRIGGER_PRESS = "readOnSecondTriggerPress";
|
||||
public static final String P_TRIGGER_SCAN_DELAY = "TRIG_SCAN_DELAY";
|
||||
|
||||
|
||||
public static CharSequence[] getTriggerScanModes() {
|
||||
List<String> keys = new ArrayList<>();
|
||||
keys.add(V_TRIGGER_SCAN_MODE_READ_ON_RELEASE);
|
||||
keys.add(V_TRIGGER_SCAN_MODE_ONE_SHOT);
|
||||
// keys.add(V_TRIGGER_SCAN_MODE_CONTINUOS);
|
||||
// keys.add(V_TRIGGER_SCAN_MODE_READ_ON_SECOND_TRIGGER_PRESS);
|
||||
|
||||
return keys.toArray(new String[0]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,6 +2,7 @@ package it.integry.honeywellscannerlibrary;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Pair;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import com.honeywell.aidc.AidcManager;
|
||||
@ -19,6 +20,7 @@ import it.integry.barcode_base_android_library.exception.BarcodeAdapterNotFoundE
|
||||
import it.integry.barcode_base_android_library.extension.RunnableArgs;
|
||||
import it.integry.barcode_base_android_library.interfaces.BarcodeReaderInterface;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeSetting;
|
||||
|
||||
public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
|
||||
@ -59,8 +61,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
try {
|
||||
barcodeReader = manager.createBarcodeReader();
|
||||
registerListenersInternal();
|
||||
}
|
||||
catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
// throw new Exception("Invalid Scanner Name Exception: " + e.getMessage());
|
||||
}
|
||||
|
||||
@ -129,7 +130,24 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
// } catch (UnsupportedPropertyException e) {
|
||||
// throw new Exception("Failed to apply properties");
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> getDefaultProperties() {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
|
||||
// Set Symbologies On/Off
|
||||
@ -145,33 +163,53 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
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_SCAN_MODE, BarcodeReader.TRIGGER_SCAN_MODE_READ_ON_RELEASE);
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeSettings(List<Pair<String, Object>> settings) {
|
||||
Map<String, Object> properties = getDefaultProperties();
|
||||
String scanValue;
|
||||
for (Pair<String, Object> setting : settings) {
|
||||
switch (setting.first) {
|
||||
case BarcodeSetting.P_TRIGGER_SCAN_MODE:
|
||||
scanValue = setting.second != null ? (String) setting.second : "";
|
||||
String scanMode;
|
||||
switch (scanValue) {
|
||||
case BarcodeSetting.V_TRIGGER_SCAN_MODE_ONE_SHOT:
|
||||
scanMode = BarcodeReader.TRIGGER_SCAN_MODE_ONESHOT;
|
||||
break;
|
||||
case BarcodeSetting.V_TRIGGER_SCAN_MODE_CONTINUOS:
|
||||
scanMode = BarcodeReader.TRIGGER_SCAN_MODE_CONTINUOUS;
|
||||
break;
|
||||
case BarcodeSetting.V_TRIGGER_SCAN_MODE_READ_ON_SECOND_TRIGGER_PRESS:
|
||||
scanMode = BarcodeReader.TRIGGER_SCAN_MODE_READ_ON_SECOND_TRIGGER_PRESS;
|
||||
break;
|
||||
case BarcodeSetting.V_TRIGGER_SCAN_MODE_READ_ON_RELEASE:
|
||||
scanMode = BarcodeReader.TRIGGER_SCAN_MODE_READ_ON_RELEASE;
|
||||
break;
|
||||
default:
|
||||
scanMode = BarcodeReader.TRIGGER_SCAN_MODE_ONESHOT;
|
||||
}
|
||||
properties.put(BarcodeReader.PROPERTY_TRIGGER_SCAN_MODE, scanMode);
|
||||
break;
|
||||
case BarcodeSetting.P_TRIGGER_SCAN_DELAY:
|
||||
scanValue = setting.second != null ? (String) setting.second : "0";
|
||||
properties.put(BarcodeReader.PROPERTY_TRIGGER_SCAN_DELAY, Integer.parseInt(scanValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
// properties.put(BarcodeReader.PROPERTY_TRIGGER_SCAN_DELAY, 500);
|
||||
// properties.put(BarcodeReader.PROPERTY_TRIGGER_SCAN_MODE, BarcodeReader.TRIGGER_SCAN_MODE_READ_ON_SECOND_TRIGGER_PRESS);
|
||||
|
||||
|
||||
// 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);
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
package it.integry.keyobardemulatorscannerlibrary;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Pair;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.exception.BarcodeAdapterNotFoundException;
|
||||
import it.integry.barcode_base_android_library.extension.RunnableArgs;
|
||||
import it.integry.barcode_base_android_library.interfaces.BarcodeReaderInterface;
|
||||
@ -137,4 +140,9 @@ public class KeyboardEmulatorBarcodeReader implements BarcodeReaderInterface {
|
||||
}
|
||||
return ((10 - (((3 * odds) + evens) % 10)) % 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeSettings(List<Pair<String, Object>> settings) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -125,5 +127,9 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeSettings(List<Pair<String, Object>> settings) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,8 +5,11 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Build;
|
||||
import android.util.Pair;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.exception.BarcodeAdapterNotFoundException;
|
||||
import it.integry.barcode_base_android_library.extension.RunnableArgs;
|
||||
import it.integry.barcode_base_android_library.interfaces.BarcodeReaderInterface;
|
||||
@ -95,8 +98,7 @@ public class ZebraBarcodeReader implements BarcodeReaderInterface {
|
||||
};
|
||||
|
||||
|
||||
private void dispatchEvent(Intent initiatingIntent)
|
||||
{
|
||||
private void dispatchEvent(Intent initiatingIntent) {
|
||||
|
||||
String decodedSource = initiatingIntent.getStringExtra(mContext.getResources().getString(R.string.datawedge_intent_key_source));
|
||||
String decodedData = initiatingIntent.getStringExtra(mContext.getResources().getString(R.string.datawedge_intent_key_data));
|
||||
@ -111,4 +113,9 @@ public class ZebraBarcodeReader implements BarcodeReaderInterface {
|
||||
|
||||
mOnScanSuccessfull.run(barcodeScanDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeSettings(List<Pair<String, Object>> settings) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user