expo-camera 12.0.2 → 12.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -2
- package/README.md +1 -1
- package/android/build.gradle +22 -19
- package/android/src/main/java/expo/modules/camera/CameraModule.kt +217 -0
- package/android/src/main/java/expo/modules/camera/CameraPackage.kt +10 -0
- package/android/src/main/java/expo/modules/camera/CameraViewHelper.kt +139 -0
- package/android/src/main/java/expo/modules/camera/CameraViewManager.kt +116 -0
- package/android/src/main/java/expo/modules/camera/Constants.kt +184 -0
- package/android/src/main/java/expo/modules/camera/ExpoCameraView.kt +329 -0
- package/android/src/main/java/expo/modules/camera/events/BarCodeScannedEvent.kt +50 -0
- package/android/src/main/java/expo/modules/camera/events/CameraMountErrorEvent.kt +33 -0
- package/android/src/main/java/expo/modules/camera/events/CameraReadyEvent.kt +23 -0
- package/android/src/main/java/expo/modules/camera/events/FaceDetectionErrorEvent.kt +39 -0
- package/android/src/main/java/expo/modules/camera/events/FacesDetectedEvent.kt +46 -0
- package/android/src/main/java/expo/modules/camera/events/PictureSavedEvent.kt +41 -0
- package/android/src/main/java/expo/modules/camera/tasks/BarCodeScannerAsyncTask.kt +26 -0
- package/android/src/main/java/expo/modules/camera/tasks/BarCodeScannerAsyncTaskDelegate.kt +8 -0
- package/android/src/main/java/expo/modules/camera/tasks/FaceDetectorAsyncTaskDelegate.kt +10 -0
- package/android/src/main/java/expo/modules/camera/tasks/FaceDetectorTask.kt +34 -0
- package/android/src/main/java/expo/modules/camera/tasks/PictureSavedDelegate.kt +7 -0
- package/android/src/main/java/expo/modules/camera/tasks/ResolveTakenPictureAsyncTask.kt +231 -0
- package/android/src/main/java/expo/modules/camera/utils/FileSystemUtils.kt +23 -0
- package/android/src/main/java/expo/modules/camera/utils/ImageDimensions.kt +14 -0
- package/build/ExponentCameraManager.web.js +3 -1
- package/build/ExponentCameraManager.web.js.map +1 -1
- package/ios/EXCamera.xcframework/ios-arm64/EXCamera.framework/EXCamera +0 -0
- package/ios/EXCamera.xcframework/ios-arm64/EXCamera.framework/Info.plist +0 -0
- package/ios/EXCamera.xcframework/ios-arm64_x86_64-simulator/EXCamera.framework/EXCamera +0 -0
- package/ios/EXCamera.xcframework/ios-arm64_x86_64-simulator/EXCamera.framework/Info.plist +0 -0
- package/package.json +7 -5
- package/plugin/build/withCamera.d.ts +2 -1
- package/plugin/build/withCamera.js +50 -30
- package/plugin/src/withCamera.ts +66 -27
- package/src/ExponentCameraManager.web.ts +3 -2
- package/src/{types → ts-declarations}/image-capture.d.ts +0 -0
- package/src/ts-declarations/lib.dom.d.ts +34 -0
- package/android/src/main/java/expo/modules/camera/CameraModule.java +0 -359
- package/android/src/main/java/expo/modules/camera/CameraPackage.java +0 -23
- package/android/src/main/java/expo/modules/camera/CameraViewHelper.java +0 -294
- package/android/src/main/java/expo/modules/camera/CameraViewManager.java +0 -142
- package/android/src/main/java/expo/modules/camera/ExpoCameraView.java +0 -376
- package/android/src/main/java/expo/modules/camera/events/BarCodeScannedEvent.java +0 -59
- package/android/src/main/java/expo/modules/camera/events/CameraMountErrorEvent.java +0 -38
- package/android/src/main/java/expo/modules/camera/events/CameraReadyEvent.java +0 -30
- package/android/src/main/java/expo/modules/camera/events/FaceDetectionErrorEvent.java +0 -50
- package/android/src/main/java/expo/modules/camera/events/FacesDetectedEvent.java +0 -63
- package/android/src/main/java/expo/modules/camera/events/PictureSavedEvent.java +0 -53
- package/android/src/main/java/expo/modules/camera/tasks/BarCodeScannerAsyncTask.java +0 -47
- package/android/src/main/java/expo/modules/camera/tasks/BarCodeScannerAsyncTaskDelegate.java +0 -8
- package/android/src/main/java/expo/modules/camera/tasks/FaceDetectorAsyncTaskDelegate.java +0 -13
- package/android/src/main/java/expo/modules/camera/tasks/FaceDetectorTask.java +0 -53
- package/android/src/main/java/expo/modules/camera/tasks/PictureSavedDelegate.java +0 -7
- package/android/src/main/java/expo/modules/camera/tasks/ResolveTakenPictureAsyncTask.java +0 -288
- package/android/src/main/java/expo/modules/camera/utils/FileSystemUtils.java +0 -21
- package/android/src/main/java/expo/modules/camera/utils/ImageDimensions.java +0 -64
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
package expo.modules.camera;
|
|
2
|
-
|
|
3
|
-
import android.graphics.Bitmap;
|
|
4
|
-
import android.graphics.Canvas;
|
|
5
|
-
import android.graphics.Color;
|
|
6
|
-
import android.graphics.Paint;
|
|
7
|
-
import android.media.CamcorderProfile;
|
|
8
|
-
import android.os.Bundle;
|
|
9
|
-
import androidx.exifinterface.media.ExifInterface;
|
|
10
|
-
import android.view.ViewGroup;
|
|
11
|
-
|
|
12
|
-
import com.google.android.cameraview.CameraView;
|
|
13
|
-
|
|
14
|
-
import java.io.IOException;
|
|
15
|
-
import java.text.SimpleDateFormat;
|
|
16
|
-
import java.util.Calendar;
|
|
17
|
-
import java.util.List;
|
|
18
|
-
import java.util.Locale;
|
|
19
|
-
|
|
20
|
-
import expo.modules.core.interfaces.services.EventEmitter;
|
|
21
|
-
import expo.modules.camera.events.BarCodeScannedEvent;
|
|
22
|
-
import expo.modules.camera.events.CameraMountErrorEvent;
|
|
23
|
-
import expo.modules.camera.events.CameraReadyEvent;
|
|
24
|
-
import expo.modules.camera.events.FaceDetectionErrorEvent;
|
|
25
|
-
import expo.modules.camera.events.FacesDetectedEvent;
|
|
26
|
-
import expo.modules.camera.events.PictureSavedEvent;
|
|
27
|
-
import expo.modules.interfaces.barcodescanner.BarCodeScannerResult;
|
|
28
|
-
import expo.modules.interfaces.facedetector.FaceDetectorInterface;
|
|
29
|
-
|
|
30
|
-
public class CameraViewHelper {
|
|
31
|
-
// Mount error event
|
|
32
|
-
|
|
33
|
-
public static void emitMountErrorEvent(EventEmitter emitter, ViewGroup view, String message) {
|
|
34
|
-
CameraMountErrorEvent event = CameraMountErrorEvent.obtain(message);
|
|
35
|
-
emitter.emit(view.getId(), event);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Camera ready event
|
|
39
|
-
|
|
40
|
-
public static void emitCameraReadyEvent(EventEmitter emitter, ViewGroup view) {
|
|
41
|
-
CameraReadyEvent event = CameraReadyEvent.obtain();
|
|
42
|
-
emitter.emit(view.getId(), event);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Bar code read event
|
|
46
|
-
|
|
47
|
-
public static void emitBarCodeReadEvent(EventEmitter emitter, ViewGroup view, BarCodeScannerResult barCode) {
|
|
48
|
-
BarCodeScannedEvent event = BarCodeScannedEvent.obtain(view.getId(), barCode);
|
|
49
|
-
emitter.emit(view.getId(), event);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Face detection events
|
|
53
|
-
|
|
54
|
-
public static void emitFacesDetectedEvent(EventEmitter emitter, ViewGroup view, List<Bundle> faces) {
|
|
55
|
-
FacesDetectedEvent event = FacesDetectedEvent.obtain(view.getId(), faces);
|
|
56
|
-
emitter.emit(view.getId(), event);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public static void emitFaceDetectionErrorEvent(EventEmitter emitter, ViewGroup view, FaceDetectorInterface faceDetector) {
|
|
60
|
-
FaceDetectionErrorEvent event = FaceDetectionErrorEvent.obtain(faceDetector);
|
|
61
|
-
emitter.emit(view.getId(), event);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Picture saved
|
|
65
|
-
|
|
66
|
-
public static void emitPictureSavedEvent(EventEmitter emitter, ViewGroup view, Bundle info) {
|
|
67
|
-
PictureSavedEvent event = PictureSavedEvent.obtain(info);
|
|
68
|
-
emitter.emit(view.getId(), event);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Utilities
|
|
72
|
-
|
|
73
|
-
public static int getCorrectCameraRotation(int rotation, int facing) {
|
|
74
|
-
if (facing == CameraView.FACING_FRONT) {
|
|
75
|
-
return (rotation - 90 + 360) % 360;
|
|
76
|
-
} else {
|
|
77
|
-
return (-rotation + 90 + 360) % 360;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public static CamcorderProfile getCamcorderProfile(int cameraId, int quality) {
|
|
82
|
-
CamcorderProfile profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_HIGH);
|
|
83
|
-
switch (quality) {
|
|
84
|
-
case CameraModule.VIDEO_2160P:
|
|
85
|
-
profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_2160P);
|
|
86
|
-
break;
|
|
87
|
-
case CameraModule.VIDEO_1080P:
|
|
88
|
-
profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_1080P);
|
|
89
|
-
break;
|
|
90
|
-
case CameraModule.VIDEO_720P:
|
|
91
|
-
profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_720P);
|
|
92
|
-
break;
|
|
93
|
-
case CameraModule.VIDEO_480P:
|
|
94
|
-
profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_480P);
|
|
95
|
-
break;
|
|
96
|
-
case CameraModule.VIDEO_4x3:
|
|
97
|
-
profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_480P);
|
|
98
|
-
profile.videoFrameWidth = 640;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
return profile;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public static Bundle getExifData(ExifInterface exifInterface) {
|
|
105
|
-
Bundle exifMap = new Bundle();
|
|
106
|
-
for (String[] tagInfo : CameraViewHelper.exifTags) {
|
|
107
|
-
String name = tagInfo[1];
|
|
108
|
-
if (exifInterface.getAttribute(name) != null) {
|
|
109
|
-
String type = tagInfo[0];
|
|
110
|
-
switch (type) {
|
|
111
|
-
case "string":
|
|
112
|
-
exifMap.putString(name, exifInterface.getAttribute(name));
|
|
113
|
-
break;
|
|
114
|
-
case "int":
|
|
115
|
-
exifMap.putInt(name, exifInterface.getAttributeInt(name, 0));
|
|
116
|
-
break;
|
|
117
|
-
case "double":
|
|
118
|
-
exifMap.putDouble(name, exifInterface.getAttributeDouble(name, 0));
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
double[] latLong = exifInterface.getLatLong();
|
|
125
|
-
if (latLong != null) {
|
|
126
|
-
exifMap.putDouble(ExifInterface.TAG_GPS_LATITUDE, latLong[0]);
|
|
127
|
-
exifMap.putDouble(ExifInterface.TAG_GPS_LONGITUDE, latLong[1]);
|
|
128
|
-
exifMap.putDouble(ExifInterface.TAG_GPS_ALTITUDE, exifInterface.getAltitude(0));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return exifMap;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public static void addExifData(ExifInterface baseExif, ExifInterface additionalExif) throws IOException {
|
|
135
|
-
for (String[] tagInfo : CameraViewHelper.exifTags) {
|
|
136
|
-
String name = tagInfo[1];
|
|
137
|
-
String value = additionalExif.getAttribute(name);
|
|
138
|
-
if (value != null) {
|
|
139
|
-
baseExif.setAttribute(name, value);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
baseExif.saveAttributes();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
public static Bitmap generateSimulatorPhoto(int width, int height) {
|
|
146
|
-
Bitmap fakePhoto = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
|
147
|
-
Canvas canvas = new Canvas(fakePhoto);
|
|
148
|
-
Paint background = new Paint();
|
|
149
|
-
background.setColor(Color.BLACK);
|
|
150
|
-
canvas.drawRect(0, 0, width, height, background);
|
|
151
|
-
Paint textPaint = new Paint();
|
|
152
|
-
textPaint.setColor(Color.YELLOW);
|
|
153
|
-
textPaint.setTextSize(35);
|
|
154
|
-
Calendar calendar = Calendar.getInstance();
|
|
155
|
-
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yy HH:mm:ss", Locale.US);
|
|
156
|
-
canvas.drawText(simpleDateFormat.format(calendar.getTime()), width * 0.1f, height * 0.9f, textPaint);
|
|
157
|
-
return fakePhoto;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// TODO: Copied from ImagePickerModule
|
|
161
|
-
// We need to explicitly get latitude, longitude, altitude with their specific accessor functions
|
|
162
|
-
// separately so we skip them in this list.
|
|
163
|
-
private static final String[][] exifTags = new String[][]{
|
|
164
|
-
{"string", ExifInterface.TAG_ARTIST},
|
|
165
|
-
{"int", ExifInterface.TAG_BITS_PER_SAMPLE},
|
|
166
|
-
{"int", ExifInterface.TAG_COMPRESSION},
|
|
167
|
-
{"string", ExifInterface.TAG_COPYRIGHT},
|
|
168
|
-
{"string", ExifInterface.TAG_DATETIME},
|
|
169
|
-
{"string", ExifInterface.TAG_IMAGE_DESCRIPTION},
|
|
170
|
-
{"int", ExifInterface.TAG_IMAGE_LENGTH},
|
|
171
|
-
{"int", ExifInterface.TAG_IMAGE_WIDTH},
|
|
172
|
-
{"int", ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT},
|
|
173
|
-
{"int", ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH},
|
|
174
|
-
{"string", ExifInterface.TAG_MAKE},
|
|
175
|
-
{"string", ExifInterface.TAG_MODEL},
|
|
176
|
-
{"int", ExifInterface.TAG_ORIENTATION},
|
|
177
|
-
{"int", ExifInterface.TAG_PHOTOMETRIC_INTERPRETATION},
|
|
178
|
-
{"int", ExifInterface.TAG_PLANAR_CONFIGURATION},
|
|
179
|
-
{"double", ExifInterface.TAG_PRIMARY_CHROMATICITIES},
|
|
180
|
-
{"double", ExifInterface.TAG_REFERENCE_BLACK_WHITE},
|
|
181
|
-
{"int", ExifInterface.TAG_RESOLUTION_UNIT},
|
|
182
|
-
{"int", ExifInterface.TAG_ROWS_PER_STRIP},
|
|
183
|
-
{"int", ExifInterface.TAG_SAMPLES_PER_PIXEL},
|
|
184
|
-
{"string", ExifInterface.TAG_SOFTWARE},
|
|
185
|
-
{"int", ExifInterface.TAG_STRIP_BYTE_COUNTS},
|
|
186
|
-
{"int", ExifInterface.TAG_STRIP_OFFSETS},
|
|
187
|
-
{"int", ExifInterface.TAG_TRANSFER_FUNCTION},
|
|
188
|
-
{"double", ExifInterface.TAG_WHITE_POINT},
|
|
189
|
-
{"double", ExifInterface.TAG_X_RESOLUTION},
|
|
190
|
-
{"double", ExifInterface.TAG_Y_CB_CR_COEFFICIENTS},
|
|
191
|
-
{"int", ExifInterface.TAG_Y_CB_CR_POSITIONING},
|
|
192
|
-
{"int", ExifInterface.TAG_Y_CB_CR_SUB_SAMPLING},
|
|
193
|
-
{"double", ExifInterface.TAG_Y_RESOLUTION},
|
|
194
|
-
{"double", ExifInterface.TAG_APERTURE_VALUE},
|
|
195
|
-
{"double", ExifInterface.TAG_BRIGHTNESS_VALUE},
|
|
196
|
-
{"string", ExifInterface.TAG_CFA_PATTERN},
|
|
197
|
-
{"int", ExifInterface.TAG_COLOR_SPACE},
|
|
198
|
-
{"string", ExifInterface.TAG_COMPONENTS_CONFIGURATION},
|
|
199
|
-
{"double", ExifInterface.TAG_COMPRESSED_BITS_PER_PIXEL},
|
|
200
|
-
{"int", ExifInterface.TAG_CONTRAST},
|
|
201
|
-
{"int", ExifInterface.TAG_CUSTOM_RENDERED},
|
|
202
|
-
{"string", ExifInterface.TAG_DATETIME_DIGITIZED},
|
|
203
|
-
{"string", ExifInterface.TAG_DATETIME_ORIGINAL},
|
|
204
|
-
{"string", ExifInterface.TAG_DEVICE_SETTING_DESCRIPTION},
|
|
205
|
-
{"double", ExifInterface.TAG_DIGITAL_ZOOM_RATIO},
|
|
206
|
-
{"string", ExifInterface.TAG_EXIF_VERSION},
|
|
207
|
-
{"double", ExifInterface.TAG_EXPOSURE_BIAS_VALUE},
|
|
208
|
-
{"double", ExifInterface.TAG_EXPOSURE_INDEX},
|
|
209
|
-
{"int", ExifInterface.TAG_EXPOSURE_MODE},
|
|
210
|
-
{"int", ExifInterface.TAG_EXPOSURE_PROGRAM},
|
|
211
|
-
{"double", ExifInterface.TAG_EXPOSURE_TIME},
|
|
212
|
-
{"double", ExifInterface.TAG_F_NUMBER},
|
|
213
|
-
{"string", ExifInterface.TAG_FILE_SOURCE},
|
|
214
|
-
{"int", ExifInterface.TAG_FLASH},
|
|
215
|
-
{"double", ExifInterface.TAG_FLASH_ENERGY},
|
|
216
|
-
{"string", ExifInterface.TAG_FLASHPIX_VERSION},
|
|
217
|
-
{"double", ExifInterface.TAG_FOCAL_LENGTH},
|
|
218
|
-
{"int", ExifInterface.TAG_FOCAL_LENGTH_IN_35MM_FILM},
|
|
219
|
-
{"int", ExifInterface.TAG_FOCAL_PLANE_RESOLUTION_UNIT},
|
|
220
|
-
{"double", ExifInterface.TAG_FOCAL_PLANE_X_RESOLUTION},
|
|
221
|
-
{"double", ExifInterface.TAG_FOCAL_PLANE_Y_RESOLUTION},
|
|
222
|
-
{"int", ExifInterface.TAG_GAIN_CONTROL},
|
|
223
|
-
{"int", ExifInterface.TAG_ISO_SPEED_RATINGS},
|
|
224
|
-
{"string", ExifInterface.TAG_IMAGE_UNIQUE_ID},
|
|
225
|
-
{"int", ExifInterface.TAG_LIGHT_SOURCE},
|
|
226
|
-
{"string", ExifInterface.TAG_MAKER_NOTE},
|
|
227
|
-
{"double", ExifInterface.TAG_MAX_APERTURE_VALUE},
|
|
228
|
-
{"int", ExifInterface.TAG_METERING_MODE},
|
|
229
|
-
{"int", ExifInterface.TAG_NEW_SUBFILE_TYPE},
|
|
230
|
-
{"string", ExifInterface.TAG_OECF},
|
|
231
|
-
{"int", ExifInterface.TAG_PIXEL_X_DIMENSION},
|
|
232
|
-
{"int", ExifInterface.TAG_PIXEL_Y_DIMENSION},
|
|
233
|
-
{"string", ExifInterface.TAG_RELATED_SOUND_FILE},
|
|
234
|
-
{"int", ExifInterface.TAG_SATURATION},
|
|
235
|
-
{"int", ExifInterface.TAG_SCENE_CAPTURE_TYPE},
|
|
236
|
-
{"string", ExifInterface.TAG_SCENE_TYPE},
|
|
237
|
-
{"int", ExifInterface.TAG_SENSING_METHOD},
|
|
238
|
-
{"int", ExifInterface.TAG_SHARPNESS},
|
|
239
|
-
{"double", ExifInterface.TAG_SHUTTER_SPEED_VALUE},
|
|
240
|
-
{"string", ExifInterface.TAG_SPATIAL_FREQUENCY_RESPONSE},
|
|
241
|
-
{"string", ExifInterface.TAG_SPECTRAL_SENSITIVITY},
|
|
242
|
-
{"int", ExifInterface.TAG_SUBFILE_TYPE},
|
|
243
|
-
{"string", ExifInterface.TAG_SUBSEC_TIME},
|
|
244
|
-
{"string", ExifInterface.TAG_SUBSEC_TIME_DIGITIZED},
|
|
245
|
-
{"string", ExifInterface.TAG_SUBSEC_TIME_ORIGINAL},
|
|
246
|
-
{"int", ExifInterface.TAG_SUBJECT_AREA},
|
|
247
|
-
{"double", ExifInterface.TAG_SUBJECT_DISTANCE},
|
|
248
|
-
{"int", ExifInterface.TAG_SUBJECT_DISTANCE_RANGE},
|
|
249
|
-
{"int", ExifInterface.TAG_SUBJECT_LOCATION},
|
|
250
|
-
{"string", ExifInterface.TAG_USER_COMMENT},
|
|
251
|
-
{"int", ExifInterface.TAG_WHITE_BALANCE},
|
|
252
|
-
{"int", ExifInterface.TAG_GPS_ALTITUDE_REF},
|
|
253
|
-
{"string", ExifInterface.TAG_GPS_AREA_INFORMATION},
|
|
254
|
-
{"double", ExifInterface.TAG_GPS_DOP},
|
|
255
|
-
{"string", ExifInterface.TAG_GPS_DATESTAMP},
|
|
256
|
-
{"double", ExifInterface.TAG_GPS_DEST_BEARING},
|
|
257
|
-
{"string", ExifInterface.TAG_GPS_DEST_BEARING_REF},
|
|
258
|
-
{"double", ExifInterface.TAG_GPS_DEST_DISTANCE},
|
|
259
|
-
{"string", ExifInterface.TAG_GPS_DEST_DISTANCE_REF},
|
|
260
|
-
{"double", ExifInterface.TAG_GPS_DEST_LATITUDE},
|
|
261
|
-
{"string", ExifInterface.TAG_GPS_DEST_LATITUDE_REF},
|
|
262
|
-
{"double", ExifInterface.TAG_GPS_DEST_LONGITUDE},
|
|
263
|
-
{"string", ExifInterface.TAG_GPS_DEST_LONGITUDE_REF},
|
|
264
|
-
{"int", ExifInterface.TAG_GPS_DIFFERENTIAL},
|
|
265
|
-
{"double", ExifInterface.TAG_GPS_IMG_DIRECTION},
|
|
266
|
-
{"string", ExifInterface.TAG_GPS_IMG_DIRECTION_REF},
|
|
267
|
-
{"string", ExifInterface.TAG_GPS_LATITUDE_REF},
|
|
268
|
-
{"string", ExifInterface.TAG_GPS_LONGITUDE_REF},
|
|
269
|
-
{"string", ExifInterface.TAG_GPS_MAP_DATUM},
|
|
270
|
-
{"string", ExifInterface.TAG_GPS_MEASURE_MODE},
|
|
271
|
-
{"string", ExifInterface.TAG_GPS_PROCESSING_METHOD},
|
|
272
|
-
{"string", ExifInterface.TAG_GPS_SATELLITES},
|
|
273
|
-
{"double", ExifInterface.TAG_GPS_SPEED},
|
|
274
|
-
{"string", ExifInterface.TAG_GPS_SPEED_REF},
|
|
275
|
-
{"string", ExifInterface.TAG_GPS_STATUS},
|
|
276
|
-
{"string", ExifInterface.TAG_GPS_TIMESTAMP},
|
|
277
|
-
{"double", ExifInterface.TAG_GPS_TRACK},
|
|
278
|
-
{"string", ExifInterface.TAG_GPS_TRACK_REF},
|
|
279
|
-
{"string", ExifInterface.TAG_GPS_VERSION_ID},
|
|
280
|
-
{"string", ExifInterface.TAG_INTEROPERABILITY_INDEX},
|
|
281
|
-
{"int", ExifInterface.TAG_THUMBNAIL_IMAGE_LENGTH},
|
|
282
|
-
{"int", ExifInterface.TAG_THUMBNAIL_IMAGE_WIDTH},
|
|
283
|
-
{"int", ExifInterface.TAG_DNG_VERSION},
|
|
284
|
-
{"int", ExifInterface.TAG_DEFAULT_CROP_SIZE},
|
|
285
|
-
{"int", ExifInterface.TAG_ORF_PREVIEW_IMAGE_START},
|
|
286
|
-
{"int", ExifInterface.TAG_ORF_PREVIEW_IMAGE_LENGTH},
|
|
287
|
-
{"int", ExifInterface.TAG_ORF_ASPECT_FRAME},
|
|
288
|
-
{"int", ExifInterface.TAG_RW2_SENSOR_BOTTOM_BORDER},
|
|
289
|
-
{"int", ExifInterface.TAG_RW2_SENSOR_LEFT_BORDER},
|
|
290
|
-
{"int", ExifInterface.TAG_RW2_SENSOR_RIGHT_BORDER},
|
|
291
|
-
{"int", ExifInterface.TAG_RW2_SENSOR_TOP_BORDER},
|
|
292
|
-
{"int", ExifInterface.TAG_RW2_ISO},
|
|
293
|
-
};
|
|
294
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
package expo.modules.camera;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
|
|
5
|
-
import com.google.android.cameraview.AspectRatio;
|
|
6
|
-
import com.google.android.cameraview.Size;
|
|
7
|
-
|
|
8
|
-
import java.util.ArrayList;
|
|
9
|
-
import java.util.List;
|
|
10
|
-
import java.util.Map;
|
|
11
|
-
|
|
12
|
-
import expo.modules.core.ViewManager;
|
|
13
|
-
import expo.modules.core.interfaces.ExpoProp;
|
|
14
|
-
import expo.modules.core.ModuleRegistry;
|
|
15
|
-
import expo.modules.core.interfaces.services.UIManager;
|
|
16
|
-
|
|
17
|
-
import expo.modules.interfaces.barcodescanner.BarCodeScannerSettings;
|
|
18
|
-
|
|
19
|
-
public class CameraViewManager extends ViewManager<ExpoCameraView> {
|
|
20
|
-
public enum Events {
|
|
21
|
-
EVENT_CAMERA_READY("onCameraReady"),
|
|
22
|
-
EVENT_ON_MOUNT_ERROR("onMountError"),
|
|
23
|
-
EVENT_ON_BAR_CODE_SCANNED("onBarCodeScanned"),
|
|
24
|
-
EVENT_ON_FACES_DETECTED("onFacesDetected"),
|
|
25
|
-
EVENT_ON_FACE_DETECTION_ERROR("onFaceDetectionError"),
|
|
26
|
-
EVENT_ON_PICTURE_SAVED("onPictureSaved");
|
|
27
|
-
|
|
28
|
-
private final String mName;
|
|
29
|
-
|
|
30
|
-
Events(final String name) {
|
|
31
|
-
mName = name;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@Override
|
|
35
|
-
public String toString() {
|
|
36
|
-
return mName;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
private static final String REACT_CLASS = "ExponentCamera";
|
|
41
|
-
private ModuleRegistry mModuleRegistry;
|
|
42
|
-
|
|
43
|
-
@Override
|
|
44
|
-
public void onCreate(ModuleRegistry moduleRegistry) {
|
|
45
|
-
mModuleRegistry = moduleRegistry;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@Override
|
|
49
|
-
public void onDropViewInstance(ExpoCameraView view) {
|
|
50
|
-
mModuleRegistry.getModule(UIManager.class).unregisterLifecycleEventListener(view);
|
|
51
|
-
view.stop();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@Override
|
|
55
|
-
public String getName() {
|
|
56
|
-
return REACT_CLASS;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@Override
|
|
60
|
-
public ViewManagerType getViewManagerType() {
|
|
61
|
-
return ViewManagerType.GROUP;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@Override
|
|
65
|
-
public ExpoCameraView createViewInstance(Context context) {
|
|
66
|
-
return new ExpoCameraView(context, mModuleRegistry);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
@Override
|
|
70
|
-
public List<String> getExportedEventNames() {
|
|
71
|
-
List<String> eventNames = new ArrayList<>(Events.values().length);
|
|
72
|
-
for(Events event : Events.values()) {
|
|
73
|
-
eventNames.add(event.toString());
|
|
74
|
-
}
|
|
75
|
-
return eventNames;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@ExpoProp(name = "type")
|
|
79
|
-
public void setType(ExpoCameraView view, int type) {
|
|
80
|
-
view.setFacing(type);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@ExpoProp(name = "ratio")
|
|
84
|
-
public void setRatio(ExpoCameraView view, String ratio) {
|
|
85
|
-
view.setAspectRatio(AspectRatio.parse(ratio));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
@ExpoProp(name = "flashMode")
|
|
89
|
-
public void setFlashMode(ExpoCameraView view, int torchMode) {
|
|
90
|
-
view.setFlash(torchMode);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
@ExpoProp(name = "autoFocus")
|
|
94
|
-
public void setAutoFocus(ExpoCameraView view, boolean autoFocus) {
|
|
95
|
-
view.setAutoFocus(autoFocus);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@ExpoProp(name = "focusDepth")
|
|
99
|
-
public void setFocusDepth(ExpoCameraView view, float depth) {
|
|
100
|
-
view.setFocusDepth(depth);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
@ExpoProp(name = "zoom")
|
|
104
|
-
public void setZoom(ExpoCameraView view, float zoom) {
|
|
105
|
-
view.setZoom(zoom);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
@ExpoProp(name = "whiteBalance")
|
|
109
|
-
public void setWhiteBalance(ExpoCameraView view, int whiteBalance) {
|
|
110
|
-
view.setWhiteBalance(whiteBalance);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@ExpoProp(name = "pictureSize")
|
|
114
|
-
public void setPictureSize(ExpoCameraView view, String size) {
|
|
115
|
-
view.setPictureSize(Size.parse(size));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
@ExpoProp(name = "barCodeScannerSettings")
|
|
119
|
-
public void setBarCodeScannerSettings(ExpoCameraView view, Map<String, Object> settings) {
|
|
120
|
-
view.setBarCodeScannerSettings(new BarCodeScannerSettings(settings));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
@ExpoProp(name = "useCamera2Api")
|
|
124
|
-
public void setUseCamera2Api(ExpoCameraView view, boolean useCamera2Api) {
|
|
125
|
-
view.setUsingCamera2Api(useCamera2Api);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
@ExpoProp(name = "barCodeScannerEnabled")
|
|
129
|
-
public void setBarCodeScanning(ExpoCameraView view, boolean barCodeScannerEnabled) {
|
|
130
|
-
view.setShouldScanBarCodes(barCodeScannerEnabled);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
@ExpoProp(name = "faceDetectorEnabled")
|
|
134
|
-
public void setFaceDetectorEnabled(ExpoCameraView view, boolean faceDetectorEnabled) {
|
|
135
|
-
view.setShouldDetectFaces(faceDetectorEnabled);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
@ExpoProp(name = "faceDetectorSettings")
|
|
139
|
-
public void setFaceDetectorSettings(ExpoCameraView view, Map<String, Object> settings) {
|
|
140
|
-
view.setFaceDetectorSettings(settings);
|
|
141
|
-
}
|
|
142
|
-
}
|