feat(android): get format for android (#2410)
This commit is contained in:
parent
1724ec3952
commit
efb6b90036
@ -17,6 +17,7 @@ public class BarcodeFormatUtils {
|
||||
private static final int UNKNOWN_FORMAT_INT = FirebaseVisionBarcode.FORMAT_UNKNOWN;
|
||||
|
||||
private static final String UNKNOWN_TYPE_STRING = "UNKNOWN_TYPE";
|
||||
private static final String UNKNOWN_FORMAT_STRING = "UNKNOWN_FORMAT";
|
||||
|
||||
static {
|
||||
// Initialize integer to string map
|
||||
@ -81,6 +82,9 @@ public class BarcodeFormatUtils {
|
||||
public static String get(int format) {
|
||||
return TYPES.get(format, UNKNOWN_TYPE_STRING);
|
||||
}
|
||||
public static String getFormat(int format) {
|
||||
return FORMATS.get(format, UNKNOWN_FORMAT_STRING);
|
||||
}
|
||||
|
||||
public static int get(String format) {
|
||||
if (REVERSE_FORMATS.containsKey(format)) {
|
||||
|
||||
@ -130,6 +130,7 @@ public class BarcodeDetectorAsyncTask extends android.os.AsyncTask<Void, Void, V
|
||||
String rawValue = barcode.getRawValue();
|
||||
|
||||
int valueType = barcode.getValueType();
|
||||
int valueFormat = barcode.getFormat();
|
||||
|
||||
WritableMap serializedBarcode = Arguments.createMap();
|
||||
|
||||
@ -278,6 +279,7 @@ public class BarcodeDetectorAsyncTask extends android.os.AsyncTask<Void, Void, V
|
||||
serializedBarcode.putString("data", barcode.getDisplayValue());
|
||||
serializedBarcode.putString("dataRaw", rawValue);
|
||||
serializedBarcode.putString("type", BarcodeFormatUtils.get(valueType));
|
||||
serializedBarcode.putString("format", BarcodeFormatUtils.getFormat(valueFormat));
|
||||
serializedBarcode.putMap("bounds", processBounds(bounds));
|
||||
barcodesList.pushMap(serializedBarcode);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user