Refactoring splash screen

This commit is contained in:
2021-08-05 13:07:05 +02:00
parent d4bd92ec90
commit fbe095b7f7
56 changed files with 827 additions and 609 deletions

View File

@@ -6,8 +6,6 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -21,8 +19,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
lintOptions {

View File

@@ -1,16 +1,13 @@
package it.integry.honeywellscannerlibrary;
import android.content.Context;
import android.os.Build;
import android.view.KeyEvent;
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;
@@ -26,7 +23,7 @@ import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
private final AppCompatActivity mContext;
private final Context mContext;
private AidcManager manager;
private BarcodeReader barcodeReader;
@@ -35,7 +32,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
private static final String TAG = HoneyWellBarcodeReader.class.getName();
public HoneyWellBarcodeReader(final AppCompatActivity context) {
public HoneyWellBarcodeReader(final Context context) {
this.mContext = context;
}
@@ -64,11 +61,8 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
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();
// throw new Exception("Invalid Scanner Name Exception: " + e.getMessage());
}
@@ -114,7 +108,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
}
private void registerListenersInternal() {
private void registerListenersInternal() throws Exception {
// register bar code event listener
barcodeReader.addBarcodeListener(new BarcodeReader.BarcodeListener() {
@Override
@@ -134,7 +128,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
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();
throw new Exception("Failed to apply properties");
}
Map<String, Object> properties = new HashMap<>();
@@ -169,7 +163,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
private void dispatchEvent(BarcodeReadEvent barcodeReadEvent)
{
mContext.runOnUiThread(() -> {
// mContext.runOnUiThread(() -> {
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
.setByteValue(barcodeReadEvent.getBarcodeData().getBytes())
@@ -178,6 +172,6 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
.setName(HoneywellBarcodeTypeMapper.map(barcodeReadEvent.getCodeId()).toString());
mOnScanSuccessfull.run(barcodeScanDTO);
});
// });
}
}