Skip to content
This repository has been archived by the owner on May 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #16 from alhazmy13/develop
Browse files Browse the repository at this point in the history
Add support for selecting one image while enabling allowMulitpleImage…
  • Loading branch information
alhazmy13 authored Sep 18, 2016
2 parents 80bee49 + 39ef068 commit cecef20
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 25 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)**
------
Expand All @@ -21,15 +21,15 @@ This build `2.x.x` will break backward compatibility and there are a lot of chan
<dependency>
<groupId>net.alhazmy13.MediaPicker</groupId>
<artifactId>libary</artifactId>
<version>2.2.4</version>
<version>2.2.5</version>
</dependency>
```


**Gradle**
```gradle
dependencies {
compile 'net.alhazmy13.MediaPicker:libary:2.2.4'
compile 'net.alhazmy13.MediaPicker:libary:2.2.5'
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> path) {
Intent resultIntent = new Intent();
resultIntent.putExtra(ImagePicker.EXTRA_IMAGE_PATH, (Serializable) path);
Expand Down

0 comments on commit cecef20

Please sign in to comment.