1 /*
2  * Copyright 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package androidx.compose.ui.autofill
18 
19 // TODO(b/383201236): This is replaced by ContentType. It was experimental in 1.7 so mark it
20 //  deprecated before 1.8.
21 /**
22  * Autofill type information.
23  *
24  * Autofill services use the [AutofillType] to determine what value to use to autofill fields
25  * associated with this type. If the [AutofillType] is not specified, the autofill services have to
26  * use heuristics to determine the right value to use while auto-filling the corresponding field.
27  *
28  * This has been deprecated in favor of a new semantics based API. Use
29  * [ContentType][androidx.compose.ui.semantics.SemanticsProperties.ContentType] instead.
30  */
31 @Deprecated("Use the new semantics-based API and androidx.compose.ui.autofill.ContentType instead.")
32 enum class AutofillType {
33     /** Indicates that the associated component can be auto-filled with an email address. */
34     EmailAddress,
35 
36     /** Indicates that the associated component can be auto-filled with a username. */
37     Username,
38 
39     /** Indicates that the associated component can be auto-filled with a password. */
40     Password,
41 
42     /**
43      * Indicates that the associated component can be interpreted as a newly created username for
44      * save/update.
45      */
46     NewUsername,
47 
48     /**
49      * Indicates that the associated component can be interpreted as a newly created password for
50      * save/update.
51      */
52     NewPassword,
53 
54     /** Indicates that the associated component can be auto-filled with a postal address. */
55     PostalAddress,
56 
57     /** Indicates that the associated component can be auto-filled with a postal code. */
58     PostalCode,
59 
60     /** Indicates that the associated component can be auto-filled with a credit card number. */
61     CreditCardNumber,
62 
63     /**
64      * Indicates that the associated component can be auto-filled with a credit card security code.
65      */
66     CreditCardSecurityCode,
67 
68     /**
69      * Indicates that the associated component can be auto-filled with a credit card expiration
70      * date.
71      */
72     CreditCardExpirationDate,
73 
74     /**
75      * Indicates that the associated component can be auto-filled with a credit card expiration
76      * month.
77      */
78     CreditCardExpirationMonth,
79 
80     /**
81      * Indicates that the associated component can be auto-filled with a credit card expiration
82      * year.
83      */
84     CreditCardExpirationYear,
85 
86     /**
87      * Indicates that the associated component can be auto-filled with a credit card expiration day.
88      */
89     CreditCardExpirationDay,
90 
91     /** Indicates that the associated component can be auto-filled with a country name/code. */
92     AddressCountry,
93 
94     /** Indicates that the associated component can be auto-filled with a region/state. */
95     AddressRegion,
96 
97     /**
98      * Indicates that the associated component can be auto-filled with an address locality
99      * (city/town).
100      */
101     AddressLocality,
102 
103     /** Indicates that the associated component can be auto-filled with a street address. */
104     AddressStreet,
105 
106     /**
107      * Indicates that the associated component can be auto-filled with auxiliary address details.
108      */
109     AddressAuxiliaryDetails,
110 
111     /**
112      * Indicates that the associated component can be auto-filled with an extended ZIP/POSTAL code.
113      *
114      * Example: In forms that split the U.S. ZIP+4 Code with nine digits 99999-9999 into two fields
115      * annotate the delivery route code with this hint.
116      */
117     PostalCodeExtended,
118 
119     /** Indicates that the associated component can be auto-filled with a person's full name. */
120     PersonFullName,
121 
122     /**
123      * Indicates that the associated component can be auto-filled with a person's first/given name.
124      */
125     PersonFirstName,
126 
127     /**
128      * Indicates that the associated component can be auto-filled with a person's last/family name.
129      */
130     PersonLastName,
131 
132     /** Indicates that the associated component can be auto-filled with a person's middle name. */
133     PersonMiddleName,
134 
135     /**
136      * Indicates that the associated component can be auto-filled with a person's middle initial.
137      */
138     PersonMiddleInitial,
139 
140     /** Indicates that the associated component can be auto-filled with a person's name prefix. */
141     PersonNamePrefix,
142 
143     /** Indicates that the associated component can be auto-filled with a person's name suffix. */
144     PersonNameSuffix,
145 
146     /**
147      * Indicates that the associated component can be auto-filled with a phone number with country
148      * code.
149      *
150      * Example: +1 123-456-7890
151      */
152     PhoneNumber,
153 
154     /**
155      * Indicates that the associated component can be auto-filled with the current device's phone
156      * number usually for Sign Up / OTP flows.
157      */
158     PhoneNumberDevice,
159 
160     /**
161      * Indicates that the associated component can be auto-filled with a phone number's country
162      * code.
163      */
164     PhoneCountryCode,
165 
166     /**
167      * Indicates that the associated component can be auto-filled with a phone number without
168      * country code.
169      */
170     PhoneNumberNational,
171 
172     /** Indicates that the associated component can be auto-filled with a gender. */
173     Gender,
174 
175     /** Indicates that the associated component can be auto-filled with a full birth date. */
176     BirthDateFull,
177 
178     /**
179      * Indicates that the associated component can be auto-filled with a birth day(of the month).
180      */
181     BirthDateDay,
182 
183     /** Indicates that the associated component can be auto-filled with a birth month. */
184     BirthDateMonth,
185 
186     /** Indicates that the associated component can be auto-filled with a birth year. */
187     BirthDateYear,
188 
189     /**
190      * Indicates that the associated component can be auto-filled with a SMS One Time Password
191      * (OTP).
192      *
193      * TODO(b/153386346): Support use-case where you specify the start and end index of the OTP.
194      */
195     SmsOtpCode,
196 }
197