Lines Matching refs:Key
49 * <Key android:keyLabel="A" />
67 private static final String TAG_KEY = "Key";
87 /** Default key width */
90 /** Default key height */
99 /** Key instance for the shift key, if present */
100 private Key[] mShiftKeys = { null, null };
102 /** Key index for the shift key, if present */
105 /** Current key width, while loading the keyboard */
108 /** Current key height, while loading the keyboard */
121 private List<Key> mKeys;
124 private List<Key> mModifierKeys;
144 /** Number of key widths from current touch point to search for nearest keys. */
151 * Some of the key size defaults can be overridden per row from what the {@link Keyboard}
161 /** Default width of a key in this row. */
163 /** Default height of a key in this row. */
170 ArrayList<Key> mKeys = new ArrayList<Key>();
213 * Class for describing the position and characteristics of a single key in the keyboard.
230 public static class Key {
232 * All the key codes (unicode or custom code) that this key could generate, zero'th
244 /** Width of the key, not including the gap */
246 /** Height of the key, not including the gap */
248 /** The horizontal gap before this key */
250 /** Whether this key is sticky, i.e., a toggle key */
252 /** X coordinate of the key in the keyboard layout */
254 /** Y coordinate of the key in the keyboard layout */
256 /** The current pressed state of this key */
258 /** If this is a sticky key, is it on? */
267 * that are just out of the boundary of the key. This is a bit mask of
272 /** Whether this is a modifier key, such as Shift or Alt */
274 /** The keyboard that this key belongs to */
277 * If this key pops up a mini keyboard, this is the resource id for the XML layout for that
281 /** Whether this key repeats itself when held down */
312 /** Create an empty key with no attributes. */
313 public Key(Row parent) {
321 /** Create a key with the given top-left coordinate and extract its attributes from
324 * @param parent the row that this key belongs to. The row must already be attached to
328 * @param parser the XML parser containing the attributes for this key
330 public Key(Resources res, Row parent, int x, int y, XmlResourceParser parser) {
395 * Informs the key that it has been pressed, in case it needs to change its appearance or
404 * Changes the pressed state of the key. If it is a sticky key, it will also change the
405 * toggled state of the key if the finger was release inside.
406 * @param inside whether the finger was released inside the key
439 * Detects if a point falls inside this key.
442 * @return whether or not the point falls inside the key. If the key is attached to an edge,
443 * it will assume that all points between the key and the edge are considered to be inside
444 * the key.
462 * Returns the square of the distance between the center of the key and the given point.
465 * @return the square of the distance of the point from the center of the key
474 * Returns the drawable state for the key, based on the current state and type of the key.
475 * @return the drawable state of the key.
505 * Creates a keyboard from the given xml key layout file.
514 * Creates a keyboard from the given xml key layout file. Weeds out rows
530 mKeys = new ArrayList<Key>();
531 mModifierKeys = new ArrayList<Key>();
537 * Creates a keyboard from the given xml key layout file. Weeds out rows
553 mKeys = new ArrayList<Key>();
554 mModifierKeys = new ArrayList<Key>();
567 * @param characters the list of characters to display on the keyboard. One key will be created
596 final Key key = new Key(row);
597 key.x = x;
598 key.y = y;
599 key.label = String.valueOf(c);
600 key.codes = new int[] { c };
602 x += key.width + key.gap;
603 mKeys.add(key);
604 row.mKeys.add(key);
621 Key key = row.mKeys.get(keyIndex);
623 totalGap += key.gap;
625 totalWidth += key.width;
631 Key key = row.mKeys.get(keyIndex);
632 key.width *= scaleFactor;
633 key.x = x;
634 x += key.width + key.gap;
644 public List<Key> getKeys() {
648 public List<Key> getModifierKeys() {
697 for (Key shiftKey : mShiftKeys) {
736 final Key key = mKeys.get(i);
737 if (key.squaredDistanceFrom(x, y) < mProximityThreshold ||
738 key.squaredDistanceFrom(x + mCellWidth - 1, y) < mProximityThreshold ||
739 key.squaredDistanceFrom(x + mCellWidth - 1, y + mCellHeight - 1)
741 key.squaredDistanceFrom(x, y + mCellHeight - 1) < mProximityThreshold) {
774 protected Key createKeyFromXml(Resources res, Row parent, int x, int y,
776 return new Key(res, parent, x, y, parser);
786 Key key = null;
808 key = createKeyFromXml(res, currentRow, x, y, parser);
809 mKeys.add(key);
810 if (key.codes[0] == KEYCODE_SHIFT) {
811 // Find available shift key slot and put this shift key in it
814 mShiftKeys[i] = key;
819 mModifierKeys.add(key);
820 } else if (key.codes[0] == KEYCODE_ALT) {
821 mModifierKeys.add(key);
823 currentRow.mKeys.add(key);
830 x += key.gap + key.width;