Lines Matching defs:key

58  * detecting key presses and touch movements.
77 * Called when the user presses a key. This is sent before the {@link #onKey} is called.
79 * @param primaryCode the unicode of the key being pressed. If the touch is not on a valid
80 * key, the value will be zero.
85 * Called when the user releases a key. This is sent after the {@link #onKey} is called.
87 * @param primaryCode the code of the key that was released
92 * Send a key press to the listener.
93 * @param primaryCode this is the key that was pressed
95 * with the primary code being the first. If the primary key code is
97 * will include other characters that may be on the same key or adjacent keys.
98 * These codes are useful to correct for accidental presses of a key adjacent to
99 * the intended key.
473 // Switching to a different keyboard should abort any pending keys so that the key up
488 * Sets the state of the shift key of the keyboard, if any.
489 * @param shifted whether or not to enable the state of the shift key
490 * @return true if the shift key state changed, false if there was no change
505 * Returns the state of the shift key of the keyboard, if any.
507 * no shift key on the keyboard or there is no keyboard attached, it returns false.
518 * Enables or disables the key feedback popup. This is a popup that shows a magnified
519 * version of the depressed key. By default the preview is enabled.
520 * @param previewEnabled whether or not to enable the key feedback popup
528 * Returns the enabled state of the key feedback popup.
529 * @return whether or not the key feedback popup is enabled
552 * When enabled, calls to {@link OnKeyboardActionListener#onKey} will include key
553 * codes for adjacent keys. When disabled, only the primary key code will be
601 * the touch distance from a key's center to avoid taking a square root.
611 Key key = keys[i];
612 dimensionSum += Math.min(key.width, key.height) + key.gap;
668 // Is clipRegion completely contained within the invalidated key?
679 final Key key = keys[i];
680 if (drawSingleKey && invalidKey != key) {
683 int[] drawableState = key.getCurrentDrawableState();
687 String label = key.label == null? null : adjustCase(key.label).toString();
690 if (key.width != bounds.right ||
691 key.height != bounds.bottom) {
692 keyBackground.setBounds(0, 0, key.width, key.height);
694 canvas.translate(key.x + kbdPaddingLeft, key.y + kbdPaddingTop);
699 if (label.length() > 1 && key.codes.length < 2) {
710 (key.width - padding.left - padding.right) / 2
712 (key.height - padding.top - padding.bottom) / 2
717 } else if (key.icon != null) {
718 final int drawableX = (key.width - padding.left - padding.right
719 - key.icon.getIntrinsicWidth()) / 2 + padding.left;
720 final int drawableY = (key.height - padding.top - padding.bottom
721 - key.icon.getIntrinsicHeight()) / 2 + padding.top;
723 key.icon.setBounds(0, 0,
724 key.icon.getIntrinsicWidth(), key.icon.getIntrinsicHeight());
725 key.icon.draw(canvas);
728 canvas.translate(-key.x - kbdPaddingLeft, -key.y - kbdPaddingTop);
761 final Key key = keys[nearestKeyIndices[i]];
763 boolean isInside = key.isInside(x,y);
769 && (dist = key.squaredDistanceFrom(x, y)) < mProximityThreshold)
771 && key.codes[0] > 32) {
773 final int nCodes = key.codes.length;
789 allKeys[j + c] = key.codes[c];
805 final Key key = mKeys[index];
806 if (key.text != null) {
807 mKeyboardActionListener.onText(key.text);
810 int code = key.codes[0];
811 //TextEntryState.keyPressedAt(key, x, y);
822 code = key.codes[mTapCount];
833 * Handle multi-tap keys by producing the key label for the current multi-tap state.
835 private CharSequence getPreviewText(Key key) {
839 mPreviewLabel.append((char) key.codes[mTapCount < 0 ? 0 : mTapCount]);
842 return adjustCase(key.label);
851 // Release the old key and press the new key
877 // If key changed and preview is on ...
904 Key key = keys[keyIndex];
905 if (key.icon != null) {
907 key.iconPreview != null ? key.iconPreview : key.icon);
911 mPreviewText.setText(getPreviewText(key));
912 if (key.label.length() > 1 && key.codes.length < 2) {
922 int popupWidth = Math.max(mPreviewText.getMeasuredWidth(), key.width
931 mPopupPreviewX = key.x - mPreviewText.getPaddingLeft() + mPaddingLeft;
932 mPopupPreviewY = key.y - popupHeight + mPreviewOffset;
945 key.popupResId != 0 ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
949 // If the popup cannot be shown above the key, put it on the side
952 // If the key you're pressing is on the left side of the keyboard, show the popup on
953 // the right, offset by enough to see at least one key to the left/right.
954 if (key.x + key.width <= getWidth() / 2) {
955 mPopupPreviewX += (int) (key.width * 2.5);
957 mPopupPreviewX -= (int) (key.width * 2.5);
1039 * Invalidates a key so that it will be redrawn on the next repaint. Use this method if only
1040 * one key is changing it's content. Any changes that affect the position or size of the key
1042 * @param keyIndex the index of the key in the attached {@link Keyboard}.
1050 final Key key = mKeys[keyIndex];
1051 mInvalidatedKey = key;
1052 mDirtyRect.union(key.x + mPaddingLeft, key.y + mPaddingTop,
1053 key.x + key.width + mPaddingLeft, key.y + key.height + mPaddingTop);
1055 invalidate(key.x + mPaddingLeft, key.y + mPaddingTop,
1056 key.x + key.width + mPaddingLeft, key.y + key.height + mPaddingTop);
1078 * Called when a key is long pressed. By default this will open any popup keyboard associated
1079 * with this key through the attributes popupLayout and popupCharacters.
1080 * @param popupKey the key that was long pressed
1277 // Delivering the key could have caused an abort
1315 // Start new longpress if key has changed
1344 // If we're not on a repeating key (which sends on a DOWN event)
1365 Key key = mKeys[mRepeatKeyIndex];
1366 detectAndSendKey(mCurrentKey, key.x, key.y, mLastTapTime);
1435 Key key = mKeys[keyIndex];
1436 if (key.codes.length > 1) {
1440 mTapCount = (mTapCount + 1) % key.codes.length;