diff --git a/README.md b/README.md
index e7a2a50..91e9840 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
# Media Picker
![](https://img.shields.io/badge/Platform-Android-brightgreen.svg)
![](https://img.shields.io/packagist/l/doctrine/orm.svg)
-![](https://img.shields.io/badge/version-2.2.4-blue.svg)
+![](https://img.shields.io/badge/version-2.2.5-blue.svg)
**[Please let me know if your application go to production via this link](https://docs.google.com/forms/d/e/1FAIpQLSe4Y5Fwn1mlEoD4RxjXQzTvL4mofhESuBlTkAPQhI7J_WqMDQ/viewform?c=0&w=1)**
------
@@ -21,7 +21,7 @@ This build `2.x.x` will break backward compatibility and there are a lot of chan
net.alhazmy13.MediaPicker
libary
-2.2.4
+2.2.5
```
@@ -29,7 +29,7 @@ This build `2.x.x` will break backward compatibility and there are a lot of chan
**Gradle**
```gradle
dependencies {
- compile 'net.alhazmy13.MediaPicker:libary:2.2.4'
+ compile 'net.alhazmy13.MediaPicker:libary:2.2.5'
}
```
diff --git a/gradle.properties b/gradle.properties
index 3591931..300ae57 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -13,7 +13,7 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Sat Sep 10 13:03:48 EAT 2016
-libVersion=2.2.4
+libVersion=2.2.5
isDubgMode=true
org.gradle.jvmargs=-Xmx2048m -XX\:MaxPermSize\=512m -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8
org.gradle.daemon=true
diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageActivity.java b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageActivity.java
index 7381189..9089702 100644
--- a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageActivity.java
+++ b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageActivity.java
@@ -175,40 +175,50 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ Log.d(ImageTags.Tags.TAG, "onActivityResult() called with: " + "requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data + "]");
if (resultCode == RESULT_OK) {
- switch (requestCode) {
- case ImageTags.IntentCode.CAMERA_REQUEST:
+ switch (requestCode) {
+ case ImageTags.IntentCode.CAMERA_REQUEST:
new CompressImageTask(destination.getAbsolutePath(), mImgConfig
, ImageActivity.this).execute();
- break;
- case ImageTags.IntentCode.REQUEST_CODE_SELECT_PHOTO:
- try {
- Uri selectedImage = data.getData();
- String selectedImagePath = FileProcessing.getPath(this, selectedImage);
- new CompressImageTask(selectedImagePath,
+ break;
+ case ImageTags.IntentCode.REQUEST_CODE_SELECT_PHOTO:
+ processOneImage(data);
+ break;
+ case ImageTags.IntentCode.REQUEST_CODE_SELECT_MULTI_PHOTO:
+ //Check if the intent contain only one image
+ if (data.getClipData() == null) {
+ processOneImage(data);
+ } else {
+ //intent has multi images
+ listOfImgs = ImageProcessing.processMultiImage(this, data);
+ new CompressImageTask(listOfImgs,
mImgConfig, ImageActivity.this).execute();
- } catch (Exception e) {
- e.printStackTrace();
}
-
- break;
- case ImageTags.IntentCode.REQUEST_CODE_SELECT_MULTI_PHOTO:
- listOfImgs = ImageProcessing.processMultiImage(this, data);
- new CompressImageTask(listOfImgs,
- mImgConfig, ImageActivity.this).execute();
-
- break;
- }
- }else{
+ break;
+ }
+ } else {
Intent intent = new Intent();
intent.setAction("net.alhazmy13.mediapicker.rxjava.image.service");
- intent.putExtra(ImageTags.Tags.PICK_ERROR,"user did not select any image");
+ intent.putExtra(ImageTags.Tags.PICK_ERROR, "user did not select any image");
sendBroadcast(intent);
finish();
}
}
+ private void processOneImage(Intent data) {
+ try {
+ Uri selectedImage = data.getData();
+ String selectedImagePath = FileProcessing.getPath(this, selectedImage);
+ new CompressImageTask(selectedImagePath,
+ mImgConfig, ImageActivity.this).execute();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
private void finishActivity(List path) {
Intent resultIntent = new Intent();
resultIntent.putExtra(ImagePicker.EXTRA_IMAGE_PATH, (Serializable) path);