Skip to content

Commit 5c14024

Browse files
authored
Merge pull request #268 from hugo-rossi/master
Adding option to return or dont camera intents on getPickImageChooser…
2 parents 9aa1661 + 5f1bae0 commit 5c14024

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImage.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public static void startPickImageActivity(@NonNull Activity activity) {
149149
* @param context used to access Android APIs, like content resolve, it is your activity/fragment/widget.
150150
*/
151151
public static Intent getPickImageChooserIntent(@NonNull Context context) {
152-
return getPickImageChooserIntent(context, context.getString(R.string.pick_image_intent_chooser_title), false);
152+
return getPickImageChooserIntent(context, context.getString(R.string.pick_image_intent_chooser_title), false, true);
153153
}
154154

155155
/**
@@ -160,14 +160,15 @@ public static Intent getPickImageChooserIntent(@NonNull Context context) {
160160
* @param context used to access Android APIs, like content resolve, it is your activity/fragment/widget.
161161
* @param title the title to use for the chooser UI
162162
* @param includeDocuments if to include KitKat documents activity containing all sources
163+
* @param includeCamera if to include camera intents
163164
*/
164-
public static Intent getPickImageChooserIntent(@NonNull Context context, CharSequence title, boolean includeDocuments) {
165+
public static Intent getPickImageChooserIntent(@NonNull Context context, CharSequence title, boolean includeDocuments, boolean includeCamera) {
165166

166167
List<Intent> allIntents = new ArrayList<>();
167168
PackageManager packageManager = context.getPackageManager();
168169

169170
// collect all camera intents if Camera permission is available
170-
if (!isExplicitCameraPermissionRequired(context)) {
171+
if (!isExplicitCameraPermissionRequired(context) && includeCamera) {
171172
allIntents.addAll(getCameraIntents(context, packageManager));
172173
}
173174

0 commit comments

Comments
 (0)