diff --git a/README.md b/README.md
index 452eb9f..e7a2a50 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.3-blue.svg)
+![](https://img.shields.io/badge/version-2.2.4-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.3
+2.2.4
```
@@ -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.3'
+ compile 'net.alhazmy13.MediaPicker:libary:2.2.4'
}
```
diff --git a/app/src/main/java/net/alhazmy13/mediapickerexample/MainActivity.java b/app/src/main/java/net/alhazmy13/mediapickerexample/MainActivity.java
index 4cfff3b..da326e3 100644
--- a/app/src/main/java/net/alhazmy13/mediapickerexample/MainActivity.java
+++ b/app/src/main/java/net/alhazmy13/mediapickerexample/MainActivity.java
@@ -25,17 +25,16 @@ public class MainActivity extends AppCompatActivity {
private ImageView imageView;
private String videoPath;
private List mPath;
-
+ private Button pickButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView) findViewById(R.id.tv_path);
- Button pickButton = (Button) findViewById(R.id.bt_pick);
+ pickButton = (Button) findViewById(R.id.bt_pick);
imageView = (ImageView) findViewById(R.id.iv_image);
- assert pickButton != null;
pickButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -70,6 +69,7 @@ private void pickImage() {
.directory(ImagePicker.Directory.DEFAULT)
.extension(ImagePicker.Extension.PNG)
.scale(600, 600)
+ .allowMultipleImages(true)
.enableDebuggingMode(true))
.getObservable()
.subscribe(new Subscriber>() {
diff --git a/gradle.properties b/gradle.properties
index 50a325b..3591931 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -13,8 +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.3
-systemProp.http.proxyHost=127.0.0.1
+libVersion=2.2.4
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 3f9c6ad..7381189 100644
--- a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageActivity.java
+++ b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageActivity.java
@@ -175,19 +175,14 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-
+ if (resultCode == RESULT_OK) {
switch (requestCode) {
case ImageTags.IntentCode.CAMERA_REQUEST:
- if (resultCode == RESULT_OK) {
new CompressImageTask(destination.getAbsolutePath(), mImgConfig
, ImageActivity.this).execute();
- } else {
- finish();
- }
break;
case ImageTags.IntentCode.REQUEST_CODE_SELECT_PHOTO:
- if (resultCode == RESULT_OK) {
try {
Uri selectedImage = data.getData();
String selectedImagePath = FileProcessing.getPath(this, selectedImage);
@@ -196,16 +191,21 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
} catch (Exception e) {
e.printStackTrace();
}
- } else {
- finish();
- }
+
break;
case ImageTags.IntentCode.REQUEST_CODE_SELECT_MULTI_PHOTO:
listOfImgs = ImageProcessing.processMultiImage(this, data);
new CompressImageTask(listOfImgs,
mImgConfig, ImageActivity.this).execute();
- break;
+ 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");
+ sendBroadcast(intent);
+ finish();
}
}
diff --git a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageProcessing.java b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageProcessing.java
index a2bf6ca..d568c1a 100644
--- a/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageProcessing.java
+++ b/libary/src/main/java/net/alhazmy13/mediapicker/Image/ImageProcessing.java
@@ -22,8 +22,7 @@ class ImageProcessing {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static List processMultiImage(Context context, Intent data) {
List listOfImgs = new ArrayList<>();
- if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
- && (null == data.getData()))
+ if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) && (null == data.getData()))
{
ClipData clipdata = data.getClipData();
for (int i=0; i> observer;
@@ -25,8 +25,11 @@ public ImagePickerReceiver(Observer> observer) {
}
public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "Received message "+intent);
+ Log.d(TAG, "Received message " + intent);
List imagePath = (List) intent.getSerializableExtra(ImageTags.Tags.IMAGE_PATH);
- observer.onNext(imagePath);
+ if (imagePath != null && imagePath.size() > 0)
+ observer.onNext(imagePath);
+ else
+ observer.onError(new Throwable(intent.getStringExtra(ImageTags.Tags.PICK_ERROR)));
}
}