Loading api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -47183,10 +47183,12 @@ package android.view.autofill { public final class AutoFillType implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillType forDate(); method public static android.view.autofill.AutoFillType forList(); method public static android.view.autofill.AutoFillType forText(int); method public static android.view.autofill.AutoFillType forToggle(); method public int getSubType(); method public boolean isDate(); method public boolean isList(); method public boolean isText(); method public boolean isToggle(); Loading @@ -47196,9 +47198,11 @@ package android.view.autofill { public final class AutoFillValue implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillValue forDate(long); method public static android.view.autofill.AutoFillValue forList(int); method public static android.view.autofill.AutoFillValue forText(java.lang.CharSequence); method public static android.view.autofill.AutoFillValue forToggle(boolean); method public long getDateValue(); method public int getListValue(); method public java.lang.CharSequence getTextValue(); method public boolean getToggleValue(); api/system-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -50535,10 +50535,12 @@ package android.view.autofill { public final class AutoFillType implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillType forDate(); method public static android.view.autofill.AutoFillType forList(); method public static android.view.autofill.AutoFillType forText(int); method public static android.view.autofill.AutoFillType forToggle(); method public int getSubType(); method public boolean isDate(); method public boolean isList(); method public boolean isText(); method public boolean isToggle(); Loading @@ -50548,9 +50550,11 @@ package android.view.autofill { public final class AutoFillValue implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillValue forDate(long); method public static android.view.autofill.AutoFillValue forList(int); method public static android.view.autofill.AutoFillValue forText(java.lang.CharSequence); method public static android.view.autofill.AutoFillValue forToggle(boolean); method public long getDateValue(); method public int getListValue(); method public java.lang.CharSequence getTextValue(); method public boolean getToggleValue(); api/test-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -47547,10 +47547,12 @@ package android.view.autofill { public final class AutoFillType implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillType forDate(); method public static android.view.autofill.AutoFillType forList(); method public static android.view.autofill.AutoFillType forText(int); method public static android.view.autofill.AutoFillType forToggle(); method public int getSubType(); method public boolean isDate(); method public boolean isList(); method public boolean isText(); method public boolean isToggle(); Loading @@ -47560,9 +47562,11 @@ package android.view.autofill { public final class AutoFillValue implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillValue forDate(long); method public static android.view.autofill.AutoFillValue forList(int); method public static android.view.autofill.AutoFillValue forText(java.lang.CharSequence); method public static android.view.autofill.AutoFillValue forToggle(boolean); method public long getDateValue(); method public int getListValue(); method public java.lang.CharSequence getTextValue(); method public boolean getToggleValue(); core/java/android/view/autofill/AutoFillType.java +28 −10 Original line number Diff line number Diff line Loading @@ -40,18 +40,13 @@ public final class AutoFillType implements Parcelable { private static class DefaultTypesHolder { static final AutoFillType TOGGLE = new AutoFillType(TYPE_TOGGLE, 0); static final AutoFillType LIST = new AutoFillType(TYPE_LIST, 0); static final AutoFillType DATE = new AutoFillType(TYPE_DATE, 0); } private static final int TYPE_TEXT = 1; private static final int TYPE_TOGGLE = 2; private static final int TYPE_LIST = 3; // TODO(b/33197203): add others, like date picker? That would be trick, because they're set as: // updateDate(int year, int month, int dayOfMonth) // So, we would have to either use a long representing the Date.time(), or a custom long // representing: // year * 10000 + month * 100 + day // Then a custom getDatePickerValue(Bundle) that returns an immutable object with these 3 fields private static final int TYPE_DATE = 4; private final int mType; private final int mSubType; Loading @@ -65,7 +60,7 @@ public final class AutoFillType implements Parcelable { * Checks if this is a type for a text field, which is filled by a {@link CharSequence}. * * <p>{@link AutoFillValue} instances for auto-filling a {@link View} can be obtained through * {@link AutoFillValue#forText(CharSequence)}, and the value of a bundle passed to auto-fill a * {@link AutoFillValue#forText(CharSequence)}, and the value passed to auto-fill a * {@link View} can be fetched through {@link AutoFillValue#getTextValue()}. * * <p>Sub-type for this type is the value defined by {@link TextView#getInputType()}. Loading @@ -78,7 +73,7 @@ public final class AutoFillType implements Parcelable { * Checks if this is a a type for a togglable field, which is filled by a {@code boolean}. * * <p>{@link AutoFillValue} instances for auto-filling a {@link View} can be obtained through * {@link AutoFillValue#forToggle(boolean)}, and the value of a bundle passed to auto-fill a * {@link AutoFillValue#forToggle(boolean)}, and the value passed to auto-fill a * {@link View} can be fetched through {@link AutoFillValue#getToggleValue()}. * * <p>This type has no sub-types. Loading @@ -92,7 +87,7 @@ public final class AutoFillType implements Parcelable { * representing the element index inside the list (starting at {@code 0}. * * <p>{@link AutoFillValue} instances for auto-filling a {@link View} can be obtained through * {@link AutoFillValue#forList(int)}, and the value of a bundle passed to auto-fill a * {@link AutoFillValue#forList(int)}, and the value passed to auto-fill a * {@link View} can be fetched through {@link AutoFillValue#getListValue()}. * * <p>This type has no sub-types. Loading @@ -101,6 +96,20 @@ public final class AutoFillType implements Parcelable { return mType == TYPE_LIST; } /** * Checks if this is a type for a date and time, which is represented by a long representing * the number of milliseconds since the standard base time known as "the epoch", namely * January 1, 1970, 00:00:00 GMT (see {@link java.util.Date#getTime()}. * * <p>{@link AutoFillValue} instances for auto-filling a {@link View} can be obtained through * {@link AutoFillValue#forDate(long)}, and the values passed to * auto-fill a {@link View} can be fetched through {@link AutoFillValue#getDateValue()}. * * <p>This type has no sub-types. */ public boolean isDate() { return mType == TYPE_DATE; } /** * Gets the optional sub-type, representing the {@link View}'s semantic. Loading Loading @@ -206,4 +215,13 @@ public final class AutoFillType implements Parcelable { public static AutoFillType forList() { return DefaultTypesHolder.LIST; } /** * Creates a type that represents a date. * * <p>See {@link #isDate()} for more info. */ public static AutoFillType forDate() { return DefaultTypesHolder.DATE; } } core/java/android/view/autofill/AutoFillValue.java +38 −10 Original line number Diff line number Diff line Loading @@ -35,11 +35,13 @@ public final class AutoFillValue implements Parcelable { private final String mText; private final int mListIndex; private final boolean mToggle; private final long mDate; private AutoFillValue(CharSequence text, int listIndex, boolean toggle) { private AutoFillValue(CharSequence text, int listIndex, boolean toggle, long date) { mText = (text == null) ? null : text.toString(); mListIndex = listIndex; mToggle = toggle; mDate = date; } /** Loading Loading @@ -69,6 +71,17 @@ public final class AutoFillValue implements Parcelable { return mListIndex; } /** * Gets the value representing the the number of milliseconds since the standard base time known * as "the epoch", namely January 1, 1970, 00:00:00 GMT (see {@link java.util.Date#getTime()} * of a date field. * * <p>See {@link AutoFillType#isDate()} for more info. */ public long getDateValue() { return mDate; } ///////////////////////////////////// // Object "contract" methods. // ///////////////////////////////////// Loading @@ -77,9 +90,10 @@ public final class AutoFillValue implements Parcelable { public int hashCode() { final int prime = 31; int result = 1; result = prime * result + mListIndex; result = prime * result + ((mText == null) ? 0 : mText.hashCode()); result = prime * result + mListIndex; result = prime * result + (mToggle ? 1231 : 1237); result = prime * result + (int) (mDate ^ (mDate >>> 32)); return result; } Loading @@ -89,13 +103,14 @@ public final class AutoFillValue implements Parcelable { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final AutoFillValue other = (AutoFillValue) obj; if (mListIndex != other.mListIndex) return false; if (mText == null) { if (other.mText != null) return false; } else { if (!mText.equals(other.mText)) return false; } if (mListIndex != other.mListIndex) return false; if (mToggle != other.mToggle) return false; if (mDate != other.mDate) return false; return true; } Loading @@ -113,7 +128,7 @@ public final class AutoFillValue implements Parcelable { return mText.length() + "_chars"; } return "[listIndex=" + mListIndex + ", toggle=" + mToggle + "]"; return "[l=" + mListIndex + ", t=" + mToggle + ", d=" + mDate + "]"; } ///////////////////////////////////// Loading @@ -130,12 +145,14 @@ public final class AutoFillValue implements Parcelable { parcel.writeString(mText); parcel.writeInt(mListIndex); parcel.writeInt(mToggle ? 1 : 0); parcel.writeLong(mDate); } private AutoFillValue(Parcel parcel) { mText = parcel.readString(); mListIndex = parcel.readInt(); mToggle = parcel.readInt() == 1; mDate = parcel.readLong(); } public static final Parcelable.Creator<AutoFillValue> CREATOR = Loading @@ -157,31 +174,42 @@ public final class AutoFillValue implements Parcelable { // TODO(b/33197203): add unit tests for each supported type (new / get should return same value) /** * Creates a new {@link AutoFillValue} to auto-fill a text field. * Creates a new {@link AutoFillValue} to auto-fill a {@link View} representing a text field. * * <p>See {@link AutoFillType#isText()} for more info. */ // TODO(b/33197203): use cache @Nullable public static AutoFillValue forText(@Nullable CharSequence value) { return value == null ? null : new AutoFillValue(value, 0, false); return value == null ? null : new AutoFillValue(value, 0, false, 0); } /** * Creates a new {@link AutoFillValue} to auto-fill a toggable field. * Creates a new {@link AutoFillValue} to auto-fill a {@link View} representing a toggable * field. * * <p>See {@link AutoFillType#isToggle()} for more info. */ public static AutoFillValue forToggle(boolean value) { return new AutoFillValue(null, 0, value); return new AutoFillValue(null, 0, value, 0); } /** * Creates a new {@link AutoFillValue} to auto-fill a selection list field. * Creates a new {@link AutoFillValue} to auto-fill a {@link View} representing a selection * list. * * <p>See {@link AutoFillType#isList()} for more info. */ public static AutoFillValue forList(int value) { return new AutoFillValue(null, value, false); return new AutoFillValue(null, value, false, 0); } /** * Creates a new {@link AutoFillValue} to auto-fill a {@link View} representing a date. * * <p>See {@link AutoFillType#isDate()} for more info. */ public static AutoFillValue forDate(long date) { return new AutoFillValue(null, 0, false, date); } } Loading
api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -47183,10 +47183,12 @@ package android.view.autofill { public final class AutoFillType implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillType forDate(); method public static android.view.autofill.AutoFillType forList(); method public static android.view.autofill.AutoFillType forText(int); method public static android.view.autofill.AutoFillType forToggle(); method public int getSubType(); method public boolean isDate(); method public boolean isList(); method public boolean isText(); method public boolean isToggle(); Loading @@ -47196,9 +47198,11 @@ package android.view.autofill { public final class AutoFillValue implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillValue forDate(long); method public static android.view.autofill.AutoFillValue forList(int); method public static android.view.autofill.AutoFillValue forText(java.lang.CharSequence); method public static android.view.autofill.AutoFillValue forToggle(boolean); method public long getDateValue(); method public int getListValue(); method public java.lang.CharSequence getTextValue(); method public boolean getToggleValue();
api/system-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -50535,10 +50535,12 @@ package android.view.autofill { public final class AutoFillType implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillType forDate(); method public static android.view.autofill.AutoFillType forList(); method public static android.view.autofill.AutoFillType forText(int); method public static android.view.autofill.AutoFillType forToggle(); method public int getSubType(); method public boolean isDate(); method public boolean isList(); method public boolean isText(); method public boolean isToggle(); Loading @@ -50548,9 +50550,11 @@ package android.view.autofill { public final class AutoFillValue implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillValue forDate(long); method public static android.view.autofill.AutoFillValue forList(int); method public static android.view.autofill.AutoFillValue forText(java.lang.CharSequence); method public static android.view.autofill.AutoFillValue forToggle(boolean); method public long getDateValue(); method public int getListValue(); method public java.lang.CharSequence getTextValue(); method public boolean getToggleValue();
api/test-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -47547,10 +47547,12 @@ package android.view.autofill { public final class AutoFillType implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillType forDate(); method public static android.view.autofill.AutoFillType forList(); method public static android.view.autofill.AutoFillType forText(int); method public static android.view.autofill.AutoFillType forToggle(); method public int getSubType(); method public boolean isDate(); method public boolean isList(); method public boolean isText(); method public boolean isToggle(); Loading @@ -47560,9 +47562,11 @@ package android.view.autofill { public final class AutoFillValue implements android.os.Parcelable { method public int describeContents(); method public static android.view.autofill.AutoFillValue forDate(long); method public static android.view.autofill.AutoFillValue forList(int); method public static android.view.autofill.AutoFillValue forText(java.lang.CharSequence); method public static android.view.autofill.AutoFillValue forToggle(boolean); method public long getDateValue(); method public int getListValue(); method public java.lang.CharSequence getTextValue(); method public boolean getToggleValue();
core/java/android/view/autofill/AutoFillType.java +28 −10 Original line number Diff line number Diff line Loading @@ -40,18 +40,13 @@ public final class AutoFillType implements Parcelable { private static class DefaultTypesHolder { static final AutoFillType TOGGLE = new AutoFillType(TYPE_TOGGLE, 0); static final AutoFillType LIST = new AutoFillType(TYPE_LIST, 0); static final AutoFillType DATE = new AutoFillType(TYPE_DATE, 0); } private static final int TYPE_TEXT = 1; private static final int TYPE_TOGGLE = 2; private static final int TYPE_LIST = 3; // TODO(b/33197203): add others, like date picker? That would be trick, because they're set as: // updateDate(int year, int month, int dayOfMonth) // So, we would have to either use a long representing the Date.time(), or a custom long // representing: // year * 10000 + month * 100 + day // Then a custom getDatePickerValue(Bundle) that returns an immutable object with these 3 fields private static final int TYPE_DATE = 4; private final int mType; private final int mSubType; Loading @@ -65,7 +60,7 @@ public final class AutoFillType implements Parcelable { * Checks if this is a type for a text field, which is filled by a {@link CharSequence}. * * <p>{@link AutoFillValue} instances for auto-filling a {@link View} can be obtained through * {@link AutoFillValue#forText(CharSequence)}, and the value of a bundle passed to auto-fill a * {@link AutoFillValue#forText(CharSequence)}, and the value passed to auto-fill a * {@link View} can be fetched through {@link AutoFillValue#getTextValue()}. * * <p>Sub-type for this type is the value defined by {@link TextView#getInputType()}. Loading @@ -78,7 +73,7 @@ public final class AutoFillType implements Parcelable { * Checks if this is a a type for a togglable field, which is filled by a {@code boolean}. * * <p>{@link AutoFillValue} instances for auto-filling a {@link View} can be obtained through * {@link AutoFillValue#forToggle(boolean)}, and the value of a bundle passed to auto-fill a * {@link AutoFillValue#forToggle(boolean)}, and the value passed to auto-fill a * {@link View} can be fetched through {@link AutoFillValue#getToggleValue()}. * * <p>This type has no sub-types. Loading @@ -92,7 +87,7 @@ public final class AutoFillType implements Parcelable { * representing the element index inside the list (starting at {@code 0}. * * <p>{@link AutoFillValue} instances for auto-filling a {@link View} can be obtained through * {@link AutoFillValue#forList(int)}, and the value of a bundle passed to auto-fill a * {@link AutoFillValue#forList(int)}, and the value passed to auto-fill a * {@link View} can be fetched through {@link AutoFillValue#getListValue()}. * * <p>This type has no sub-types. Loading @@ -101,6 +96,20 @@ public final class AutoFillType implements Parcelable { return mType == TYPE_LIST; } /** * Checks if this is a type for a date and time, which is represented by a long representing * the number of milliseconds since the standard base time known as "the epoch", namely * January 1, 1970, 00:00:00 GMT (see {@link java.util.Date#getTime()}. * * <p>{@link AutoFillValue} instances for auto-filling a {@link View} can be obtained through * {@link AutoFillValue#forDate(long)}, and the values passed to * auto-fill a {@link View} can be fetched through {@link AutoFillValue#getDateValue()}. * * <p>This type has no sub-types. */ public boolean isDate() { return mType == TYPE_DATE; } /** * Gets the optional sub-type, representing the {@link View}'s semantic. Loading Loading @@ -206,4 +215,13 @@ public final class AutoFillType implements Parcelable { public static AutoFillType forList() { return DefaultTypesHolder.LIST; } /** * Creates a type that represents a date. * * <p>See {@link #isDate()} for more info. */ public static AutoFillType forDate() { return DefaultTypesHolder.DATE; } }
core/java/android/view/autofill/AutoFillValue.java +38 −10 Original line number Diff line number Diff line Loading @@ -35,11 +35,13 @@ public final class AutoFillValue implements Parcelable { private final String mText; private final int mListIndex; private final boolean mToggle; private final long mDate; private AutoFillValue(CharSequence text, int listIndex, boolean toggle) { private AutoFillValue(CharSequence text, int listIndex, boolean toggle, long date) { mText = (text == null) ? null : text.toString(); mListIndex = listIndex; mToggle = toggle; mDate = date; } /** Loading Loading @@ -69,6 +71,17 @@ public final class AutoFillValue implements Parcelable { return mListIndex; } /** * Gets the value representing the the number of milliseconds since the standard base time known * as "the epoch", namely January 1, 1970, 00:00:00 GMT (see {@link java.util.Date#getTime()} * of a date field. * * <p>See {@link AutoFillType#isDate()} for more info. */ public long getDateValue() { return mDate; } ///////////////////////////////////// // Object "contract" methods. // ///////////////////////////////////// Loading @@ -77,9 +90,10 @@ public final class AutoFillValue implements Parcelable { public int hashCode() { final int prime = 31; int result = 1; result = prime * result + mListIndex; result = prime * result + ((mText == null) ? 0 : mText.hashCode()); result = prime * result + mListIndex; result = prime * result + (mToggle ? 1231 : 1237); result = prime * result + (int) (mDate ^ (mDate >>> 32)); return result; } Loading @@ -89,13 +103,14 @@ public final class AutoFillValue implements Parcelable { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final AutoFillValue other = (AutoFillValue) obj; if (mListIndex != other.mListIndex) return false; if (mText == null) { if (other.mText != null) return false; } else { if (!mText.equals(other.mText)) return false; } if (mListIndex != other.mListIndex) return false; if (mToggle != other.mToggle) return false; if (mDate != other.mDate) return false; return true; } Loading @@ -113,7 +128,7 @@ public final class AutoFillValue implements Parcelable { return mText.length() + "_chars"; } return "[listIndex=" + mListIndex + ", toggle=" + mToggle + "]"; return "[l=" + mListIndex + ", t=" + mToggle + ", d=" + mDate + "]"; } ///////////////////////////////////// Loading @@ -130,12 +145,14 @@ public final class AutoFillValue implements Parcelable { parcel.writeString(mText); parcel.writeInt(mListIndex); parcel.writeInt(mToggle ? 1 : 0); parcel.writeLong(mDate); } private AutoFillValue(Parcel parcel) { mText = parcel.readString(); mListIndex = parcel.readInt(); mToggle = parcel.readInt() == 1; mDate = parcel.readLong(); } public static final Parcelable.Creator<AutoFillValue> CREATOR = Loading @@ -157,31 +174,42 @@ public final class AutoFillValue implements Parcelable { // TODO(b/33197203): add unit tests for each supported type (new / get should return same value) /** * Creates a new {@link AutoFillValue} to auto-fill a text field. * Creates a new {@link AutoFillValue} to auto-fill a {@link View} representing a text field. * * <p>See {@link AutoFillType#isText()} for more info. */ // TODO(b/33197203): use cache @Nullable public static AutoFillValue forText(@Nullable CharSequence value) { return value == null ? null : new AutoFillValue(value, 0, false); return value == null ? null : new AutoFillValue(value, 0, false, 0); } /** * Creates a new {@link AutoFillValue} to auto-fill a toggable field. * Creates a new {@link AutoFillValue} to auto-fill a {@link View} representing a toggable * field. * * <p>See {@link AutoFillType#isToggle()} for more info. */ public static AutoFillValue forToggle(boolean value) { return new AutoFillValue(null, 0, value); return new AutoFillValue(null, 0, value, 0); } /** * Creates a new {@link AutoFillValue} to auto-fill a selection list field. * Creates a new {@link AutoFillValue} to auto-fill a {@link View} representing a selection * list. * * <p>See {@link AutoFillType#isList()} for more info. */ public static AutoFillValue forList(int value) { return new AutoFillValue(null, value, false); return new AutoFillValue(null, value, false, 0); } /** * Creates a new {@link AutoFillValue} to auto-fill a {@link View} representing a date. * * <p>See {@link AutoFillType#isDate()} for more info. */ public static AutoFillValue forDate(long date) { return new AutoFillValue(null, 0, false, date); } }