private static final int[] VISIBILITY_FLAGS = {VISIBLE, INVISIBLE, GONE};
/**
- * This view contains an email address.
+ * Hint indicating that this view can be autofilled with an email address.
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_EMAIL_ADDRESS}"
- * to <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_EMAIL_ADDRESS}</code>).
+ *
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_EMAIL_ADDRESS = "emailAddress";
/**
- * The view contains a real name.
+ * Hint indicating that this view can be autofilled with a user's real name.
+ *
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_NAME}</code>).
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_NAME}" to
- * <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_NAME = "name";
/**
- * The view contains a user name.
+ * Hint indicating that this view can be autofilled with a username.
+ *
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_USERNAME}</code>).
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_USERNAME}" to
- * <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_USERNAME = "username";
/**
- * The view contains a password.
+ * Hint indicating that this view can be autofilled with a password.
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_PASSWORD}" to
- * <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_PASSWORD}</code>).
+ *
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_PASSWORD = "password";
/**
- * The view contains a phone number.
+ * Hint indicating that this view can be autofilled with a phone number.
+ *
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_PHONE}</code>).
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_PHONE}" to
- * <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_PHONE = "phone";
/**
- * The view contains a postal address.
+ * Hint indicating that this view can be autofilled with a postal address.
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_POSTAL_ADDRESS}"
- * to <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_POSTAL_ADDRESS}</code>).
+ *
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_POSTAL_ADDRESS = "postalAddress";
/**
- * The view contains a postal code.
+ * Hint indicating that this view can be autofilled with a postal code.
+ *
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_POSTAL_CODE}</code>).
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value #AUTOFILL_HINT_POSTAL_CODE}" to
- * <a href="#attr_android:autofillHint"> {@code android:autofillHint}.
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_POSTAL_CODE = "postalCode";
/**
- * The view contains a credit card number.
+ * Hint indicating that this view can be autofilled with a credit card number.
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value
- * #AUTOFILL_HINT_CREDIT_CARD_NUMBER}" to <a href="#attr_android:autofillHint"> {@code
- * android:autofillHint}.
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_CREDIT_CARD_NUMBER}</code>).
+ *
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_CREDIT_CARD_NUMBER = "creditCardNumber";
/**
- * The view contains a credit card security code.
+ * Hint indicating that this view can be autofilled with a credit card security code.
+ *
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE}</code>).
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value
- * #AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE}" to <a href="#attr_android:autofillHint"> {@code
- * android:autofillHint}.
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE = "creditCardSecurityCode";
/**
- * The view contains a credit card expiration date.
+ * Hint indicating that this view can be autofilled with a credit card expiration date.
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value
- * #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE}" to <a href="#attr_android:autofillHint"> {@code
- * android:autofillHint}.
+ * <p>It should be used when the credit card expiration date is represented by just one view;
+ * if it is represented by more than one (for example, one view for the month and another view
+ * for the year), then each of these views should use the hint specific for the unit
+ * ({@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY},
+ * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH},
+ * or {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR}).
+ *
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE}</code>).
+ *
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE =
"creditCardExpirationDate";
/**
- * The view contains the month a credit card expires.
+ * Hint indicating that this view can be autofilled with a credit card expiration month.
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value
- * #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH}" to <a href="#attr_android:autofillHint"> {@code
- * android:autofillHint}.
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH}</code>).
+ *
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH =
"creditCardExpirationMonth";
/**
- * The view contains the year a credit card expires.
+ * Hint indicating that this view can be autofilled with a credit card expiration year.
+ *
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR}</code>).
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value
- * #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR}" to <a href="#attr_android:autofillHint"> {@code
- * android:autofillHint}.
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR =
"creditCardExpirationYear";
/**
- * The view contains the day a credit card expires.
+ * Hint indicating that this view can be autofilled with a credit card expiration day.
*
- * Use with {@link #setAutofillHints(String[])}, or set "{@value
- * #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY}" to <a href="#attr_android:autofillHint"> {@code
- * android:autofillHint}.
+ * <p>Can be used with either {@link #setAutofillHints(String[])} or
+ * <a href="#attr_android:autofillHint"> {@code android:autofillHint}</a> (in which case the
+ * value should be <code>{@value #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY}</code>).
+ *
+ * <p>See {@link #setAutofillHints(String...)} for more info about autofill hints.
*/
public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY = "creditCardExpirationDay";
}
/**
- * Describes the content of a view so that a autofill service can fill in the appropriate data.
+ * Gets the hints that help an {@link android.service.autofill.AutofillService} determine how
+ * to autofill the view with the user's data.
+ *
+ * <p>See {@link #setAutofillHints(String...)} for more info about these hints.
*
- * @return The hints set via the attribute or {@code null} if no hint it set.
+ * @return The hints set via the attribute or {@link #setAutofillHints(String...)}, or
+ * {@code null} if no hints were set.
*
* @attr ref android.R.styleable#View_autofillHints
*/
}
/**
- * Sets the hints that helps the autofill service to select the appropriate data to fill the
- * view.
+ * Sets the hints that help an {@link android.service.autofill.AutofillService} determine how
+ * to autofill the view with the user's data.
+ *
+ * <p>Typically, there is only one way to autofill a view, but there could be more than one.
+ * For example, if the application accepts either an username or email address to identify
+ * an user.
+ *
+ * <p>These hints are not validated by the Android System, but passed "as is" to the service.
+ * Hence, they can have any value, but it's recommended to use the {@code AUTOFILL_HINT_}
+ * constants such as:
+ * {@link #AUTOFILL_HINT_USERNAME}, {@link #AUTOFILL_HINT_PASSWORD},
+ * {@link #AUTOFILL_HINT_EMAIL_ADDRESS},
+ * {@link #AUTOFILL_HINT_NAME},
+ * {@link #AUTOFILL_HINT_PHONE},
+ * {@link #AUTOFILL_HINT_POSTAL_ADDRESS}, {@link #AUTOFILL_HINT_POSTAL_CODE},
+ * {@link #AUTOFILL_HINT_CREDIT_CARD_NUMBER}, {@link #AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE},
+ * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE},
+ * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY},
+ * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH} or
+ * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR}.
*
* @param autofillHints The autofill hints to set. If the array is emtpy, {@code null} is set.
* @attr ref android.R.styleable#View_autofillHints