Skip to content

Commit

Permalink
fix(camera): fix camera source on Android (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
imhoffd authored Dec 28, 2020
1 parent 8ba0525 commit e67f7c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ public void getPhoto(PluginCall call) {

private void doShow(PluginCall call) {
switch (settings.getSource()) {
case camera:
case CAMERA:
showCamera(call);
break;
case photos:
case PHOTOS:
showPhotos(call);
break;
default:
Expand All @@ -111,10 +111,10 @@ private void showPrompt(final PluginCall call) {
options,
index -> {
if (index == 0) {
settings.setSource(CameraSource.photos);
settings.setSource(CameraSource.PHOTOS);
openPhotos(call);
} else if (index == 1) {
settings.setSource(CameraSource.camera);
settings.setSource(CameraSource.CAMERA);
openCamera(call);
}
},
Expand Down Expand Up @@ -189,9 +189,9 @@ private CameraSettings getSettings(PluginCall call) {
settings.setShouldResize(settings.getWidth() > 0 || settings.getHeight() > 0);
settings.setShouldCorrectOrientation(call.getBoolean("correctOrientation", CameraSettings.DEFAULT_CORRECT_ORIENTATION));
try {
settings.setSource(CameraSource.valueOf(call.getString("source", CameraSource.prompt.getSource())));
settings.setSource(CameraSource.valueOf(call.getString("source", CameraSource.PROMPT.getSource())));
} catch (IllegalArgumentException ex) {
settings.setSource(CameraSource.prompt);
settings.setSource(CameraSource.PROMPT);
}
return settings;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class CameraSettings {
private boolean allowEditing = false;
private int width = 0;
private int height = 0;
private CameraSource source = CameraSource.prompt;
private CameraSource source = CameraSource.PROMPT;

public CameraResultType getResultType() {
return resultType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.capacitorjs.plugins.camera;

public enum CameraSource {
prompt("prompt"),
camera("camera"),
photos("photos");
PROMPT("PROMPT"),
CAMERA("CAMERA"),
PHOTOS("PHOTOS");

private String source;

Expand Down

0 comments on commit e67f7c6

Please sign in to comment.