Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 android.view; |
| 18 | |
Felipe Leme | f8a8174 | 2017-03-17 18:05:01 -0700 | [diff] [blame] | 19 | import android.annotation.NonNull; |
Philip P. Moltmann | 495cadd | 2017-03-10 16:45:02 -0800 | [diff] [blame] | 20 | import android.annotation.Nullable; |
Dianne Hackborn | 70d8be7 | 2015-06-23 19:33:02 +0000 | [diff] [blame] | 21 | import android.graphics.Matrix; |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 22 | import android.graphics.Rect; |
| 23 | import android.os.Bundle; |
Felipe Leme | b4ca701 | 2017-03-22 18:30:07 -0700 | [diff] [blame] | 24 | import android.os.LocaleList; |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 25 | import android.view.autofill.AutofillId; |
| 26 | import android.view.autofill.AutofillValue; |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Container for storing additional per-view data generated by {@link View#onProvideStructure |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 30 | * View.onProvideStructure} and {@link View#onProvideAutofillStructure |
| 31 | * View.onProvideAutofillStructure}. |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 32 | */ |
| 33 | public abstract class ViewStructure { |
Felipe Leme | 0200d9e | 2017-01-24 15:10:26 -0800 | [diff] [blame] | 34 | |
| 35 | /** |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 36 | * Set the identifier for this view. |
| 37 | * |
| 38 | * @param id The view's identifier, as per {@link View#getId View.getId()}. |
| 39 | * @param packageName The package name of the view's identifier, or null if there is none. |
| 40 | * @param typeName The type name of the view's identifier, or null if there is none. |
| 41 | * @param entryName The entry name of the view's identifier, or null if there is none. |
| 42 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 43 | public abstract void setId(int id, String packageName, String typeName, String entryName); |
| 44 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 45 | /** |
Felipe Leme | 1a1e468 | 2017-03-13 16:34:03 -0700 | [diff] [blame] | 46 | * Sets the name of the identifier for this view. |
| 47 | * |
| 48 | * <p>Typically used when adding virtual children (through |
Felipe Leme | 03ee781 | 2017-03-21 16:28:26 -0700 | [diff] [blame] | 49 | * {@link #asyncNewChild(int)}) that does not map to Android {@link View} |
Felipe Leme | 1a1e468 | 2017-03-13 16:34:03 -0700 | [diff] [blame] | 50 | * - otherwise, it's better to call {@link #setId(int, String, String, String)}. |
| 51 | * |
| 52 | * @param entryName The entry name of the view's identifier, or {@code null} if there is none. |
| 53 | */ |
| 54 | public abstract void setIdEntry(String entryName); |
| 55 | |
| 56 | /** |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 57 | * Set the basic dimensions of this view. |
| 58 | * |
| 59 | * @param left The view's left position, in pixels relative to its parent's left edge. |
| 60 | * @param top The view's top position, in pixels relative to its parent's top edge. |
| 61 | * @param scrollX How much the view's x coordinate space has been scrolled, in pixels. |
| 62 | * @param scrollY How much the view's y coordinate space has been scrolled, in pixels. |
| 63 | * @param width The view's visible width, in pixels. This is the width visible on screen, |
| 64 | * not the total data width of a scrollable view. |
| 65 | * @param height The view's visible height, in pixels. This is the height visible on |
| 66 | * screen, not the total data height of a scrollable view. |
| 67 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 68 | public abstract void setDimens(int left, int top, int scrollX, int scrollY, int width, |
| 69 | int height); |
| 70 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 71 | /** |
Dianne Hackborn | 70d8be7 | 2015-06-23 19:33:02 +0000 | [diff] [blame] | 72 | * Set the transformation matrix associated with this view, as per |
| 73 | * {@link View#getMatrix View.getMatrix()}, or null if there is none. |
| 74 | */ |
| 75 | public abstract void setTransformation(Matrix matrix); |
| 76 | |
| 77 | /** |
| 78 | * Set the visual elevation (shadow) of the view, as per |
| 79 | * {@link View#getZ View.getZ()}. Note this is <em>not</em> related |
| 80 | * to the physical Z-ordering of this view relative to its other siblings (that is how |
| 81 | * they overlap when drawing), it is only the visual representation for shadowing. |
| 82 | */ |
| 83 | public abstract void setElevation(float elevation); |
| 84 | |
| 85 | /** |
| 86 | * Set an alpha transformation that is applied to this view, as per |
| 87 | * {@link View#getAlpha View.getAlpha()}. Value ranges from 0 |
| 88 | * (completely transparent) to 1 (completely opaque); the default is 1, which means |
| 89 | * no transformation. |
| 90 | */ |
| 91 | public abstract void setAlpha(float alpha); |
| 92 | |
| 93 | /** |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 94 | * Set the visibility state of this view, as per |
| 95 | * {@link View#getVisibility View.getVisibility()}. |
| 96 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 97 | public abstract void setVisibility(int visibility); |
| 98 | |
| 99 | /** @hide */ |
| 100 | public abstract void setAssistBlocked(boolean state); |
| 101 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 102 | /** |
| 103 | * Set the enabled state of this view, as per {@link View#isEnabled View.isEnabled()}. |
| 104 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 105 | public abstract void setEnabled(boolean state); |
| 106 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 107 | /** |
| 108 | * Set the clickable state of this view, as per {@link View#isClickable View.isClickable()}. |
| 109 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 110 | public abstract void setClickable(boolean state); |
| 111 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 112 | /** |
| 113 | * Set the long clickable state of this view, as per |
| 114 | * {@link View#isLongClickable View.isLongClickable()}. |
| 115 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 116 | public abstract void setLongClickable(boolean state); |
| 117 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 118 | /** |
Mady Mellor | e860891 | 2015-06-05 09:02:55 -0700 | [diff] [blame] | 119 | * Set the context clickable state of this view, as per |
| 120 | * {@link View#isContextClickable View.isContextClickable()}. |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 121 | */ |
Mady Mellor | e860891 | 2015-06-05 09:02:55 -0700 | [diff] [blame] | 122 | public abstract void setContextClickable(boolean state); |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 123 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 124 | /** |
| 125 | * Set the focusable state of this view, as per {@link View#isFocusable View.isFocusable()}. |
| 126 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 127 | public abstract void setFocusable(boolean state); |
| 128 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 129 | /** |
| 130 | * Set the focused state of this view, as per {@link View#isFocused View.isFocused()}. |
| 131 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 132 | public abstract void setFocused(boolean state); |
| 133 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 134 | /** |
| 135 | * Set the accessibility focused state of this view, as per |
| 136 | * {@link View#isAccessibilityFocused View.isAccessibilityFocused()}. |
| 137 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 138 | public abstract void setAccessibilityFocused(boolean state); |
| 139 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 140 | /** |
| 141 | * Set the checkable state of this view, such as whether it implements the |
| 142 | * {@link android.widget.Checkable} interface. |
| 143 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 144 | public abstract void setCheckable(boolean state); |
| 145 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 146 | /** |
| 147 | * Set the checked state of this view, such as |
| 148 | * {@link android.widget.Checkable#isChecked Checkable.isChecked()}. |
| 149 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 150 | public abstract void setChecked(boolean state); |
| 151 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 152 | /** |
| 153 | * Set the selected state of this view, as per {@link View#isSelected View.isSelected()}. |
| 154 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 155 | public abstract void setSelected(boolean state); |
| 156 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 157 | /** |
| 158 | * Set the activated state of this view, as per {@link View#isActivated View.isActivated()}. |
| 159 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 160 | public abstract void setActivated(boolean state); |
| 161 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 162 | /** |
Amith Yamasani | 858f98d | 2017-02-22 12:59:53 -0800 | [diff] [blame] | 163 | * Set the opaque state of this view, as per {@link View#isOpaque View.isOpaque()}. |
| 164 | */ |
| 165 | public abstract void setOpaque(boolean opaque); |
| 166 | |
| 167 | /** |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 168 | * Set the class name of the view, as per |
| 169 | * {@link View#getAccessibilityClassName View.getAccessibilityClassName()}. |
| 170 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 171 | public abstract void setClassName(String className); |
| 172 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 173 | /** |
| 174 | * Set the content description of the view, as per |
| 175 | * {@link View#getContentDescription View.getContentDescription()}. |
| 176 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 177 | public abstract void setContentDescription(CharSequence contentDescription); |
| 178 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 179 | /** |
| 180 | * Set the text that is associated with this view. There is no selection |
| 181 | * associated with the text. The text may have style spans to supply additional |
| 182 | * display and semantic information. |
| 183 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 184 | public abstract void setText(CharSequence text); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 185 | |
| 186 | /** |
| 187 | * Like {@link #setText(CharSequence)} but with an active selection |
| 188 | * extending from <var>selectionStart</var> through <var>selectionEnd</var>. |
| 189 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 190 | public abstract void setText(CharSequence text, int selectionStart, int selectionEnd); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 191 | |
| 192 | /** |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 193 | * Explicitly set default global style information for text that was previously set with |
| 194 | * {@link #setText}. |
| 195 | * |
| 196 | * @param size The size, in pixels, of the text. |
| 197 | * @param fgColor The foreground color, packed as 0xAARRGGBB. |
| 198 | * @param bgColor The background color, packed as 0xAARRGGBB. |
Dianne Hackborn | 16036f2 | 2015-06-22 14:05:51 -0700 | [diff] [blame] | 199 | * @param style Style flags, as defined by {@link android.app.assist.AssistStructure.ViewNode}. |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 200 | */ |
James Cook | 5cfaae4 | 2015-05-28 15:52:44 -0700 | [diff] [blame] | 201 | public abstract void setTextStyle(float size, int fgColor, int bgColor, int style); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 202 | |
| 203 | /** |
Dianne Hackborn | 6f0fdc4 | 2015-07-07 14:29:36 -0700 | [diff] [blame] | 204 | * Set line information for test that was previously supplied through |
| 205 | * {@link #setText(CharSequence)}. This provides the line breaking of the text as it |
| 206 | * is shown on screen. This function takes ownership of the provided arrays; you should |
| 207 | * not make further modification to them. |
| 208 | * |
| 209 | * @param charOffsets The offset in to {@link #setText} where a line starts. |
| 210 | * @param baselines The baseline where the line is drawn on screen. |
| 211 | */ |
| 212 | public abstract void setTextLines(int[] charOffsets, int[] baselines); |
| 213 | |
| 214 | /** |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 215 | * Set optional hint text associated with this view; this is for example the text that is |
| 216 | * shown by an EditText when it is empty to indicate to the user the kind of text to input. |
| 217 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 218 | public abstract void setHint(CharSequence hint); |
| 219 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 220 | /** |
| 221 | * Retrieve the last {@link #setText(CharSequence)}. |
| 222 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 223 | public abstract CharSequence getText(); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 224 | |
| 225 | /** |
| 226 | * Retrieve the last selection start set by {@link #setText(CharSequence, int, int)}. |
| 227 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 228 | public abstract int getTextSelectionStart(); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 229 | |
| 230 | /** |
| 231 | * Retrieve the last selection end set by {@link #setText(CharSequence, int, int)}. |
| 232 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 233 | public abstract int getTextSelectionEnd(); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 234 | |
| 235 | /** |
| 236 | * Retrieve the last hint set by {@link #setHint}. |
| 237 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 238 | public abstract CharSequence getHint(); |
| 239 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 240 | /** |
| 241 | * Get extra data associated with this view structure; the returned Bundle is mutable, |
| 242 | * allowing you to view and modify its contents. Keys placed in the Bundle should use |
| 243 | * an appropriate namespace prefix (such as com.google.MY_KEY) to avoid conflicts. |
| 244 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 245 | public abstract Bundle getExtras(); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 246 | |
| 247 | /** |
| 248 | * Returns true if {@link #getExtras} has been used to create extra content. |
| 249 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 250 | public abstract boolean hasExtras(); |
| 251 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 252 | /** |
| 253 | * Set the number of children of this view, which defines the range of indices you can |
| 254 | * use with {@link #newChild} and {@link #asyncNewChild}. Calling this method again |
| 255 | * resets all of the child state of the view, removing any children that had previously |
| 256 | * been added. |
| 257 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 258 | public abstract void setChildCount(int num); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 259 | |
| 260 | /** |
Dianne Hackborn | ece0f4f | 2015-06-11 13:29:01 -0700 | [diff] [blame] | 261 | * Add to this view's child count. This increases the current child count by |
| 262 | * <var>num</var> children beyond what was last set by {@link #setChildCount} |
| 263 | * or {@link #addChildCount}. The index at which the new child starts in the child |
| 264 | * array is returned. |
| 265 | * |
| 266 | * @param num The number of new children to add. |
| 267 | * @return Returns the index in the child array at which the new children start. |
| 268 | */ |
| 269 | public abstract int addChildCount(int num); |
| 270 | |
| 271 | /** |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 272 | * Return the child count as set by {@link #setChildCount}. |
| 273 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 274 | public abstract int getChildCount(); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 275 | |
| 276 | /** |
| 277 | * Create a new child {@link ViewStructure} in this view, putting into the list of |
| 278 | * children at <var>index</var>. |
Felipe Leme | dbe07a5 | 2017-03-03 14:29:17 -0800 | [diff] [blame] | 279 | * |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 280 | * @return Returns an fresh {@link ViewStructure} ready to be filled in. |
| 281 | */ |
Dianne Hackborn | 8ecf16d | 2015-06-23 13:09:21 -0700 | [diff] [blame] | 282 | public abstract ViewStructure newChild(int index); |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 283 | |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 284 | /** |
| 285 | * Like {@link #newChild}, but allows the caller to asynchronously populate the returned |
| 286 | * child. It can transfer the returned {@link ViewStructure} to another thread for it |
| 287 | * to build its content (and children etc). Once done, some thread must call |
| 288 | * {@link #asyncCommit} to tell the containing {@link ViewStructure} that the async |
| 289 | * population is done. |
| 290 | * @return Returns an fresh {@link ViewStructure} ready to be filled in. |
| 291 | */ |
Dianne Hackborn | 8ecf16d | 2015-06-23 13:09:21 -0700 | [diff] [blame] | 292 | public abstract ViewStructure asyncNewChild(int index); |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 293 | |
| 294 | /** |
Felipe Leme | f8a8174 | 2017-03-17 18:05:01 -0700 | [diff] [blame] | 295 | * Sets the {@link AutofillId} for this virtual node. |
Felipe Leme | 0200d9e | 2017-01-24 15:10:26 -0800 | [diff] [blame] | 296 | * |
Felipe Leme | f8a8174 | 2017-03-17 18:05:01 -0700 | [diff] [blame] | 297 | * @param parent parent node. |
| 298 | * @param virtualId an opaque ID to the Android System; it's the same id used on |
Felipe Leme | 28afe0e | 2017-03-17 11:37:27 -0700 | [diff] [blame] | 299 | * {@link View#autofill(android.util.SparseArray)}. |
Felipe Leme | 6d55387 | 2016-12-08 17:13:25 -0800 | [diff] [blame] | 300 | */ |
Felipe Leme | f8a8174 | 2017-03-17 18:05:01 -0700 | [diff] [blame] | 301 | public abstract void setAutofillId(@NonNull ViewStructure parent, int virtualId); |
Felipe Leme | 6d55387 | 2016-12-08 17:13:25 -0800 | [diff] [blame] | 302 | |
| 303 | /** |
Felipe Leme | 8931e30 | 2017-03-06 13:44:35 -0800 | [diff] [blame] | 304 | * Sets the {@link View#getAutofillType()} that can be used to autofill this node. |
| 305 | */ |
| 306 | public abstract void setAutofillType(@View.AutofillType int type); |
| 307 | |
| 308 | /** |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 309 | * Sets the a hint that helps the autofill service to select the appropriate data to fill the |
Philip P. Moltmann | ba6f462 | 2017-02-22 11:03:53 -0800 | [diff] [blame] | 310 | * view. |
| 311 | */ |
Philip P. Moltmann | 495cadd | 2017-03-10 16:45:02 -0800 | [diff] [blame] | 312 | public abstract void setAutofillHint(@Nullable String[] hint); |
Philip P. Moltmann | ba6f462 | 2017-02-22 11:03:53 -0800 | [diff] [blame] | 313 | |
| 314 | /** |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 315 | * Sets the {@link AutofillValue} representing the current value of this node. |
Felipe Leme | 0200d9e | 2017-01-24 15:10:26 -0800 | [diff] [blame] | 316 | */ |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 317 | public abstract void setAutofillValue(AutofillValue value); |
Felipe Leme | 0200d9e | 2017-01-24 15:10:26 -0800 | [diff] [blame] | 318 | |
| 319 | /** |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 320 | * Sets the options that can be used to autofill this node. |
Felipe Leme | d09ccb8 | 2017-02-22 15:02:03 -0800 | [diff] [blame] | 321 | * |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 322 | * <p>Typically used by nodes whose {@link View#getAutofillType()} is a list to indicate the |
| 323 | * meaning of each possible value in the list. |
Felipe Leme | d09ccb8 | 2017-02-22 15:02:03 -0800 | [diff] [blame] | 324 | */ |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 325 | public abstract void setAutofillOptions(String[] options); |
Felipe Leme | d09ccb8 | 2017-02-22 15:02:03 -0800 | [diff] [blame] | 326 | |
| 327 | /** |
Felipe Leme | 16aafc3 | 2017-02-27 13:41:37 -0800 | [diff] [blame] | 328 | * Sets the {@link android.text.InputType} bits of this node. |
| 329 | * |
| 330 | * @param inputType inputType bits as defined by {@link android.text.InputType}. |
| 331 | */ |
| 332 | public abstract void setInputType(int inputType); |
| 333 | |
| 334 | /** |
Felipe Leme | c9a19b1 | 2017-03-13 18:05:22 -0700 | [diff] [blame] | 335 | * Sets whether the data on this node is sensitive; if it is, then its content (text, autofill |
| 336 | * value, etc..) is striped before calls to {@link |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 337 | * android.service.autofill.AutofillService#onFillRequest(android.app.assist.AssistStructure, |
Felipe Leme | 2ac463e | 2017-03-13 14:06:25 -0700 | [diff] [blame] | 338 | * Bundle, int, android.os.CancellationSignal, android.service.autofill.FillCallback)}. |
Felipe Leme | 0200d9e | 2017-01-24 15:10:26 -0800 | [diff] [blame] | 339 | * |
Felipe Leme | c9a19b1 | 2017-03-13 18:05:22 -0700 | [diff] [blame] | 340 | * <p>By default, all nodes are assumed to be sensitive, and only nodes that does not have PII |
| 341 | * (Personally Identifiable Information - sensitive data such as email addresses, credit card |
| 342 | * numbers, passwords, etc...) should be marked as non-sensitive; a good rule of thumb is to |
| 343 | * mark as non-sensitive nodes whose value were statically set from resources. |
| 344 | * |
| 345 | * <p>Notice that the content of even sensitive nodes are sent to the service (through the |
| 346 | * {@link |
| 347 | * android.service.autofill.AutofillService#onSaveRequest(android.app.assist.AssistStructure, |
Felipe Leme | 2ac463e | 2017-03-13 14:06:25 -0700 | [diff] [blame] | 348 | * Bundle, android.service.autofill.SaveCallback)} call) when the user consented to save |
| 349 | * thedata, so it is important to set the content of sensitive nodes as well, but mark them as |
Felipe Leme | c9a19b1 | 2017-03-13 18:05:22 -0700 | [diff] [blame] | 350 | * sensitive. |
Felipe Leme | 33791fd | 2017-02-16 08:07:56 -0800 | [diff] [blame] | 351 | * |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 352 | * <p>Should only be set when the node is used for autofill purposes - it will be ignored |
Felipe Leme | 33791fd | 2017-02-16 08:07:56 -0800 | [diff] [blame] | 353 | * when used for Assist. |
Felipe Leme | 0200d9e | 2017-01-24 15:10:26 -0800 | [diff] [blame] | 354 | */ |
Felipe Leme | c9a19b1 | 2017-03-13 18:05:22 -0700 | [diff] [blame] | 355 | public abstract void setDataIsSensitive(boolean sensitive); |
Felipe Leme | 0200d9e | 2017-01-24 15:10:26 -0800 | [diff] [blame] | 356 | |
| 357 | /** |
Dianne Hackborn | 02beb41 | 2015-05-19 11:18:16 -0700 | [diff] [blame] | 358 | * Call when done populating a {@link ViewStructure} returned by |
| 359 | * {@link #asyncNewChild}. |
| 360 | */ |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 361 | public abstract void asyncCommit(); |
| 362 | |
| 363 | /** @hide */ |
| 364 | public abstract Rect getTempRect(); |
Felipe Leme | 29a5b0d | 2016-10-25 14:57:11 -0700 | [diff] [blame] | 365 | |
| 366 | /** @hide */ |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 367 | public abstract void setAutofillId(int viewId); |
Felipe Leme | 6d55387 | 2016-12-08 17:13:25 -0800 | [diff] [blame] | 368 | |
| 369 | /** @hide */ |
Felipe Leme | 640f30a | 2017-03-06 15:44:06 -0800 | [diff] [blame] | 370 | public abstract AutofillId getAutofillId(); |
Felipe Leme | c324100 | 2017-02-15 12:55:11 -0800 | [diff] [blame] | 371 | |
| 372 | /** |
| 373 | * Sets the URL represented by this node. |
| 374 | * |
| 375 | * <p>Typically used in the following situations: |
| 376 | * |
| 377 | * <ol> |
| 378 | * <li>In a {@link android.app.assist.AssistStructure.WindowNode#getRootViewNode()}, to set up |
| 379 | * the main URL of an HTML page. |
| 380 | * <li>On child nodes represening hyperlinks. |
| 381 | * </ol> |
| 382 | */ |
| 383 | public abstract void setUrl(String url); |
Felipe Leme | b4ca701 | 2017-03-22 18:30:07 -0700 | [diff] [blame] | 384 | |
| 385 | /** |
| 386 | * Sets the the list of locales associated with this node. |
| 387 | */ |
| 388 | public abstract void setLocaleList(LocaleList localeList); |
Dianne Hackborn | 49b043f | 2015-05-07 14:21:38 -0700 | [diff] [blame] | 389 | } |