From f3d30a21392c8a3a7ef25ee252a90c944f6ad232 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Fri, 15 Sep 2017 11:01:08 -0700 Subject: Clarified how to set for autofill views representing creditcard expiration dates. Test: mmm -j108 frameworks/base/:doc-comment-check-docs Fixes: 65673410 Change-Id: I0ebf452dff401d0863d841d714fc1350f73c2542 --- core/java/android/view/View.java | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'core/java/android/view/View.java') diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index d030c93a1211..166d6b7a5b1c 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -127,6 +127,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -1078,6 +1079,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * {@code android:autofillHint} (in which case the * value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE}). * + *

When annotating a view with this hint, it's recommended to use a date autofill value to + * avoid ambiguity when the autofill service provides a value for it. To understand why a + * value can be ambiguous, consider "April of 2020", which could be represented as either of + * the following options: + * + *

+ * + *

You define a date autofill value for the view by overriding the following methods: + * + *

    + *
  1. {@link #getAutofillType()} to return {@link #AUTOFILL_TYPE_DATE}. + *
  2. {@link #getAutofillValue()} to return a + * {@link AutofillValue#forDate(long) date autofillvalue}. + *
  3. {@link #autofill(AutofillValue)} to expect a data autofillvalue. + *
+ * *

See {@link #setAutofillHints(String...)} for more info about autofill hints. */ public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE = @@ -1090,6 +1114,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * {@code android:autofillHint} (in which case the * value should be {@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH}). * + *

When annotating a view with this hint, it's recommended to use a text autofill value + * whose value is the numerical representation of the month, starting on {@code 1} to avoid + * ambiguity when the autofill service provides a value for it. To understand why a + * value can be ambiguous, consider "January", which could be represented as either of + * + *

+ * + *

Another recommended approach is to use a date autofill value - see + * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE} for more details. + * *

See {@link #setAutofillHints(String...)} for more info about autofill hints. */ public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH = -- cgit v1.2.3