This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

View File

@ -0,0 +1,57 @@
apply plugin: 'com.android.library'
apply plugin: 'maven'
group = 'org.unimodules'
version = '5.4.0'
// Simple helper that allows the root project to override versions declared by this library.
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
// Upload android library to maven with javadoc and android sources
configurations {
deployerJars
}
// Creating sources with comments
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
// Put the androidSources and javadoc to the artifacts
artifacts {
archives androidSourcesJar
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: mavenLocal().url)
}
}
}
android {
compileSdkVersion safeExtGet("compileSdkVersion", 29)
defaultConfig {
minSdkVersion safeExtGet("minSdkVersion", 21)
targetSdkVersion safeExtGet("targetSdkVersion", 29)
versionCode 14
versionName "5.4.0"
}
lintOptions {
abortOnError false
}
}
if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {
apply from: project(":unimodules-core").file("../unimodules-core.gradle")
} else {
throw new GradleException(
"'unimodules-core.gradle' was not found in the usual React Native dependency location. " +
"This package can only be used in such projects. Are you sure you've installed the dependencies properly?")
}

View File

@ -0,0 +1,5 @@
<manifest package="org.unimodules.interfaces.barcodescanner">
</manifest>

View File

@ -0,0 +1,11 @@
package org.unimodules.interfaces.barcodescanner;
import android.graphics.Bitmap;
import java.util.List;
public interface BarCodeScanner {
BarCodeScannerResult scan(byte[] imageData, int width, int height, int rotation);
List<BarCodeScannerResult> scanMultiple(Bitmap bitmap);
void setSettings(BarCodeScannerSettings settings);
}

View File

@ -0,0 +1,9 @@
package org.unimodules.interfaces.barcodescanner;
import android.content.Context;
import java.util.List;
public interface BarCodeScannerProvider {
BarCodeScanner createBarCodeDetectorWithContext(Context context);
}

View File

@ -0,0 +1,52 @@
package org.unimodules.interfaces.barcodescanner;
import java.util.List;
public class BarCodeScannerResult {
private int mReferenceImageWidth;
private int mReferenceImageHeight;
private int mType;
private String mValue;
private List<Integer> mCornerPoints;
public BarCodeScannerResult(int type, String value, List<Integer> cornerPoints, int height, int width) {
mType = type;
mValue = value;
mCornerPoints = cornerPoints;
mReferenceImageHeight = height;
mReferenceImageWidth = width;
}
public int getType() {
return mType;
}
public String getValue() {
return mValue;
}
public List<Integer> getCornerPoints() {
return mCornerPoints;
}
public void setCornerPoints(List<Integer> points) {
mCornerPoints = points;
}
public int getReferenceImageHeight() {
return mReferenceImageHeight;
}
public void setReferenceImageHeight(int height) {
mReferenceImageHeight = height;
}
public int getReferenceImageWidth() {
return mReferenceImageWidth;
}
public void setReferenceImageWidth(int width) {
mReferenceImageWidth = width;
}
}

View File

@ -0,0 +1,28 @@
package org.unimodules.interfaces.barcodescanner;
import java.util.HashMap;
import java.util.Map;
public class BarCodeScannerSettings extends HashMap<BarCodeScannerSettingsKey, Object> {
public BarCodeScannerSettings() {
super();
}
public BarCodeScannerSettings(Map<String, Object> settings) {
super();
for (Map.Entry<String, Object> entry: settings.entrySet()) {
BarCodeScannerSettingsKey key = BarCodeScannerSettingsKey.fromStringName(entry.getKey());
if (key != null) {
put(key, entry.getValue());
}
}
}
public void putTypes(Object types) {
put(BarCodeScannerSettingsKey.TYPES, types);
}
public Object getTypes() {
return get(BarCodeScannerSettingsKey.TYPES);
}
}

View File

@ -0,0 +1,24 @@
package org.unimodules.interfaces.barcodescanner;
public enum BarCodeScannerSettingsKey {
TYPES("barCodeTypes");
private final String mName;
BarCodeScannerSettingsKey(String stringName) {
mName = stringName;
}
public static BarCodeScannerSettingsKey fromStringName(String name) {
for (BarCodeScannerSettingsKey key: BarCodeScannerSettingsKey.values()) {
if (key.getName().equalsIgnoreCase(name)) {
return key;
}
}
return null;
}
public String getName() {
return mName;
}
}