Skip to content

Commit

Permalink
[ReadMe] update readme with last features.
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarthel-fr committed Jun 4, 2016
1 parent 1d52c2e commit 189a69e
Showing 1 changed file with 43 additions and 2 deletions.
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This project is a light open-source library that improves the sharing experience
* [Picasso](#picasso)
* [Glide](#glide)
* [Custom icon loader](#custom-icon-loader)
* [Comparator Provider](#comparator-provider)
* [What's next](#whats-next)
* [Contributing](#contributing)
* [License](#license)
Expand Down Expand Up @@ -257,12 +258,52 @@ IntentShare.with(context)
})
.deliver();
```
# Comparator provider
By default, target activities are sorted based on the recency of their selection from your app.
```java
/**
* Comparator used to sort {@link TargetActivity} based on the recency of their previous
* selection and their default order as fallback when they have never been selected.
* <p/>
* The ordering imposed by this comparator on a set of {@link TargetActivity}
* is not consistent with equals since c.compare(e1, e2)==0 has not the same boolean
* value as e1.equals(e2).
*/
public RecencyComparatorProvider() {

}
```
Instead of using the default comparator, you can implement your own comparator provider in order to customize the target activities order display to the user:
```java
/**
* ˙Interface which allow to define which comparator will be provided for sorting the
* target activity inside the {@link TargetChooserActivity}.
*/
public interface TargetActivityComparatorProvider extends Parcelable {

/**
* Provide the comparator used to sort {@link TargetActivity} displayed to the user.
*
* @return comparator used to sort {@link TargetActivity} displayed to the user.
*/
Comparator<TargetActivity> provideComparator();
}
```
```java
IntentShare.with(context)
.chooserTitle("Select a sharing target : ")
.text("Default text you would like to share.")
.comparatorProvider(customComparatorProvider)
.deliver();
```
An example from the sample can be found here : [SocialTargetActivityComparatorProvider.java](https://github.com/tvbarthel/IntentShare/blob/develop/sample/src/main/java/fr/tvbarthel/intentsharesample/SocialTargetActivityComparatorProvider.java)


# What's next
* Providing custom sorting for target activities.
* Providing easier way to share images.
* Removing dependencies on support libraries.
* Sample : implementing image selection for extra provider.

# Contributing
Contributions are very welcome (: You can contribute through GitHub by forking the repository and sending a pull request.

Expand Down

0 comments on commit 189a69e

Please sign in to comment.