am 17f628c5: Merge "Add copy constructor to Keyboard"
* commit '17f628c56c6e5a62371fb3f6abeb717d25d99115': Add copy constructor to Keyboardmain
commit
6fed1db02a
|
@ -157,7 +157,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider
|
|||
|
||||
// Add the virtual children of the root View.
|
||||
final Keyboard keyboard = mKeyboardView.getKeyboard();
|
||||
final Key[] keys = keyboard.mKeys;
|
||||
final Key[] keys = keyboard.getKeys();
|
||||
for (Key key : keys) {
|
||||
final int childVirtualViewId = generateVirtualViewIdForKey(key);
|
||||
rootInfo.addChild(mKeyboardView, childVirtualViewId);
|
||||
|
@ -300,7 +300,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider
|
|||
}
|
||||
mVirtualViewIdToKey.clear();
|
||||
|
||||
final Key[] keys = keyboard.mKeys;
|
||||
final Key[] keys = keyboard.getKeys();
|
||||
for (Key key : keys) {
|
||||
final int virtualViewId = generateVirtualViewIdForKey(key);
|
||||
mVirtualViewIdToKey.put(virtualViewId, key);
|
||||
|
|
|
@ -69,7 +69,7 @@ public class Keyboard {
|
|||
public final int mMaxMoreKeysKeyboardColumn;
|
||||
|
||||
/** Array of keys and icons in this keyboard */
|
||||
public final Key[] mKeys;
|
||||
private final Key[] mKeys;
|
||||
public final Key[] mShiftKeys;
|
||||
public final Key[] mAltCodeKeysWhileTyping;
|
||||
public final KeyboardIconsSet mIconsSet;
|
||||
|
@ -104,6 +104,28 @@ public class Keyboard {
|
|||
mProximityCharsCorrectionEnabled = params.mProximityCharsCorrectionEnabled;
|
||||
}
|
||||
|
||||
protected Keyboard(final Keyboard keyboard) {
|
||||
mId = keyboard.mId;
|
||||
mThemeId = keyboard.mThemeId;
|
||||
mOccupiedHeight = keyboard.mOccupiedHeight;
|
||||
mOccupiedWidth = keyboard.mOccupiedWidth;
|
||||
mMostCommonKeyHeight = keyboard.mMostCommonKeyHeight;
|
||||
mMostCommonKeyWidth = keyboard.mMostCommonKeyWidth;
|
||||
mMoreKeysTemplate = keyboard.mMoreKeysTemplate;
|
||||
mMaxMoreKeysKeyboardColumn = keyboard.mMaxMoreKeysKeyboardColumn;
|
||||
mKeyVisualAttributes = keyboard.mKeyVisualAttributes;
|
||||
mTopPadding = keyboard.mTopPadding;
|
||||
mVerticalGap = keyboard.mVerticalGap;
|
||||
|
||||
mKeys = keyboard.mKeys;
|
||||
mShiftKeys = keyboard.mShiftKeys;
|
||||
mAltCodeKeysWhileTyping = keyboard.mAltCodeKeysWhileTyping;
|
||||
mIconsSet = keyboard.mIconsSet;
|
||||
|
||||
mProximityInfo = keyboard.mProximityInfo;
|
||||
mProximityCharsCorrectionEnabled = keyboard.mProximityCharsCorrectionEnabled;
|
||||
}
|
||||
|
||||
public boolean hasProximityCharsCorrection(final int code) {
|
||||
if (!mProximityCharsCorrectionEnabled) {
|
||||
return false;
|
||||
|
@ -120,6 +142,10 @@ public class Keyboard {
|
|||
return mProximityInfo;
|
||||
}
|
||||
|
||||
public Key[] getKeys() {
|
||||
return mKeys;
|
||||
}
|
||||
|
||||
public Key getKey(final int code) {
|
||||
if (code == Constants.CODE_UNSPECIFIED) {
|
||||
return null;
|
||||
|
@ -130,7 +156,7 @@ public class Keyboard {
|
|||
return mKeyCache.valueAt(index);
|
||||
}
|
||||
|
||||
for (final Key key : mKeys) {
|
||||
for (final Key key : getKeys()) {
|
||||
if (key.getCode() == code) {
|
||||
mKeyCache.put(code, key);
|
||||
return key;
|
||||
|
@ -146,7 +172,7 @@ public class Keyboard {
|
|||
return true;
|
||||
}
|
||||
|
||||
for (final Key key : mKeys) {
|
||||
for (final Key key : getKeys()) {
|
||||
if (key == aKey) {
|
||||
mKeyCache.put(key.getCode(), key);
|
||||
return true;
|
||||
|
|
|
@ -285,7 +285,7 @@ public class KeyboardView extends View {
|
|||
// TODO: Confirm if it's really required to draw all keys when hardware acceleration is on.
|
||||
if (drawAllKeys || isHardwareAccelerated) {
|
||||
// Draw all keys.
|
||||
for (final Key key : mKeyboard.mKeys) {
|
||||
for (final Key key : mKeyboard.getKeys()) {
|
||||
onDrawKey(key, canvas, paint);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class MoreKeysDetector extends KeyDetector {
|
|||
|
||||
Key nearestKey = null;
|
||||
int nearestDist = (y < 0) ? mSlideAllowanceSquareTop : mSlideAllowanceSquare;
|
||||
for (final Key key : getKeyboard().mKeys) {
|
||||
for (final Key key : getKeyboard().getKeys()) {
|
||||
final int dist = key.squaredDistanceToEdge(touchX, touchY);
|
||||
if (dist < nearestDist) {
|
||||
nearestKey = key;
|
||||
|
|
Loading…
Reference in New Issue