Skip to content

Commit

Permalink
intent implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
HashirRajah committed Feb 14, 2024
1 parent 28d5366 commit b15d703
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 50 deletions.
3 changes: 0 additions & 3 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
<config-file target="res/xml/config.xml" parent="/*">
<feature name="ImagePicker">
<param name="android-package" value="com.spoon.imagepicker.ImagePicker"/>
<param name="onload" value="true" />
</feature>
</config-file>

Expand All @@ -107,9 +106,7 @@

<framework src="com.android.support:appcompat-v7:27.1.1" />
<framework src="androidx.activity:activity:1.7.+" />
<framework src="androidx.fragment:fragment:1.6.2" />

<source-file src="src/android/ImagePicker.java" target-dir="src/com/spoon/imagepicker" />
<source-file src="src/android/ImagePickerFragment.java" target-dir="src/com/spoon/imagepicker" />
</platform>
</plugin>
17 changes: 4 additions & 13 deletions src/android/ImagePicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,10 @@ public boolean execute(String action, final JSONArray args, final CallbackContex
final JSONObject params = args.getJSONObject(0);
this.maxImageCount = params.has("maximumImagesCount") ? params.getInt("maximumImagesCount") : 20;

ActivityResultLauncher<PickVisualMediaRequest> pickMultipleMedia =
cordova.getActivity().registerForActivityResult(new ActivityResultContracts.PickMultipleVisualMedia(5), uris -> {
// Callback is invoked after the user selects media items or closes the
// photo picker.
if (!uris.isEmpty()) {
Log.d("PhotoPicker", "Number of items selected: " + uris.size());
} else {
Log.d("PhotoPicker", "No media selected");
}
});
pickMultipleMedia.launch(new PickVisualMediaRequest.Builder()
.setMediaType(ActivityResultContracts.PickVisualMedia.ImageAndVideo.INSTANCE)
.build());
PickVisualMediaRequest pickVisualMediaRequest = new PickVisualMediaRequest();
Intent imagePickerIntent = new ActivityResultContracts.PickMultipleVisualMedia().createIntent(cordova.getContext(), pickVisualMediaRequest);
imagePickerIntent.setType("image/*");
cordova.startActivityForResult(this, imagePickerIntent, SELECT_PICTURE);
this.showMaxLimitWarning();
return true;
}
Expand Down
34 changes: 0 additions & 34 deletions src/android/ImagePickerFragment.java

This file was deleted.

0 comments on commit b15d703

Please sign in to comment.