Skip to content

Fix maxFiles limit for Android image picker #2164

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

Open
wants to merge 1 commit 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 @@ -370,6 +370,34 @@ private void initiateCamera(Activity activity) {
}

private void initiatePicker(final Activity activity) {
try {
if (multiple) {
initiateModernPicker(activity);
} else {
initiateClassicPicker(activity);
}
} catch (Exception e) {
resultCollector.notifyProblem(E_FAILED_TO_SHOW_PICKER, e);
}
}

private void initiateModernPicker(final Activity activity) {
try {
String photoPickerAction = "android.provider.action.PICK_IMAGES";

Intent intent = new Intent(photoPickerAction);

if (maxFiles != Integer.MAX_VALUE) {
intent.putExtra("android.provider.extra.PICK_IMAGES_MAX", maxFiles);
}

activity.startActivityForResult(intent, IMAGE_PICKER_REQUEST);
} catch (Exception e) {
initiateClassicPicker(activity);
}
}

private void initiateClassicPicker(final Activity activity) {
try {
PickVisualMediaRequest.Builder builder = new PickVisualMediaRequest.Builder();
// Simplified media type handling
Expand Down