Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: content/public/android/frameworks/src/ViewStructure.java

Issue 1246823003: Provide an accessibility tree snapshot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package android.view;
6
7
8 import android.graphics.Matrix;
9 import android.graphics.Rect;
10 import android.os.Bundle;
11
12 /**
13 * Container for storing view information.
14 */
15 public abstract class ViewStructure {
16 /**
17 * Set the identifier for this view.
18 *
19 * @param id The view's identifier, as per {@link View#getId View.getId()}.
20 * @param packageName The package name of the view's identifier, or null if there is none.
21 * @param typeName The type name of the view's identifier, or null if there is none.
22 * @param entryName The entry name of the view's identifier, or null if ther e is none.
23 */
24 public abstract void setId(int id, String packageName, String typeName, Stri ng entryName);
25
26 /**
27 * Set the basic dimensions of this view.
28 *
29 * @param left The view's left position, in pixels relative to its parent's left edge.
30 * @param top The view's top position, in pixels relative to its parent's to p edge.
31 * @param scrollX How much the view's x coordinate space has been scrolled, in pixels.
32 * @param scrollY How much the view's y coordinate space has been scrolled, in pixels.
33 * @param width The view's visible width, in pixels. This is the width visi ble on screen,
34 * not the total data width of a scrollable view.
35 * @param height The view's visible height, in pixels. This is the height v isible on
36 * screen, not the total data height of a scrollable view.
37 */
38 public abstract void setDimens(int left, int top, int scrollX, int scrollY, int width,
39 int height);
40
41 /**
42 * Set the transformation matrix associated with this view, as per
43 * {@link View#getMatrix View.getMatrix()}, or null if there is none.
44 */
45 public abstract void setTransformation(Matrix matrix);
46
47 /**
48 * Set the visual elevation (shadow) of the view, as per
49 * {@link View#getZ View.getZ()}. Note this is <em>not</em> related
50 * to the physical Z-ordering of this view relative to its other siblings (t hat is how
51 * they overlap when drawing), it is only the visual representation for shad owing.
52 */
53 public abstract void setElevation(float elevation);
54
55 /**
56 * Set an alpha transformation that is applied to this view, as per
57 * {@link View#getAlpha View.getAlpha()}. Value ranges from 0
58 * (completely transparent) to 1 (completely opaque); the default is 1, whic h means
59 * no transformation.
60 */
61 public abstract void setAlpha(float alpha);
62
63 /**
64 * Set the visibility state of this view, as per
65 * {@link View#getVisibility View.getVisibility()}.
66 */
67 public abstract void setVisibility(int visibility);
68
69 /** @hide */
70 public abstract void setAssistBlocked(boolean state);
71
72 /**
73 * Set the enabled state of this view, as per {@link View#isEnabled View.isE nabled()}.
74 */
75 public abstract void setEnabled(boolean state);
76
77 /**
78 * Set the clickable state of this view, as per {@link View#isClickable View .isClickable()}.
79 */
80 public abstract void setClickable(boolean state);
81
82 /**
83 * Set the long clickable state of this view, as per
84 * {@link View#isLongClickable View.isLongClickable()}.
85 */
86 public abstract void setLongClickable(boolean state);
87
88 /**
89 * Set the context clickable state of this view, as per
90 * {@link View#isContextClickable View.isContextClickable()}.
91 */
92 public abstract void setContextClickable(boolean state);
93
94 /**
95 * Set the focusable state of this view, as per {@link View#isFocusable View .isFocusable()}.
96 */
97 public abstract void setFocusable(boolean state);
98
99 /**
100 * Set the focused state of this view, as per {@link View#isFocused View.isF ocused()}.
101 */
102 public abstract void setFocused(boolean state);
103
104 /**
105 * Set the accessibility focused state of this view, as per
106 * {@link View#isAccessibilityFocused View.isAccessibilityFocused()}.
107 */
108 public abstract void setAccessibilityFocused(boolean state);
109
110 /**
111 * Set the checkable state of this view, such as whether it implements the
112 * {@link android.widget.Checkable} interface.
113 */
114 public abstract void setCheckable(boolean state);
115
116 /**
117 * Set the checked state of this view, such as
118 * {@link android.widget.Checkable#isChecked Checkable.isChecked()}.
119 */
120 public abstract void setChecked(boolean state);
121
122 /**
123 * Set the selected state of this view, as per {@link View#isSelected View.i sSelected()}.
124 */
125 public abstract void setSelected(boolean state);
126
127 /**
128 * Set the activated state of this view, as per {@link View#isActivated View .isActivated()}.
129 */
130 public abstract void setActivated(boolean state);
131
132 /**
133 * Set the class name of the view, as per
134 * {@link View#getAccessibilityClassName View.getAccessibilityClassName()}.
135 */
136 public abstract void setClassName(String className);
137
138 /**
139 * Set the content description of the view, as per
140 * {@link View#getContentDescription View.getContentDescription()}.
141 */
142 public abstract void setContentDescription(CharSequence contentDescription);
143
144 /**
145 * Set the text that is associated with this view. There is no selection
146 * associated with the text. The text may have style spans to supply additi onal
147 * display and semantic information.
148 */
149 public abstract void setText(CharSequence text);
150
151 /**
152 * Like {@link #setText(CharSequence)} but with an active selection
153 * extending from <var>selectionStart</var> through <var>selectionEnd</var>.
154 */
155 public abstract void setText(CharSequence text, int selectionStart, int sele ctionEnd);
156
157 /**
158 * Explicitly set default global style information for text that was previou sly set with
159 * {@link #setText}.
160 *
161 * @param size The size, in pixels, of the text.
162 * @param fgColor The foreground color, packed as 0xAARRGGBB.
163 * @param bgColor The background color, packed as 0xAARRGGBB.
164 * @param style Style flags, as defined by {@link android.app.assist.AssistS tructure.ViewNode}.
165 */
166 public abstract void setTextStyle(float size, int fgColor, int bgColor, int style);
167
168 /**
169 * Set line information for test that was previously supplied through
170 * {@link #setText(CharSequence)}. This provides the line breaking of the t ext as it
171 * is shown on screen. This function takes ownership of the provided arrays ; you should
172 * not make further modification to them.
173 *
174 * @param charOffsets The offset in to {@link #setText} where a line starts.
175 * @param baselines The baseline where the line is drawn on screen.
176 */
177 public abstract void setTextLines(int[] charOffsets, int[] baselines);
178
179 /**
180 * Set optional hint text associated with this view; this is for example the text that is
181 * shown by an EditText when it is empty to indicate to the user the kind of text to input.
182 */
183 public abstract void setHint(CharSequence hint);
184
185 /**
186 * Retrieve the last {@link #setText(CharSequence)}.
187 */
188 public abstract CharSequence getText();
189
190 /**
191 * Retrieve the last selection start set by {@link #setText(CharSequence, in t, int)}.
192 */
193 public abstract int getTextSelectionStart();
194
195 /**
196 * Retrieve the last selection end set by {@link #setText(CharSequence, int, int)}.
197 */
198 public abstract int getTextSelectionEnd();
199
200 /**
201 * Retrieve the last hint set by {@link #setHint}.
202 */
203 public abstract CharSequence getHint();
204
205 /**
206 * Get extra data associated with this view structure; the returned Bundle i s mutable,
207 * allowing you to view and modify its contents. Keys placed in the Bundle should use
208 * an appropriate namespace prefix (such as com.google.MY_KEY) to avoid conf licts.
209 */
210 public abstract Bundle getExtras();
211
212 /**
213 * Returns true if {@link #getExtras} has been used to create extra content.
214 */
215 public abstract boolean hasExtras();
216
217 /**
218 * Set the number of children of this view, which defines the range of indic es you can
219 * use with {@link #newChild} and {@link #asyncNewChild}. Calling this meth od again
220 * resets all of the child state of the view, removing any children that had previously
221 * been added.
222 */
223 public abstract void setChildCount(int num);
224
225 /**
226 * Add to this view's child count. This increases the current child count b y
227 * <var>num</var> children beyond what was last set by {@link #setChildCount }
228 * or {@link #addChildCount}. The index at which the new child starts in th e child
229 * array is returned.
230 *
231 * @param num The number of new children to add.
232 * @return Returns the index in the child array at which the new children st art.
233 */
234 public abstract int addChildCount(int num);
235
236 /**
237 * Return the child count as set by {@link #setChildCount}.
238 */
239 public abstract int getChildCount();
240
241 /**
242 * Create a new child {@link ViewStructure} in this view, putting into the l ist of
243 * children at <var>index</var>.
244 * @return Returns an fresh {@link ViewStructure} ready to be filled in.
245 */
246 public abstract ViewStructure newChild(int index);
247
248 /**
249 * Like {@link #newChild}, but allows the caller to asynchronously populate the returned
250 * child. It can transfer the returned {@link ViewStructure} to another thr ead for it
251 * to build its content (and children etc). Once done, some thread must cal l
252 * {@link #asyncCommit} to tell the containing {@link ViewStructure} that th e async
253 * population is done.
254 * @return Returns an fresh {@link ViewStructure} ready to be filled in.
255 */
256 public abstract ViewStructure asyncNewChild(int index);
257
258 /**
259 * Call when done populating a {@link ViewStructure} returned by
260 * {@link #asyncNewChild}.
261 */
262 public abstract void asyncCommit();
263
264 /** @hide */
265 public abstract Rect getTempRect();
266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698