Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): custom gallery folder names #13961

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public class MediaModule extends KrollModule implements Handler.Callback
private static String mediaType = MEDIA_TYPE_PHOTO;
private static ContentResolver contentResolver;
private boolean useCameraX = false;
private static String imageFolder = "";
private static boolean pathOnly = false;

public MediaModule()
Expand Down Expand Up @@ -698,6 +699,10 @@ public void showCamera(@SuppressWarnings("rawtypes") HashMap options)
useCameraX = cameraOptions.getBoolean("useCameraX");
}

if (cameraOptions.containsKeyAndNotNull("galleryFolder")) {
imageFolder = cameraOptions.getString("galleryFolder");
}

if ((overlay != null) && (overlay instanceof TiViewProxy)) {
if (useCameraX) {
Log.d(TAG, "Use CameraX");
Expand Down Expand Up @@ -1010,6 +1015,10 @@ private static Uri createExternalMediaContentUri(boolean isVideo, boolean isPubl
if (isVideo) {
contentUri = contentResolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, contentValues);
} else {
if (!imageFolder.equals("")) {
contentValues.put(MediaStore.Images.Media.RELATIVE_PATH,
Environment.DIRECTORY_PICTURES + "/" + imageFolder);
}
contentUri = contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
}
} else if (isVideo) {
Expand Down
Loading