Loading java/src/com/android/inputmethod/latin/LatinKeyboard.java +4 −3 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class LatinKeyboard extends Keyboard { private final int NUMBER_HINT_COUNT = 10; private Key[] mNumberHintKeys; private Drawable[] mNumberHintIcons = new Drawable[NUMBER_HINT_COUNT]; private int mSpaceKeyIndex = -1; private final int[] mSpaceKeyIndexArray; private int mSpaceDragStartX; private int mSpaceDragLastDiff; private Locale mLocale; Loading Loading @@ -144,7 +144,8 @@ public class LatinKeyboard extends Keyboard { R.dimen.spacebar_vertical_correction); mIsAlphaKeyboard = xmlLayoutResId == R.xml.kbd_qwerty || xmlLayoutResId == R.xml.kbd_qwerty_black; mSpaceKeyIndex = indexOf(LatinIME.KEYCODE_SPACE); // The index of space key is available only after Keyboard constructor has finished. mSpaceKeyIndexArray = new int[] { indexOf(LatinIME.KEYCODE_SPACE) }; initializeNumberHintResources(context); // TODO remove this initialization after cleanup mVerticalGap = super.getVerticalGap(); Loading Loading @@ -795,7 +796,7 @@ public class LatinKeyboard extends Keyboard { @Override public int[] getNearestKeys(int x, int y) { if (mCurrentlyInSpace) { return new int[] { mSpaceKeyIndex }; return mSpaceKeyIndexArray; } else { // Avoid dead pixels at edges of the keyboard return super.getNearestKeys(Math.max(0, Math.min(x, getMinWidth() - 1)), Loading java/src/com/android/inputmethod/latin/LatinKeyboardView.java +10 −5 Original line number Diff line number Diff line Loading @@ -76,14 +76,19 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { } @Override public void setKeyboard(Keyboard k) { super.setKeyboard(k); public void setKeyboard(Keyboard newKeyboard) { final Keyboard oldKeyboard = getKeyboard(); if (oldKeyboard instanceof LatinKeyboard) { // Reset old keyboard state before switching to new keyboard. ((LatinKeyboard)oldKeyboard).keyReleased(); } super.setKeyboard(newKeyboard); // One-seventh of the keyboard width seems like a reasonable threshold mJumpThresholdSquare = k.getMinWidth() / 7; mJumpThresholdSquare = newKeyboard.getMinWidth() / 7; mJumpThresholdSquare *= mJumpThresholdSquare; // Assuming there are 4 rows, this is the coordinate of the last row mLastRowY = (k.getHeight() * 3) / 4; setKeyboardLocal(k); mLastRowY = (newKeyboard.getHeight() * 3) / 4; setKeyboardLocal(newKeyboard); } @Override Loading Loading
java/src/com/android/inputmethod/latin/LatinKeyboard.java +4 −3 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class LatinKeyboard extends Keyboard { private final int NUMBER_HINT_COUNT = 10; private Key[] mNumberHintKeys; private Drawable[] mNumberHintIcons = new Drawable[NUMBER_HINT_COUNT]; private int mSpaceKeyIndex = -1; private final int[] mSpaceKeyIndexArray; private int mSpaceDragStartX; private int mSpaceDragLastDiff; private Locale mLocale; Loading Loading @@ -144,7 +144,8 @@ public class LatinKeyboard extends Keyboard { R.dimen.spacebar_vertical_correction); mIsAlphaKeyboard = xmlLayoutResId == R.xml.kbd_qwerty || xmlLayoutResId == R.xml.kbd_qwerty_black; mSpaceKeyIndex = indexOf(LatinIME.KEYCODE_SPACE); // The index of space key is available only after Keyboard constructor has finished. mSpaceKeyIndexArray = new int[] { indexOf(LatinIME.KEYCODE_SPACE) }; initializeNumberHintResources(context); // TODO remove this initialization after cleanup mVerticalGap = super.getVerticalGap(); Loading Loading @@ -795,7 +796,7 @@ public class LatinKeyboard extends Keyboard { @Override public int[] getNearestKeys(int x, int y) { if (mCurrentlyInSpace) { return new int[] { mSpaceKeyIndex }; return mSpaceKeyIndexArray; } else { // Avoid dead pixels at edges of the keyboard return super.getNearestKeys(Math.max(0, Math.min(x, getMinWidth() - 1)), Loading
java/src/com/android/inputmethod/latin/LatinKeyboardView.java +10 −5 Original line number Diff line number Diff line Loading @@ -76,14 +76,19 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { } @Override public void setKeyboard(Keyboard k) { super.setKeyboard(k); public void setKeyboard(Keyboard newKeyboard) { final Keyboard oldKeyboard = getKeyboard(); if (oldKeyboard instanceof LatinKeyboard) { // Reset old keyboard state before switching to new keyboard. ((LatinKeyboard)oldKeyboard).keyReleased(); } super.setKeyboard(newKeyboard); // One-seventh of the keyboard width seems like a reasonable threshold mJumpThresholdSquare = k.getMinWidth() / 7; mJumpThresholdSquare = newKeyboard.getMinWidth() / 7; mJumpThresholdSquare *= mJumpThresholdSquare; // Assuming there are 4 rows, this is the coordinate of the last row mLastRowY = (k.getHeight() * 3) / 4; setKeyboardLocal(k); mLastRowY = (newKeyboard.getHeight() * 3) / 4; setKeyboardLocal(newKeyboard); } @Override Loading