Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
feat(mixed): add support for android
Browse files Browse the repository at this point in the history
  • Loading branch information
hossamnasser938 authored and Johan-dutoit committed Aug 29, 2019
1 parent 6773736 commit 454fff3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions android/src/main/java/com/imagepicker/ImagePickerModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public class ImagePickerModule extends ReactContextBaseJavaModule
protected Uri cameraCaptureURI;
private Boolean noData = false;
private Boolean pickVideo = false;
private Boolean pickBoth = false;
private ImageConfig imageConfig = new ImageConfig(null, null, 0, 0, 100, 0, false);

@Deprecated
Expand Down Expand Up @@ -347,6 +348,11 @@ public void launchImageLibrary(final ReadableMap options, final Callback callbac
requestCode = REQUEST_LAUNCH_IMAGE_LIBRARY;
libraryIntent = new Intent(Intent.ACTION_PICK,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

if (pickBoth)
{
libraryIntent.setType("image/* video/*");
}
}

if (libraryIntent.resolveActivity(reactContext.getPackageManager()) == null)
Expand Down Expand Up @@ -726,6 +732,10 @@ private void parseOptions(final ReadableMap options) {
}
imageConfig = imageConfig.updateFromOptions(options);
pickVideo = false;
pickBoth = false;
if (options.hasKey("mediaType") && options.getString("mediaType").equals("mixed")) {
pickBoth = true;
}
if (options.hasKey("mediaType") && options.getString("mediaType").equals("video")) {
pickVideo = true;
}
Expand Down

0 comments on commit 454fff3

Please sign in to comment.