Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | package android.view.inputmethod; |
| 18 | |
Yohei Yukawa | 0f5eade | 2019-01-18 08:48:07 -0800 | [diff] [blame] | 19 | import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; |
| 20 | |
Yohei Yukawa | d469f21 | 2016-01-21 12:38:09 -0800 | [diff] [blame] | 21 | import android.annotation.Nullable; |
Yohei Yukawa | 0f5eade | 2019-01-18 08:48:07 -0800 | [diff] [blame] | 22 | import android.annotation.RequiresPermission; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | import android.os.Bundle; |
Yohei Yukawa | 23cbe85 | 2016-05-17 16:42:58 -0700 | [diff] [blame] | 24 | import android.os.LocaleList; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | import android.os.Parcel; |
| 26 | import android.os.Parcelable; |
Yohei Yukawa | 0f5eade | 2019-01-18 08:48:07 -0800 | [diff] [blame] | 27 | import android.os.UserHandle; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | import android.text.InputType; |
| 29 | import android.text.TextUtils; |
| 30 | import android.util.Printer; |
| 31 | |
Yohei Yukawa | 152944f | 2016-06-10 19:04:34 -0700 | [diff] [blame] | 32 | import java.util.Arrays; |
| 33 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 34 | /** |
| 35 | * An EditorInfo describes several attributes of a text editing object |
| 36 | * that an input method is communicating with (typically an EditText), most |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 37 | * importantly the type of text content it contains and the current cursor position. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 38 | */ |
| 39 | public class EditorInfo implements InputType, Parcelable { |
| 40 | /** |
Yohei Yukawa | d0bbe21 | 2016-11-09 19:49:50 -0800 | [diff] [blame] | 41 | * Masks for {@link inputType} |
| 42 | * |
| 43 | * <pre> |
| 44 | * |-------|-------|-------|-------| |
| 45 | * 1111 TYPE_MASK_CLASS |
| 46 | * 11111111 TYPE_MASK_VARIATION |
| 47 | * 111111111111 TYPE_MASK_FLAGS |
| 48 | * |-------|-------|-------|-------| |
| 49 | * TYPE_NULL |
| 50 | * |-------|-------|-------|-------| |
| 51 | * 1 TYPE_CLASS_TEXT |
| 52 | * 1 TYPE_TEXT_VARIATION_URI |
| 53 | * 1 TYPE_TEXT_VARIATION_EMAIL_ADDRESS |
| 54 | * 11 TYPE_TEXT_VARIATION_EMAIL_SUBJECT |
| 55 | * 1 TYPE_TEXT_VARIATION_SHORT_MESSAGE |
| 56 | * 1 1 TYPE_TEXT_VARIATION_LONG_MESSAGE |
| 57 | * 11 TYPE_TEXT_VARIATION_PERSON_NAME |
| 58 | * 111 TYPE_TEXT_VARIATION_POSTAL_ADDRESS |
| 59 | * 1 TYPE_TEXT_VARIATION_PASSWORD |
| 60 | * 1 1 TYPE_TEXT_VARIATION_VISIBLE_PASSWORD |
| 61 | * 1 1 TYPE_TEXT_VARIATION_WEB_EDIT_TEXT |
| 62 | * 1 11 TYPE_TEXT_VARIATION_FILTER |
| 63 | * 11 TYPE_TEXT_VARIATION_PHONETIC |
| 64 | * 11 1 TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS |
| 65 | * 111 TYPE_TEXT_VARIATION_WEB_PASSWORD |
| 66 | * 1 TYPE_TEXT_FLAG_CAP_CHARACTERS |
| 67 | * 1 TYPE_TEXT_FLAG_CAP_WORDS |
| 68 | * 1 TYPE_TEXT_FLAG_CAP_SENTENCES |
| 69 | * 1 TYPE_TEXT_FLAG_AUTO_CORRECT |
| 70 | * 1 TYPE_TEXT_FLAG_AUTO_COMPLETE |
| 71 | * 1 TYPE_TEXT_FLAG_MULTI_LINE |
| 72 | * 1 TYPE_TEXT_FLAG_IME_MULTI_LINE |
| 73 | * 1 TYPE_TEXT_FLAG_NO_SUGGESTIONS |
| 74 | * |-------|-------|-------|-------| |
| 75 | * 1 TYPE_CLASS_NUMBER |
| 76 | * 1 TYPE_NUMBER_VARIATION_PASSWORD |
| 77 | * 1 TYPE_NUMBER_FLAG_SIGNED |
| 78 | * 1 TYPE_NUMBER_FLAG_DECIMAL |
| 79 | * |-------|-------|-------|-------| |
| 80 | * 11 TYPE_CLASS_PHONE |
| 81 | * |-------|-------|-------|-------| |
| 82 | * 1 TYPE_CLASS_DATETIME |
| 83 | * 1 TYPE_DATETIME_VARIATION_DATE |
| 84 | * 1 TYPE_DATETIME_VARIATION_TIME |
| 85 | * |-------|-------|-------|-------|</pre> |
| 86 | */ |
| 87 | |
| 88 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | * The content type of the text box, whose bits are defined by |
| 90 | * {@link InputType}. |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 91 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 92 | * @see InputType |
| 93 | * @see #TYPE_MASK_CLASS |
| 94 | * @see #TYPE_MASK_VARIATION |
| 95 | * @see #TYPE_MASK_FLAGS |
| 96 | */ |
| 97 | public int inputType = TYPE_NULL; |
| 98 | |
| 99 | /** |
| 100 | * Set of bits in {@link #imeOptions} that provide alternative actions |
| 101 | * associated with the "enter" key. This both helps the IME provide |
| 102 | * better feedback about what the enter key will do, and also allows it |
| 103 | * to provide alternative mechanisms for providing that command. |
| 104 | */ |
| 105 | public static final int IME_MASK_ACTION = 0x000000ff; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 106 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 107 | /** |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 108 | * Bits of {@link #IME_MASK_ACTION}: no specific action has been |
| 109 | * associated with this editor, let the editor come up with its own if |
| 110 | * it can. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 111 | */ |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 112 | public static final int IME_ACTION_UNSPECIFIED = 0x00000000; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 113 | |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 114 | /** |
| 115 | * Bits of {@link #IME_MASK_ACTION}: there is no available action. |
| 116 | */ |
| 117 | public static final int IME_ACTION_NONE = 0x00000001; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 118 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 119 | /** |
| 120 | * Bits of {@link #IME_MASK_ACTION}: the action key performs a "go" |
| 121 | * operation to take the user to the target of the text they typed. |
| 122 | * Typically used, for example, when entering a URL. |
| 123 | */ |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 124 | public static final int IME_ACTION_GO = 0x00000002; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 125 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 126 | /** |
| 127 | * Bits of {@link #IME_MASK_ACTION}: the action key performs a "search" |
| 128 | * operation, taking the user to the results of searching for the text |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 129 | * they have typed (in whatever context is appropriate). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 130 | */ |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 131 | public static final int IME_ACTION_SEARCH = 0x00000003; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 132 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 133 | /** |
| 134 | * Bits of {@link #IME_MASK_ACTION}: the action key performs a "send" |
| 135 | * operation, delivering the text to its target. This is typically used |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 136 | * when composing a message in IM or SMS where sending is immediate. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 137 | */ |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 138 | public static final int IME_ACTION_SEND = 0x00000004; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 139 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 140 | /** |
| 141 | * Bits of {@link #IME_MASK_ACTION}: the action key performs a "next" |
| 142 | * operation, taking the user to the next field that will accept text. |
| 143 | */ |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 144 | public static final int IME_ACTION_NEXT = 0x00000005; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 145 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 146 | /** |
The Android Open Source Project | 4df2423 | 2009-03-05 14:34:35 -0800 | [diff] [blame] | 147 | * Bits of {@link #IME_MASK_ACTION}: the action key performs a "done" |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 148 | * operation, typically meaning there is nothing more to input and the |
| 149 | * IME will be closed. |
The Android Open Source Project | 4df2423 | 2009-03-05 14:34:35 -0800 | [diff] [blame] | 150 | */ |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 151 | public static final int IME_ACTION_DONE = 0x00000006; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 152 | |
The Android Open Source Project | 4df2423 | 2009-03-05 14:34:35 -0800 | [diff] [blame] | 153 | /** |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 154 | * Bits of {@link #IME_MASK_ACTION}: like {@link #IME_ACTION_NEXT}, but |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 155 | * for moving to the previous field. This will normally not be used to |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 156 | * specify an action (since it precludes {@link #IME_ACTION_NEXT}), but |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 157 | * can be returned to the app if it sets {@link #IME_FLAG_NAVIGATE_PREVIOUS}. |
| 158 | */ |
| 159 | public static final int IME_ACTION_PREVIOUS = 0x00000007; |
| 160 | |
| 161 | /** |
Yohei Yukawa | d91860d | 2017-04-14 13:46:37 -0700 | [diff] [blame] | 162 | * Flag of {@link #imeOptions}: used to request that the IME should not update any personalized |
Yohei Yukawa | 5959af1 | 2016-11-10 20:18:30 -0800 | [diff] [blame] | 163 | * data such as typing history and personalized language model based on what the user typed on |
| 164 | * this text editing object. Typical use cases are: |
| 165 | * <ul> |
| 166 | * <li>When the application is in a special mode, where user's activities are expected to be |
| 167 | * not recorded in the application's history. Some web browsers and chat applications may |
| 168 | * have this kind of modes.</li> |
| 169 | * <li>When storing typing history does not make much sense. Specifying this flag in typing |
| 170 | * games may help to avoid typing history from being filled up with words that the user is |
| 171 | * less likely to type in their daily life. Another example is that when the application |
| 172 | * already knows that the expected input is not a valid word (e.g. a promotion code that is |
| 173 | * not a valid word in any natural language).</li> |
| 174 | * </ul> |
| 175 | * |
| 176 | * <p>Applications need to be aware that the flag is not a guarantee, and some IMEs may not |
| 177 | * respect it.</p> |
| 178 | */ |
| 179 | public static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 0x1000000; |
| 180 | |
| 181 | /** |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 182 | * Flag of {@link #imeOptions}: used to request that the IME never go |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 183 | * into fullscreen mode. |
| 184 | * By default, IMEs may go into full screen mode when they think |
| 185 | * it's appropriate, for example on small screens in landscape |
| 186 | * orientation where displaying a software keyboard may occlude |
| 187 | * such a large portion of the screen that the remaining part is |
| 188 | * too small to meaningfully display the application UI. |
| 189 | * If this flag is set, compliant IMEs will never go into full screen mode, |
| 190 | * and always leave some space to display the application UI. |
| 191 | * Applications need to be aware that the flag is not a guarantee, and |
| 192 | * some IMEs may ignore it. |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 193 | */ |
| 194 | public static final int IME_FLAG_NO_FULLSCREEN = 0x2000000; |
| 195 | |
| 196 | /** |
| 197 | * Flag of {@link #imeOptions}: like {@link #IME_FLAG_NAVIGATE_NEXT}, but |
| 198 | * specifies there is something interesting that a backward navigation |
| 199 | * can focus on. If the user selects the IME's facility to backward |
| 200 | * navigate, this will show up in the application as an {@link #IME_ACTION_PREVIOUS} |
| 201 | * at {@link InputConnection#performEditorAction(int) |
| 202 | * InputConnection.performEditorAction(int)}. |
| 203 | */ |
| 204 | public static final int IME_FLAG_NAVIGATE_PREVIOUS = 0x4000000; |
| 205 | |
| 206 | /** |
| 207 | * Flag of {@link #imeOptions}: used to specify that there is something |
| 208 | * interesting that a forward navigation can focus on. This is like using |
| 209 | * {@link #IME_ACTION_NEXT}, except allows the IME to be multiline (with |
| 210 | * an enter key) as well as provide forward navigation. Note that some |
| 211 | * IMEs may not be able to do this, especially when running on a small |
| 212 | * screen where there is little space. In that case it does not need to |
| 213 | * present a UI for this option. Like {@link #IME_ACTION_NEXT}, if the |
| 214 | * user selects the IME's facility to forward navigate, this will show up |
| 215 | * in the application at {@link InputConnection#performEditorAction(int) |
| 216 | * InputConnection.performEditorAction(int)}. |
| 217 | */ |
| 218 | public static final int IME_FLAG_NAVIGATE_NEXT = 0x8000000; |
| 219 | |
| 220 | /** |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 221 | * Flag of {@link #imeOptions}: used to specify that the IME does not need |
| 222 | * to show its extracted text UI. For input methods that may be fullscreen, |
| 223 | * often when in landscape mode, this allows them to be smaller and let part |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 224 | * of the application be shown behind, through transparent UI parts in the |
| 225 | * fullscreen IME. The part of the UI visible to the user may not be responsive |
| 226 | * to touch because the IME will receive touch events, which may confuse the |
Jean Chalard | 218ecd4 | 2013-11-13 15:20:38 +0900 | [diff] [blame] | 227 | * user; use {@link #IME_FLAG_NO_FULLSCREEN} instead for a better experience. |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 228 | * Using this flag is discouraged and it may become deprecated in the future. |
| 229 | * Its meaning is unclear in some situations and it may not work appropriately |
| 230 | * on older versions of the platform. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 231 | */ |
| 232 | public static final int IME_FLAG_NO_EXTRACT_UI = 0x10000000; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 233 | |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 234 | /** |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 235 | * Flag of {@link #imeOptions}: used in conjunction with one of the actions |
| 236 | * masked by {@link #IME_MASK_ACTION}, this indicates that the action |
| 237 | * should not be available as an accessory button on the right of the extracted |
| 238 | * text when the input method is full-screen. Note that by setting this flag, |
| 239 | * there can be cases where the action is simply never available to the |
| 240 | * user. Setting this generally means that you think that in fullscreen mode, |
| 241 | * where there is little space to show the text, it's not worth taking some |
| 242 | * screen real estate to display the action and it should be used instead |
| 243 | * to show more text. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 244 | */ |
| 245 | public static final int IME_FLAG_NO_ACCESSORY_ACTION = 0x20000000; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 246 | |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 247 | /** |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 248 | * Flag of {@link #imeOptions}: used in conjunction with one of the actions |
| 249 | * masked by {@link #IME_MASK_ACTION}. If this flag is not set, IMEs will |
| 250 | * normally replace the "enter" key with the action supplied. This flag |
| 251 | * indicates that the action should not be available in-line as a replacement |
| 252 | * for the "enter" key. Typically this is because the action has such a |
| 253 | * significant impact or is not recoverable enough that accidentally hitting |
| 254 | * it should be avoided, such as sending a message. Note that |
| 255 | * {@link android.widget.TextView} will automatically set this flag for you |
| 256 | * on multi-line text views. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 257 | */ |
| 258 | public static final int IME_FLAG_NO_ENTER_ACTION = 0x40000000; |
Leon Scroggins | 2edd682 | 2010-01-12 11:36:13 -0500 | [diff] [blame] | 259 | |
| 260 | /** |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 261 | * Flag of {@link #imeOptions}: used to request an IME that is capable of |
Ken Wakasa | c8f4183 | 2012-01-12 22:51:55 +0900 | [diff] [blame] | 262 | * inputting ASCII characters. The intention of this flag is to ensure that |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 263 | * the user can type Roman alphabet characters in a {@link android.widget.TextView}. |
| 264 | * It is typically used for an account ID or password input. A lot of the time, |
| 265 | * IMEs are already able to input ASCII even without being told so (such IMEs |
| 266 | * already respect this flag in a sense), but there are cases when this is not |
| 267 | * the default. For instance, users of languages using a different script like |
| 268 | * Arabic, Greek, Hebrew or Russian typically have a keyboard that can't |
| 269 | * input ASCII characters by default. Applications need to be |
| 270 | * aware that the flag is not a guarantee, and some IMEs may not respect it. |
Ken Wakasa | c8f4183 | 2012-01-12 22:51:55 +0900 | [diff] [blame] | 271 | * However, it is strongly recommended for IME authors to respect this flag |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 272 | * especially when their IME could end up with a state where only languages |
| 273 | * using non-ASCII are enabled. |
Ken Wakasa | c8f4183 | 2012-01-12 22:51:55 +0900 | [diff] [blame] | 274 | */ |
| 275 | public static final int IME_FLAG_FORCE_ASCII = 0x80000000; |
| 276 | |
| 277 | /** |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 278 | * Generic unspecified type for {@link #imeOptions}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 279 | */ |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 280 | public static final int IME_NULL = 0x00000000; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 281 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 282 | /** |
Yohei Yukawa | d0bbe21 | 2016-11-09 19:49:50 -0800 | [diff] [blame] | 283 | * Masks for {@link imeOptions} |
| 284 | * |
| 285 | * <pre> |
| 286 | * |-------|-------|-------|-------| |
| 287 | * 1111 IME_MASK_ACTION |
| 288 | * |-------|-------|-------|-------| |
| 289 | * IME_ACTION_UNSPECIFIED |
| 290 | * 1 IME_ACTION_NONE |
| 291 | * 1 IME_ACTION_GO |
| 292 | * 11 IME_ACTION_SEARCH |
| 293 | * 1 IME_ACTION_SEND |
| 294 | * 1 1 IME_ACTION_NEXT |
| 295 | * 11 IME_ACTION_DONE |
| 296 | * 111 IME_ACTION_PREVIOUS |
Yohei Yukawa | 5959af1 | 2016-11-10 20:18:30 -0800 | [diff] [blame] | 297 | * 1 IME_FLAG_NO_PERSONALIZED_LEARNING |
Yohei Yukawa | d0bbe21 | 2016-11-09 19:49:50 -0800 | [diff] [blame] | 298 | * 1 IME_FLAG_NO_FULLSCREEN |
| 299 | * 1 IME_FLAG_NAVIGATE_PREVIOUS |
| 300 | * 1 IME_FLAG_NAVIGATE_NEXT |
| 301 | * 1 IME_FLAG_NO_EXTRACT_UI |
| 302 | * 1 IME_FLAG_NO_ACCESSORY_ACTION |
| 303 | * 1 IME_FLAG_NO_ENTER_ACTION |
| 304 | * 1 IME_FLAG_FORCE_ASCII |
| 305 | * |-------|-------|-------|-------|</pre> |
| 306 | */ |
| 307 | |
| 308 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 309 | * Extended type information for the editor, to help the IME better |
| 310 | * integrate with it. |
| 311 | */ |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 312 | public int imeOptions = IME_NULL; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 313 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 314 | /** |
| 315 | * A string supplying additional information options that are |
| 316 | * private to a particular IME implementation. The string must be |
| 317 | * scoped to a package owned by the implementation, to ensure there are |
| 318 | * no conflicts between implementations, but other than that you can put |
| 319 | * whatever you want in it to communicate with the IME. For example, |
| 320 | * you could have a string that supplies an argument like |
| 321 | * <code>"com.example.myapp.SpecialMode=3"</code>. This field is can be |
| 322 | * filled in from the {@link android.R.attr#privateImeOptions} |
| 323 | * attribute of a TextView. |
| 324 | */ |
| 325 | public String privateImeOptions = null; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 326 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 327 | /** |
| 328 | * In some cases an IME may be able to display an arbitrary label for |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 329 | * a command the user can perform, which you can specify here. This is |
| 330 | * typically used as the label for the action to use in-line as a replacement |
| 331 | * for the "enter" key (see {@link #actionId}). Remember the key where |
| 332 | * this will be displayed is typically very small, and there are significant |
| 333 | * localization challenges to make this fit in all supported languages. Also |
| 334 | * you can not count absolutely on this being used, as some IMEs may |
| 335 | * ignore this. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 336 | */ |
| 337 | public CharSequence actionLabel = null; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 338 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 339 | /** |
| 340 | * If {@link #actionLabel} has been given, this is the id for that command |
| 341 | * when the user presses its button that is delivered back with |
| 342 | * {@link InputConnection#performEditorAction(int) |
| 343 | * InputConnection.performEditorAction()}. |
| 344 | */ |
| 345 | public int actionId = 0; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 346 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 347 | /** |
| 348 | * The text offset of the start of the selection at the time editing |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 349 | * begins; -1 if not known. Keep in mind that, without knowing the cursor |
| 350 | * position, many IMEs will not be able to offer their full feature set and |
| 351 | * may even behave in unpredictable ways: pass the actual cursor position |
| 352 | * here if possible at all. |
| 353 | * |
| 354 | * <p>Also, this needs to be the cursor position <strong>right now</strong>, |
| 355 | * not at some point in the past, even if input is starting in the same text field |
| 356 | * as before. When the app is filling this object, input is about to start by |
| 357 | * definition, and this value will override any value the app may have passed to |
| 358 | * {@link InputMethodManager#updateSelection(android.view.View, int, int, int, int)} |
| 359 | * before.</p> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 360 | */ |
| 361 | public int initialSelStart = -1; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 362 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 363 | /** |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 364 | * <p>The text offset of the end of the selection at the time editing |
| 365 | * begins; -1 if not known. Keep in mind that, without knowing the cursor |
| 366 | * position, many IMEs will not be able to offer their full feature set and |
| 367 | * may behave in unpredictable ways: pass the actual cursor position |
| 368 | * here if possible at all.</p> |
| 369 | * |
| 370 | * <p>Also, this needs to be the cursor position <strong>right now</strong>, |
| 371 | * not at some point in the past, even if input is starting in the same text field |
| 372 | * as before. When the app is filling this object, input is about to start by |
| 373 | * definition, and this value will override any value the app may have passed to |
| 374 | * {@link InputMethodManager#updateSelection(android.view.View, int, int, int, int)} |
| 375 | * before.</p> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 376 | */ |
| 377 | public int initialSelEnd = -1; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 378 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 379 | /** |
| 380 | * The capitalization mode of the first character being edited in the |
| 381 | * text. Values may be any combination of |
| 382 | * {@link TextUtils#CAP_MODE_CHARACTERS TextUtils.CAP_MODE_CHARACTERS}, |
| 383 | * {@link TextUtils#CAP_MODE_WORDS TextUtils.CAP_MODE_WORDS}, and |
| 384 | * {@link TextUtils#CAP_MODE_SENTENCES TextUtils.CAP_MODE_SENTENCES}, though |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 385 | * you should generally just take a non-zero value to mean "start out in |
| 386 | * caps mode". |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 387 | */ |
| 388 | public int initialCapsMode = 0; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 389 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 390 | /** |
| 391 | * The "hint" text of the text view, typically shown in-line when the |
| 392 | * text is empty to tell the user what to enter. |
| 393 | */ |
| 394 | public CharSequence hintText; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 395 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 396 | /** |
| 397 | * A label to show to the user describing the text they are writing. |
| 398 | */ |
| 399 | public CharSequence label; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 400 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 401 | /** |
| 402 | * Name of the package that owns this editor. |
Yohei Yukawa | 915e2c7 | 2015-06-08 17:05:44 -0700 | [diff] [blame] | 403 | * |
| 404 | * <p><strong>IME authors:</strong> In API level 22 |
| 405 | * {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1} and prior, do not trust this package |
| 406 | * name. The system had not verified the consistency between the package name here and |
| 407 | * application's uid. Consider to use {@link InputBinding#getUid()}, which is trustworthy. |
Dianne Hackborn | 0e3de6c | 2015-07-29 15:20:21 -0700 | [diff] [blame] | 408 | * Starting from {@link android.os.Build.VERSION_CODES#M}, the system verifies the consistency |
| 409 | * between this package name and application uid before {@link EditorInfo} is passed to the |
| 410 | * input method.</p> |
Yohei Yukawa | 915e2c7 | 2015-06-08 17:05:44 -0700 | [diff] [blame] | 411 | * |
Dianne Hackborn | 0e3de6c | 2015-07-29 15:20:21 -0700 | [diff] [blame] | 412 | * <p><strong>Editor authors:</strong> Starting from {@link android.os.Build.VERSION_CODES#M}, |
| 413 | * the application is no longer |
Yohei Yukawa | 915e2c7 | 2015-06-08 17:05:44 -0700 | [diff] [blame] | 414 | * able to establish input connections if the package name provided here is inconsistent with |
Yohei Yukawa | d57ba67 | 2015-06-08 16:39:46 -0700 | [diff] [blame] | 415 | * application's uid.</p> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 416 | */ |
| 417 | public String packageName; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 418 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 419 | /** |
| 420 | * Identifier for the editor's field. This is optional, and may be |
| 421 | * 0. By default it is filled in with the result of |
| 422 | * {@link android.view.View#getId() View.getId()} on the View that |
| 423 | * is being edited. |
| 424 | */ |
| 425 | public int fieldId; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 426 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 427 | /** |
| 428 | * Additional name for the editor's field. This can supply additional |
| 429 | * name information for the field. By default it is null. The actual |
| 430 | * contents have no meaning. |
| 431 | */ |
| 432 | public String fieldName; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 433 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 434 | /** |
| 435 | * Any extra data to supply to the input method. This is for extended |
| 436 | * communication with specific input methods; the name fields in the |
| 437 | * bundle should be scoped (such as "com.mydomain.im.SOME_FIELD") so |
Jean Chalard | c1a11f17 | 2013-11-11 17:47:51 +0900 | [diff] [blame] | 438 | * that they don't conflict with others. This field can be |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 439 | * filled in from the {@link android.R.attr#editorExtras} |
| 440 | * attribute of a TextView. |
| 441 | */ |
| 442 | public Bundle extras; |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 443 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 444 | /** |
Yohei Yukawa | d469f21 | 2016-01-21 12:38:09 -0800 | [diff] [blame] | 445 | * List of the languages that the user is supposed to switch to no matter what input method |
| 446 | * subtype is currently used. This special "hint" can be used mainly for, but not limited to, |
| 447 | * multilingual users who want IMEs to switch language context automatically. |
Yohei Yukawa | 8d6eeb0 | 2015-12-03 11:27:32 -0800 | [diff] [blame] | 448 | * |
Yohei Yukawa | d469f21 | 2016-01-21 12:38:09 -0800 | [diff] [blame] | 449 | * <p>{@code null} means that no special language "hint" is needed.</p> |
Yohei Yukawa | 8d6eeb0 | 2015-12-03 11:27:32 -0800 | [diff] [blame] | 450 | * |
Yohei Yukawa | d469f21 | 2016-01-21 12:38:09 -0800 | [diff] [blame] | 451 | * <p><strong>Editor authors:</strong> Specify this only when you are confident that the user |
| 452 | * will switch to certain languages in this context no matter what input method subtype is |
| 453 | * currently selected. Otherwise, keep this {@code null}. Explicit user actions and/or |
| 454 | * preferences would be good signals to specify this special "hint", For example, a chat |
| 455 | * application may be able to put the last used language at the top of {@link #hintLocales} |
| 456 | * based on whom the user is going to talk, by remembering what language is used in the last |
| 457 | * conversation. Do not specify {@link android.widget.TextView#getTextLocales()} only because |
| 458 | * it is used for text rendering.</p> |
| 459 | * |
| 460 | * @see android.widget.TextView#setImeHintLocales(LocaleList) |
| 461 | * @see android.widget.TextView#getImeHintLocales() |
Yohei Yukawa | 8d6eeb0 | 2015-12-03 11:27:32 -0800 | [diff] [blame] | 462 | */ |
Yohei Yukawa | d469f21 | 2016-01-21 12:38:09 -0800 | [diff] [blame] | 463 | @Nullable |
| 464 | public LocaleList hintLocales = null; |
Yohei Yukawa | 8d6eeb0 | 2015-12-03 11:27:32 -0800 | [diff] [blame] | 465 | |
Yohei Yukawa | 152944f | 2016-06-10 19:04:34 -0700 | [diff] [blame] | 466 | |
| 467 | /** |
| 468 | * List of acceptable MIME types for |
Yohei Yukawa | 45700fa | 2016-06-23 17:12:59 -0700 | [diff] [blame] | 469 | * {@link InputConnection#commitContent(InputContentInfo, int, Bundle)}. |
Yohei Yukawa | 152944f | 2016-06-10 19:04:34 -0700 | [diff] [blame] | 470 | * |
| 471 | * <p>{@code null} or an empty array means that |
Yohei Yukawa | 45700fa | 2016-06-23 17:12:59 -0700 | [diff] [blame] | 472 | * {@link InputConnection#commitContent(InputContentInfo, int, Bundle)} is not supported in this |
Yohei Yukawa | 152944f | 2016-06-10 19:04:34 -0700 | [diff] [blame] | 473 | * editor.</p> |
| 474 | */ |
| 475 | @Nullable |
| 476 | public String[] contentMimeTypes = null; |
| 477 | |
Yohei Yukawa | 8d6eeb0 | 2015-12-03 11:27:32 -0800 | [diff] [blame] | 478 | /** |
Yohei Yukawa | 0f5eade | 2019-01-18 08:48:07 -0800 | [diff] [blame] | 479 | * If not {@code null}, this editor needs to talk to IMEs that run for the specified user, no |
| 480 | * matter what user ID the calling process has. |
| 481 | * |
Yohei Yukawa | 716897c | 2019-01-22 00:00:53 -0800 | [diff] [blame] | 482 | * <p>Note: This field will be silently ignored when |
| 483 | * {@link android.view.inputmethod.InputMethodSystemProperty#MULTI_CLIENT_IME_ENABLED} is |
| 484 | * {@code true}.</p> |
Yohei Yukawa | 0f5eade | 2019-01-18 08:48:07 -0800 | [diff] [blame] | 485 | * |
| 486 | * <p>Note also that pseudo handles such as {@link UserHandle#ALL} are not supported.</p> |
| 487 | * |
| 488 | * @hide |
| 489 | */ |
| 490 | @RequiresPermission(INTERACT_ACROSS_USERS_FULL) |
| 491 | @Nullable |
| 492 | public UserHandle targetInputMethodUser = null; |
| 493 | |
| 494 | /** |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 495 | * Ensure that the data in this EditorInfo is compatible with an application |
| 496 | * that was developed against the given target API version. This can |
| 497 | * impact the following input types: |
| 498 | * {@link InputType#TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS}, |
Ken Wakasa | 82d731a | 2010-12-24 23:42:41 +0900 | [diff] [blame] | 499 | * {@link InputType#TYPE_TEXT_VARIATION_WEB_PASSWORD}, |
| 500 | * {@link InputType#TYPE_NUMBER_VARIATION_NORMAL}, |
| 501 | * {@link InputType#TYPE_NUMBER_VARIATION_PASSWORD}. |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 502 | * |
| 503 | * <p>This is called by the framework for input method implementations; |
| 504 | * you should not generally need to call it yourself. |
| 505 | * |
| 506 | * @param targetSdkVersion The API version number that the compatible |
| 507 | * application was developed against. |
| 508 | */ |
| 509 | public final void makeCompatible(int targetSdkVersion) { |
| 510 | if (targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB) { |
| 511 | switch (inputType&(TYPE_MASK_CLASS|TYPE_MASK_VARIATION)) { |
| 512 | case TYPE_CLASS_TEXT|TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: |
| 513 | inputType = TYPE_CLASS_TEXT|TYPE_TEXT_VARIATION_EMAIL_ADDRESS |
Ken Wakasa | 82d731a | 2010-12-24 23:42:41 +0900 | [diff] [blame] | 514 | | (inputType&TYPE_MASK_FLAGS); |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 515 | break; |
| 516 | case TYPE_CLASS_TEXT|TYPE_TEXT_VARIATION_WEB_PASSWORD: |
| 517 | inputType = TYPE_CLASS_TEXT|TYPE_TEXT_VARIATION_PASSWORD |
Ken Wakasa | 82d731a | 2010-12-24 23:42:41 +0900 | [diff] [blame] | 518 | | (inputType&TYPE_MASK_FLAGS); |
| 519 | break; |
| 520 | case TYPE_CLASS_NUMBER|TYPE_NUMBER_VARIATION_NORMAL: |
| 521 | case TYPE_CLASS_NUMBER|TYPE_NUMBER_VARIATION_PASSWORD: |
| 522 | inputType = TYPE_CLASS_NUMBER |
| 523 | | (inputType&TYPE_MASK_FLAGS); |
Dianne Hackborn | dea3ef7 | 2010-10-28 14:24:22 -0700 | [diff] [blame] | 524 | break; |
| 525 | } |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 530 | * Write debug output of this object. |
| 531 | */ |
| 532 | public void dump(Printer pw, String prefix) { |
| 533 | pw.println(prefix + "inputType=0x" + Integer.toHexString(inputType) |
| 534 | + " imeOptions=0x" + Integer.toHexString(imeOptions) |
| 535 | + " privateImeOptions=" + privateImeOptions); |
| 536 | pw.println(prefix + "actionLabel=" + actionLabel |
| 537 | + " actionId=" + actionId); |
| 538 | pw.println(prefix + "initialSelStart=" + initialSelStart |
| 539 | + " initialSelEnd=" + initialSelEnd |
| 540 | + " initialCapsMode=0x" |
| 541 | + Integer.toHexString(initialCapsMode)); |
| 542 | pw.println(prefix + "hintText=" + hintText |
| 543 | + " label=" + label); |
| 544 | pw.println(prefix + "packageName=" + packageName |
| 545 | + " fieldId=" + fieldId |
| 546 | + " fieldName=" + fieldName); |
| 547 | pw.println(prefix + "extras=" + extras); |
Yohei Yukawa | d469f21 | 2016-01-21 12:38:09 -0800 | [diff] [blame] | 548 | pw.println(prefix + "hintLocales=" + hintLocales); |
Yohei Yukawa | 152944f | 2016-06-10 19:04:34 -0700 | [diff] [blame] | 549 | pw.println(prefix + "contentMimeTypes=" + Arrays.toString(contentMimeTypes)); |
Yohei Yukawa | 0f5eade | 2019-01-18 08:48:07 -0800 | [diff] [blame] | 550 | if (targetInputMethodUser != null) { |
| 551 | pw.println(prefix + "targetInputMethodUserId=" + targetInputMethodUser.getIdentifier()); |
| 552 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 553 | } |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 554 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 555 | /** |
| 556 | * Used to package this object into a {@link Parcel}. |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 557 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 558 | * @param dest The {@link Parcel} to be written. |
| 559 | * @param flags The flags used for parceling. |
| 560 | */ |
| 561 | public void writeToParcel(Parcel dest, int flags) { |
| 562 | dest.writeInt(inputType); |
| 563 | dest.writeInt(imeOptions); |
| 564 | dest.writeString(privateImeOptions); |
| 565 | TextUtils.writeToParcel(actionLabel, dest, flags); |
| 566 | dest.writeInt(actionId); |
| 567 | dest.writeInt(initialSelStart); |
| 568 | dest.writeInt(initialSelEnd); |
| 569 | dest.writeInt(initialCapsMode); |
| 570 | TextUtils.writeToParcel(hintText, dest, flags); |
| 571 | TextUtils.writeToParcel(label, dest, flags); |
| 572 | dest.writeString(packageName); |
| 573 | dest.writeInt(fieldId); |
| 574 | dest.writeString(fieldName); |
| 575 | dest.writeBundle(extras); |
Yohei Yukawa | d469f21 | 2016-01-21 12:38:09 -0800 | [diff] [blame] | 576 | if (hintLocales != null) { |
| 577 | hintLocales.writeToParcel(dest, flags); |
| 578 | } else { |
| 579 | LocaleList.getEmptyLocaleList().writeToParcel(dest, flags); |
| 580 | } |
Yohei Yukawa | 152944f | 2016-06-10 19:04:34 -0700 | [diff] [blame] | 581 | dest.writeStringArray(contentMimeTypes); |
Yohei Yukawa | 0f5eade | 2019-01-18 08:48:07 -0800 | [diff] [blame] | 582 | UserHandle.writeToParcel(targetInputMethodUser, dest); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | /** |
| 586 | * Used to make this class parcelable. |
| 587 | */ |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 588 | public static final @android.annotation.NonNull Parcelable.Creator<EditorInfo> CREATOR = |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 589 | new Parcelable.Creator<EditorInfo>() { |
| 590 | public EditorInfo createFromParcel(Parcel source) { |
| 591 | EditorInfo res = new EditorInfo(); |
| 592 | res.inputType = source.readInt(); |
| 593 | res.imeOptions = source.readInt(); |
| 594 | res.privateImeOptions = source.readString(); |
| 595 | res.actionLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); |
| 596 | res.actionId = source.readInt(); |
| 597 | res.initialSelStart = source.readInt(); |
| 598 | res.initialSelEnd = source.readInt(); |
| 599 | res.initialCapsMode = source.readInt(); |
| 600 | res.hintText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); |
| 601 | res.label = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); |
| 602 | res.packageName = source.readString(); |
| 603 | res.fieldId = source.readInt(); |
| 604 | res.fieldName = source.readString(); |
| 605 | res.extras = source.readBundle(); |
Yohei Yukawa | d469f21 | 2016-01-21 12:38:09 -0800 | [diff] [blame] | 606 | LocaleList hintLocales = LocaleList.CREATOR.createFromParcel(source); |
| 607 | res.hintLocales = hintLocales.isEmpty() ? null : hintLocales; |
Yohei Yukawa | 152944f | 2016-06-10 19:04:34 -0700 | [diff] [blame] | 608 | res.contentMimeTypes = source.readStringArray(); |
Yohei Yukawa | 0f5eade | 2019-01-18 08:48:07 -0800 | [diff] [blame] | 609 | res.targetInputMethodUser = UserHandle.readFromParcel(source); |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 610 | return res; |
| 611 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 612 | |
Jean Chalard | 6fd68e0 | 2014-02-20 17:48:46 +0900 | [diff] [blame] | 613 | public EditorInfo[] newArray(int size) { |
| 614 | return new EditorInfo[size]; |
| 615 | } |
| 616 | }; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 617 | |
| 618 | public int describeContents() { |
| 619 | return 0; |
| 620 | } |
| 621 | |
| 622 | } |