diff --git a/README.md b/README.md index 8061248..fcee93d 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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. + *
+ * 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