Lines Matching defs:item

77         // Adds an item at the top-left quarter of the custom view.
80 // Adds an item at the bottom-right quarter of the custom view.
84 // Add an item at the bottom quarter of Item B.
89 // Add an item at the left quarter of Item C.
98 * Simple custom view that draws rectangular items to the screen. Each item
99 * has a checked state that may be toggled by tapping on the item.
144 * Adds an item to the custom view. The item is positioned relative to
147 * @param description The item's description.
159 final CustomItem item = new CustomItem();
160 item.mId = mItems.size();
161 item.mBounds = new RectF(left, top, right, bottom);
162 item.mDescription = description;
163 item.mChecked = false;
164 mItems.add(item);
165 return item;
171 * @param item CustomItem that will become a child node.
174 public void setParentItem(CustomItem item, CustomItem parent) {
175 item.mParent = parent;
176 parent.mChildren.add(item.mId);
180 * Walk the view hierarchy of each item and calculate mBoundsInRoot.
183 for (CustomItem item : mItems) {
184 layoutItem(item);
188 void layoutItem(CustomItem item) {
189 item.mBoundsInRoot = new RectF(item.mBounds);
190 CustomItem parent = item.mParent;
192 RectF bounds = item.mBoundsInRoot;
193 item.mBoundsInRoot.set(parent.mBounds.left + bounds.left * parent.mBounds.width(),
210 for (CustomItem item : mItems) {
211 if (item.mParent == null) {
212 paint.setColor(item.mChecked ? Color.RED : Color.BLUE);
214 paint.setColor(item.mChecked ? Color.MAGENTA : Color.GREEN);
217 scaleRectF(item.mBoundsInRoot, bounds, width, height);
221 canvas.drawText(item.mDescription, bounds.centerX(), bounds.centerY(), paint);
226 final CustomItem item = getItem(index);
227 if (item == null) {
231 item.mChecked = !item.mChecked;
234 // Since the item's checked state is exposed to accessibility
236 // the item's virtual view. At some point in the future, the
255 final CustomItem item = mItems.get(i);
256 if (item.mBoundsInRoot.contains(scaledX, scaledY)) {
301 // Since every item should be visible, and since we're mapping
302 // directly from item index to virtual view id, we can add
315 final CustomItem item = getItem(virtualViewId);
316 if (item == null) {
321 // getText().add() or setContentDescription(). Since the item's
325 event.getText().add(item.mDescription);
331 final CustomItem item = getItem(virtualViewId);
332 if (item == null) {
338 node.setText(item.mDescription);
341 // the item in onDraw(). They should also be consistent with the
347 if (item.mParent != null) {
348 width = (int) (width * item.mParent.mBoundsInRoot.width());
349 height = (int) (height * item.mParent.mBoundsInRoot.height());
351 scaleRectF(item.mBounds, bounds, width, height);
354 // Since the user can tap an item, add the CLICK action. We'll
358 // This item has a checked state.
360 node.setChecked(item.mChecked);
363 if (item.mParent != null) {
364 node.setParent(CustomView.this, item.mParent.mId);
366 for (Integer id : item.mChildren) {