Skip to content

Commit

Permalink
📚 Update the readme and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
esafirm committed Jan 17, 2018
1 parent ce4f9ec commit 48b2a84
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 15 deletions.
86 changes: 86 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,91 @@
## Changelog

**1.12.0 - New Return Mode API**

> BREAKING CHANGES!!!
- [New] Return Mode API `setReturnMode`

```
Define the ImagePicker return behaviour
1. ReturnMode.NONE -> When image is picked, ImagePickerActivity will not dismissed even in Single Mode
2. ReturnMode.ALL -> When image is picked dismiss then deliver result
3. ReturnMode.CAMERA_ONLY -> When image is picked with Camera, dismiss then deliver the result
4. ReturnMode.GALLERY_ONLY -> Same as CAMERA_ONLY but with Gallery
```

So if you want to mimic the `setReturnAfterFirst` behavior, all you have to do is

```
ImagePicker.create(activity).setReturnMode(ReturnMode.ALL).start()
```

- `setReturnAfterFirst` is now obsolete
- [New] set toolbar arrow color with `toolbarArrowColor(int color)`
- Rename `ImagePicker` methods
- `folderTitle` -> `toolbarFolderTitle`
- `imageTitle` -> `toolbarImageTitle`
- Add capability to start without a request code


So instead of this

```
ImagePicker.cameraOnly().start(RC_CAMERA /* int */);
```

Now you can do this

```
ImagePicker.cameraOnly().start()
```

BUT, you have to handle the result with the helper method from `ImagePicker`

```java
@Override
protected void onActivityResult(int requestCode, final int resultCode, Intent data) {
if (ImagePicker.shouldHandle(requestCode, resultCode, data)) {
// do your things
}
super.onActivityResult(requestCode, resultCode, data);
}
```

You can still use the usual result check if you define the request code by yourself.

- Add convenience method `ImagePicker.getFirstImageOrNull(Intent data)` to fetch only first image from the result or return `null`

---

**1.11.0 - Add `exclude()` Function**

Now you can exclude image from being shown in the picker

```java
ImagePicker.create(this)
.exclude(image) // exclude everything in `List<Image>`
.excludeFiles(files) // or you can exclude everything in `List<File>`
.start(RQ)
```

**1.10.1 - Fixes**

- Glide and AppCompat now marked as implementation
- Glide fixes
- Internal fixes

**1.10.0 - Add new way to do camera only**

- Add new way to do camera only

```java
ImagePicker.cameraOnly().start(activity)
```

- Remove ImmediateCameraModule
- Bugfixes 🐛

**1.7.4 - More fixes and improvement**

- Fix `returnAfterFirst` not working in gallery selection
Expand Down
35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,23 @@ Will improve this image loader compatibility issue in ImagePicker v2!
For full example, please refer to `sample`

### Start image picker activity
- Quick call

The simplest way to start

```java
ImagePicker.create(this) // Activity or Fragment
.start(REQUEST_CODE_PICKER);
.start();
```
- Complete options

Complete features of what you can do with ImagePicker

```java
ImagePicker.create(this)
.returnAfterFirst(true) // set whether pick or camera action should return immediate result or not. For pick image only work on single mode
.returnMode(ReturnMode.ALL) // set whether pick and / or camera action should return immediate result or not.
.folderMode(true) // folder mode (false by default)
.folderTitle("Folder") // folder selection title
.imageTitle("Tap to select") // image selection title
.toolbarFolderTitle("Folder") // folder selection title
.toolbarImageTitle("Tap to select") // image selection title
.toolbarArrowColor(Color.BLACK) // Toolbar 'up' arrow color
.single() // single mode
.multi() // multi mode (default mode)
.limit(10) // max images can be selected (99 by default)
Expand All @@ -69,27 +72,29 @@ ImagePicker.create(this)
.theme(R.style.CustomImagePickerTheme) // must inherit ef_BaseTheme. please refer to sample
.enableLog(false) // disabling log
.imageLoader(new GrayscaleImageLoder()) // custom image loader, must be serializeable
.start(REQUEST_CODE_PICKER); // start image picker activity with request code
.start(); // start image picker activity with request code
```

- Get Intent

If you want to call it outside `Activity` or `Fragment`, you can simply get the `Intent` from the builder

```java
ImagePicker.create(activity).getIntent(context)

```

### Receive result


```java
@Override
if (requestCode == REQUEST_CODE_PICKER && resultCode == RESULT_OK && data != null) {
ArrayList<Image> images = (ArrayList<Image>) ImagePicker.getImages(data);
}
@Override
protected void onActivityResult(int requestCode, final int resultCode, Intent data) {
if (ImagePicker.shouldHandle(requestCode, resultCode, data)) {
// Get a list of picked images
List<Image> images = ImagePicker.getImages(data)
// or get a single image only
Image image = ImagePicker.getFirstImageOrNull(data)
}
super.onActivityResult(requestCode, resultCode, data);
}
```


Expand Down

0 comments on commit 48b2a84

Please sign in to comment.