[SAPORI VERI]
- libreria scanner in emulazione di tastiera - nuova libreria dinamica per sapori veri per gestire gli ordini d'acquisto dai punti vendita
This commit is contained in:
1
barcode_base_android_library/.gitignore
vendored
Normal file
1
barcode_base_android_library/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
33
barcode_base_android_library/build.gradle
Normal file
33
barcode_base_android_library/build.gradle
Normal file
@@ -0,0 +1,33 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
}
|
||||
0
barcode_base_android_library/consumer-rules.pro
Normal file
0
barcode_base_android_library/consumer-rules.pro
Normal file
21
barcode_base_android_library/proguard-rules.pro
vendored
Normal file
21
barcode_base_android_library/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.barcode_base_android_library;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
|
||||
assertEquals("it.integry.barcode_base_android_library.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="it.integry.barcode_base_android_library" />
|
||||
@@ -0,0 +1,9 @@
|
||||
package it.integry.barcode_base_android_library.exception;
|
||||
|
||||
public class BarcodeAdapterNotFoundException extends Exception {
|
||||
|
||||
public BarcodeAdapterNotFoundException(String adapterName) {
|
||||
super("L'adapter " + adapterName + " non è stato rilevato sul dispositivo corrente");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.integry.barcode_base_android_library.extension;
|
||||
|
||||
public interface RunnableArgs<T> {
|
||||
|
||||
void run(T data);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.barcode_base_android_library.interfaces;
|
||||
|
||||
|
||||
import android.view.KeyEvent;
|
||||
|
||||
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;
|
||||
|
||||
public interface BarcodeReaderInterface {
|
||||
|
||||
boolean isRightAdapter();
|
||||
|
||||
void init(Runnable onDeviceReady) throws BarcodeAdapterNotFoundException;
|
||||
|
||||
void deinit();
|
||||
|
||||
void register(RunnableArgs<BarcodeScanDTO> onScanSuccessfull, RunnableArgs<Exception> onScanFailed);
|
||||
|
||||
String getAdapterName();
|
||||
|
||||
void onKeyEvent(KeyEvent keyEvent);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package it.integry.barcode_base_android_library.model;
|
||||
|
||||
public class BarcodeScanDTO {
|
||||
|
||||
private BarcodeType type;
|
||||
private String stringValue;
|
||||
private byte[] byteValue;
|
||||
private String name;
|
||||
private int decodingTime;
|
||||
|
||||
public BarcodeType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setType(BarcodeType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getStringValue() {
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setStringValue(String stringValue) {
|
||||
this.stringValue = stringValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public byte[] getByteValue() {
|
||||
return byteValue;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setByteValue(byte[] byteValue) {
|
||||
this.byteValue = byteValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDecodingTime() {
|
||||
return decodingTime;
|
||||
}
|
||||
|
||||
public BarcodeScanDTO setDecodingTime(int decodingTime) {
|
||||
this.decodingTime = decodingTime;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package it.integry.barcode_base_android_library.model;
|
||||
|
||||
public enum BarcodeType {
|
||||
|
||||
NIL(0),
|
||||
AIRLINE_2OF5_13_DIGIT(1),
|
||||
AIRLINE_2OF5_15_DIGIT(2),
|
||||
AZTEC(3),
|
||||
AUSTRALIAN_POSTAL(4),
|
||||
BOOKLAND_EAN(5),
|
||||
BPO(6),
|
||||
CANPOST(7),
|
||||
CHINAPOST(8),
|
||||
CHINESE_2OF5(9),
|
||||
CODABAR(10),
|
||||
CODABLOCK(11),
|
||||
CODE11(12),
|
||||
CODE128(13),
|
||||
CODE16K(14),
|
||||
CODE32(15),
|
||||
CODE39(16),
|
||||
CODE49(17),
|
||||
CODE93(18),
|
||||
COMPOSITE(19),
|
||||
COUPON_CODE(20),
|
||||
DATAMATRIX(21),
|
||||
DISCRETE_2OF5(22),
|
||||
DUTCH_POSTAL(23),
|
||||
EAN128(24),
|
||||
EAN13(25),
|
||||
EAN8(26),
|
||||
GS1_DATABAR_14(27),
|
||||
GS1_DATABAR_EXPANDED(28),
|
||||
GS1_DATABAR_LIMITED(29),
|
||||
HONGKONG_2OF5(30),
|
||||
IATA_2OF5(31),
|
||||
IDTAG(32),
|
||||
INTERLEAVED_2OF5(33),
|
||||
ISBT128(34),
|
||||
JAPANESE_POSTAL(35),
|
||||
KOREAN_POSTAL(36),
|
||||
MATRIX_2OF5(37),
|
||||
MAXICODE(38),
|
||||
MESA(39),
|
||||
MICRO_PDF417(40),
|
||||
MICRO_QR(41),
|
||||
MSI(42),
|
||||
NEC_2OF5(43),
|
||||
OCR(44),
|
||||
PDF417(45),
|
||||
PLESSEY(46),
|
||||
POSICODE(47),
|
||||
POST_US4(48),
|
||||
QR(49),
|
||||
STRAIGHT_2OF5(50),
|
||||
STANDARD_2OF5(51),
|
||||
TELEPEN(52),
|
||||
TLCODE39(53),
|
||||
TRIOPTIC(54),
|
||||
UK_POSTAL(55),
|
||||
UPCA(56),
|
||||
UPCE(57),
|
||||
UPCE1(58),
|
||||
US_PLANET(59),
|
||||
US_POSTNET(60),
|
||||
USPS_4CB(61),
|
||||
RSS(62),
|
||||
LABEL(63),
|
||||
HANXIN(64),
|
||||
GRIDMATRIX(65),
|
||||
INFO_MAIL(66),
|
||||
INTELLIGENT_MAIL(67),
|
||||
SWEDENPOST(68),
|
||||
LAST(69);
|
||||
|
||||
private Integer text;
|
||||
BarcodeType(Integer text) {
|
||||
this.text = text;
|
||||
}
|
||||
public Integer getValue() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public static BarcodeType fromInt(Integer text) {
|
||||
for (BarcodeType b : BarcodeType.values()) {
|
||||
if (b.text.equals(text)) return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">barcode_base_android_library</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,17 @@
|
||||
package it.integry.barcode_base_android_library;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user