diff options
| author | 2019-10-05 18:48:39 +0000 | |
|---|---|---|
| committer | 2019-10-05 18:48:39 +0000 | |
| commit | cd5db63e0671c922eea992e400dd8cbb3aadf963 (patch) | |
| tree | c128d23d0770ad83e315c73a80e827c771bc32ab | |
| parent | 68e5e264e7cc28a0680d85be186598d6522faf07 (diff) | |
| parent | 85e90d09e1d033912b91ddd66362ee71f9083590 (diff) | |
Merge "New argument to hint at locale to use for sorting."
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/content/ContentResolver.java | 54 |
2 files changed, 42 insertions, 13 deletions
diff --git a/api/current.txt b/api/current.txt index a123f2cc8ba2..b22f4307cd35 100644 --- a/api/current.txt +++ b/api/current.txt @@ -9680,6 +9680,7 @@ package android.content { field public static final String QUERY_ARG_SORT_COLLATION = "android:query-arg-sort-collation"; field public static final String QUERY_ARG_SORT_COLUMNS = "android:query-arg-sort-columns"; field public static final String QUERY_ARG_SORT_DIRECTION = "android:query-arg-sort-direction"; + field public static final String QUERY_ARG_SORT_LOCALE = "android:query-arg-sort-locale"; field public static final String QUERY_ARG_SQL_SELECTION = "android:query-arg-sql-selection"; field public static final String QUERY_ARG_SQL_SELECTION_ARGS = "android:query-arg-sql-selection-args"; field public static final String QUERY_ARG_SQL_SORT_ORDER = "android:query-arg-sql-sort-order"; diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 1f4839380178..7c279fe5781d 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -265,6 +265,7 @@ public abstract class ContentResolver implements ContentInterface { * @see #QUERY_ARG_SORT_COLUMNS * @see #QUERY_ARG_SORT_DIRECTION * @see #QUERY_ARG_SORT_COLLATION + * @see #QUERY_ARG_SORT_LOCALE */ public static final String QUERY_ARG_SQL_SELECTION = "android:query-arg-sql-selection"; @@ -282,6 +283,7 @@ public abstract class ContentResolver implements ContentInterface { * @see #QUERY_ARG_SORT_COLUMNS * @see #QUERY_ARG_SORT_DIRECTION * @see #QUERY_ARG_SORT_COLLATION + * @see #QUERY_ARG_SORT_LOCALE */ public static final String QUERY_ARG_SQL_SELECTION_ARGS = "android:query-arg-sql-selection-args"; @@ -297,6 +299,7 @@ public abstract class ContentResolver implements ContentInterface { * @see #QUERY_ARG_SORT_COLUMNS * @see #QUERY_ARG_SORT_DIRECTION * @see #QUERY_ARG_SORT_COLLATION + * @see #QUERY_ARG_SORT_LOCALE */ public static final String QUERY_ARG_SQL_SORT_ORDER = "android:query-arg-sql-sort-order"; @@ -351,20 +354,22 @@ public abstract class ContentResolver implements ContentInterface { /** * Allows client to specify a hint to the provider declaring which collation - * to use when sorting text values. - * - * <p>Providers may support custom collators. When specifying a custom collator + * to use when sorting values. + * <p> + * Providers may support custom collators. When specifying a custom collator * the value is determined by the Provider. - * - * <li>{@link ContentProvider} implementations: When preparing data in - * {@link ContentProvider#query(Uri, String[], Bundle, CancellationSignal)}, if sort collation - * is reflected in the returned Cursor, it is strongly recommended that - * {@link #QUERY_ARG_SORT_COLLATION} then be included in the array of honored arguments - * reflected in {@link Cursor} extras {@link Bundle} under {@link #EXTRA_HONORED_ARGS}. - * - * <li>When querying a provider, where no QUERY_ARG_SQL* otherwise exists in the - * arguments {@link Bundle}, the Content framework will attempt to synthesize - * a QUERY_ARG_SQL* argument using the corresponding QUERY_ARG_SORT* values. + * <p> + * {@link ContentProvider} implementations: When preparing data in + * {@link ContentProvider#query(Uri, String[], Bundle, CancellationSignal)}, + * if sort collation is reflected in the returned Cursor, it is strongly + * recommended that {@link #QUERY_ARG_SORT_COLLATION} then be included in + * the array of honored arguments reflected in {@link Cursor} extras + * {@link Bundle} under {@link #EXTRA_HONORED_ARGS}. + * <p> + * When querying a provider, where no QUERY_ARG_SQL* otherwise exists in the + * arguments {@link Bundle}, the Content framework will attempt to + * synthesize a QUERY_ARG_SQL* argument using the corresponding + * QUERY_ARG_SORT* values. * * @see java.text.Collator#PRIMARY * @see java.text.Collator#SECONDARY @@ -374,6 +379,28 @@ public abstract class ContentResolver implements ContentInterface { public static final String QUERY_ARG_SORT_COLLATION = "android:query-arg-sort-collation"; /** + * Allows client to specify a hint to the provider declaring which locale to + * use when sorting values. + * <p> + * The value is defined as a RFC 3066 locale ID followed by an optional + * keyword list, which is the locale format used to configure ICU through + * classes like {@link android.icu.util.ULocale}. This supports requesting + * advanced sorting options, such as {@code de@collation=phonebook}, + * {@code zh@collation=pinyin}, etc. + * <p> + * {@link ContentProvider} implementations: When preparing data in + * {@link ContentProvider#query(Uri, String[], Bundle, CancellationSignal)}, + * if sort locale is reflected in the returned Cursor, it is strongly + * recommended that {@link #QUERY_ARG_SORT_LOCALE} then be included in the + * array of honored arguments reflected in {@link Cursor} extras + * {@link Bundle} under {@link #EXTRA_HONORED_ARGS}. + * + * @see java.util.Locale#Locale(String) + * @see android.icu.util.ULocale#ULocale(String) + */ + public static final String QUERY_ARG_SORT_LOCALE = "android:query-arg-sort-locale"; + + /** * Allows provider to report back to client which query keys are honored in a Cursor. * * <p>Key identifying a {@code String[]} containing all QUERY_ARG_SORT* arguments @@ -386,6 +413,7 @@ public abstract class ContentResolver implements ContentInterface { * @see #QUERY_ARG_SORT_COLUMNS * @see #QUERY_ARG_SORT_DIRECTION * @see #QUERY_ARG_SORT_COLLATION + * @see #QUERY_ARG_SORT_LOCALE */ public static final String EXTRA_HONORED_ARGS = "android.content.extra.HONORED_ARGS"; |