Loading java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java +2 −2 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider // Add the virtual children of the root View. final Keyboard keyboard = mKeyboardView.getKeyboard(); for (final Key key : keyboard.getKeys()) { for (final Key key : keyboard.getSortedKeys()) { final int childVirtualViewId = generateVirtualViewIdForKey(key); rootInfo.addChild(mKeyboardView, childVirtualViewId); } Loading Loading @@ -307,7 +307,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider } mVirtualViewIdToKey.clear(); for (final Key key : keyboard.getKeys()) { for (final Key key : keyboard.getSortedKeys()) { final int virtualViewId = generateVirtualViewIdForKey(key); mVirtualViewIdToKey.put(virtualViewId, key); } Loading java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java +3 −2 Original line number Diff line number Diff line Loading @@ -298,7 +298,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange private int getCategoryPageCount(final int categoryId) { final Keyboard keyboard = mLayoutSet.getKeyboard(sCategoryElementId[categoryId]); return (keyboard.getKeys().size() - 1) / mMaxPageKeyCount + 1; return (keyboard.getSortedKeys().size() - 1) / mMaxPageKeyCount + 1; } // Returns a pair of the category id and the category page id from the view pager's page Loading Loading @@ -347,7 +347,8 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange } final Keyboard keyboard = mLayoutSet.getKeyboard(sCategoryElementId[categoryId]); final Key[][] sortedKeys = sortKeysIntoPages(keyboard.getKeys(), mMaxPageKeyCount); final Key[][] sortedKeys = sortKeysIntoPages( keyboard.getSortedKeys(), mMaxPageKeyCount); for (int pageId = 0; pageId < sortedKeys.length; ++pageId) { final DynamicGridKeyboard tempKeyboard = new DynamicGridKeyboard(mPrefs, mLayoutSet.getKeyboard(KeyboardId.ELEMENT_EMOJI_RECENTS), Loading java/src/com/android/inputmethod/keyboard/Keyboard.java +17 −9 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ public class Keyboard { public final int mMaxMoreKeysKeyboardColumn; /** List of keys in this keyboard */ private final List<Key> mKeys; private final List<Key> mSortedKeys; public final List<Key> mShiftKeys; public final List<Key> mAltCodeKeysWhileTyping; public final KeyboardIconsSet mIconsSet; Loading @@ -103,14 +103,16 @@ public class Keyboard { mTopPadding = params.mTopPadding; mVerticalGap = params.mVerticalGap; mKeys = Collections.unmodifiableList(CollectionUtils.newArrayList(params.mKeys)); mSortedKeys = Collections.unmodifiableList( CollectionUtils.newArrayList(params.mSortedKeys)); mShiftKeys = Collections.unmodifiableList(params.mShiftKeys); mAltCodeKeysWhileTyping = Collections.unmodifiableList(params.mAltCodeKeysWhileTyping); mIconsSet = params.mIconsSet; mProximityInfo = new ProximityInfo(params.mId.mLocale.toString(), params.GRID_WIDTH, params.GRID_HEIGHT, mOccupiedWidth, mOccupiedHeight, mMostCommonKeyWidth, mMostCommonKeyHeight, mKeys, params.mTouchPositionCorrection); mMostCommonKeyWidth, mMostCommonKeyHeight, mSortedKeys, params.mTouchPositionCorrection); mProximityCharsCorrectionEnabled = params.mProximityCharsCorrectionEnabled; } Loading @@ -129,7 +131,7 @@ public class Keyboard { mTopPadding = keyboard.mTopPadding; mVerticalGap = keyboard.mVerticalGap; mKeys = keyboard.mKeys; mSortedKeys = keyboard.mSortedKeys; mShiftKeys = keyboard.mShiftKeys; mAltCodeKeysWhileTyping = keyboard.mAltCodeKeysWhileTyping; mIconsSet = keyboard.mIconsSet; Loading @@ -154,12 +156,18 @@ public class Keyboard { return mProximityInfo; } public List<Key> getKeys() { return mKeys; /** * Return the sorted list of keys of this keyboard. * The keys are sorted from top-left to bottom-right order. * The list may contain {@link Spacer} object as well. * @return the sorted unmodifiable list of {@link Key}s of this keyboard. */ public List<Key> getSortedKeys() { return mSortedKeys; } public Key getKeyFromOutputText(final String outputText) { for (final Key key : getKeys()) { for (final Key key : getSortedKeys()) { if (outputText.equals(key.getOutputText())) { return key; } Loading @@ -177,7 +185,7 @@ public class Keyboard { return mKeyCache.valueAt(index); } for (final Key key : getKeys()) { for (final Key key : getSortedKeys()) { if (key.getCode() == code) { mKeyCache.put(code, key); return key; Loading @@ -193,7 +201,7 @@ public class Keyboard { return true; } for (final Key key : getKeys()) { for (final Key key : getSortedKeys()) { if (key == aKey) { mKeyCache.put(key.getCode(), key); return true; Loading java/src/com/android/inputmethod/keyboard/KeyboardView.java +1 −1 Original line number Diff line number Diff line Loading @@ -289,7 +289,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.getKeys()) { for (final Key key : mKeyboard.getSortedKeys()) { onDrawKey(key, canvas, paint); } } else { Loading java/src/com/android/inputmethod/keyboard/MoreKeysDetector.java +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ public final class MoreKeysDetector extends KeyDetector { Key nearestKey = null; int nearestDist = (y < 0) ? mSlideAllowanceSquareTop : mSlideAllowanceSquare; for (final Key key : keyboard.getKeys()) { for (final Key key : keyboard.getSortedKeys()) { final int dist = key.squaredDistanceToEdge(touchX, touchY); if (dist < nearestDist) { nearestKey = key; Loading Loading
java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java +2 −2 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider // Add the virtual children of the root View. final Keyboard keyboard = mKeyboardView.getKeyboard(); for (final Key key : keyboard.getKeys()) { for (final Key key : keyboard.getSortedKeys()) { final int childVirtualViewId = generateVirtualViewIdForKey(key); rootInfo.addChild(mKeyboardView, childVirtualViewId); } Loading Loading @@ -307,7 +307,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider } mVirtualViewIdToKey.clear(); for (final Key key : keyboard.getKeys()) { for (final Key key : keyboard.getSortedKeys()) { final int virtualViewId = generateVirtualViewIdForKey(key); mVirtualViewIdToKey.put(virtualViewId, key); } Loading
java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java +3 −2 Original line number Diff line number Diff line Loading @@ -298,7 +298,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange private int getCategoryPageCount(final int categoryId) { final Keyboard keyboard = mLayoutSet.getKeyboard(sCategoryElementId[categoryId]); return (keyboard.getKeys().size() - 1) / mMaxPageKeyCount + 1; return (keyboard.getSortedKeys().size() - 1) / mMaxPageKeyCount + 1; } // Returns a pair of the category id and the category page id from the view pager's page Loading Loading @@ -347,7 +347,8 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange } final Keyboard keyboard = mLayoutSet.getKeyboard(sCategoryElementId[categoryId]); final Key[][] sortedKeys = sortKeysIntoPages(keyboard.getKeys(), mMaxPageKeyCount); final Key[][] sortedKeys = sortKeysIntoPages( keyboard.getSortedKeys(), mMaxPageKeyCount); for (int pageId = 0; pageId < sortedKeys.length; ++pageId) { final DynamicGridKeyboard tempKeyboard = new DynamicGridKeyboard(mPrefs, mLayoutSet.getKeyboard(KeyboardId.ELEMENT_EMOJI_RECENTS), Loading
java/src/com/android/inputmethod/keyboard/Keyboard.java +17 −9 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ public class Keyboard { public final int mMaxMoreKeysKeyboardColumn; /** List of keys in this keyboard */ private final List<Key> mKeys; private final List<Key> mSortedKeys; public final List<Key> mShiftKeys; public final List<Key> mAltCodeKeysWhileTyping; public final KeyboardIconsSet mIconsSet; Loading @@ -103,14 +103,16 @@ public class Keyboard { mTopPadding = params.mTopPadding; mVerticalGap = params.mVerticalGap; mKeys = Collections.unmodifiableList(CollectionUtils.newArrayList(params.mKeys)); mSortedKeys = Collections.unmodifiableList( CollectionUtils.newArrayList(params.mSortedKeys)); mShiftKeys = Collections.unmodifiableList(params.mShiftKeys); mAltCodeKeysWhileTyping = Collections.unmodifiableList(params.mAltCodeKeysWhileTyping); mIconsSet = params.mIconsSet; mProximityInfo = new ProximityInfo(params.mId.mLocale.toString(), params.GRID_WIDTH, params.GRID_HEIGHT, mOccupiedWidth, mOccupiedHeight, mMostCommonKeyWidth, mMostCommonKeyHeight, mKeys, params.mTouchPositionCorrection); mMostCommonKeyWidth, mMostCommonKeyHeight, mSortedKeys, params.mTouchPositionCorrection); mProximityCharsCorrectionEnabled = params.mProximityCharsCorrectionEnabled; } Loading @@ -129,7 +131,7 @@ public class Keyboard { mTopPadding = keyboard.mTopPadding; mVerticalGap = keyboard.mVerticalGap; mKeys = keyboard.mKeys; mSortedKeys = keyboard.mSortedKeys; mShiftKeys = keyboard.mShiftKeys; mAltCodeKeysWhileTyping = keyboard.mAltCodeKeysWhileTyping; mIconsSet = keyboard.mIconsSet; Loading @@ -154,12 +156,18 @@ public class Keyboard { return mProximityInfo; } public List<Key> getKeys() { return mKeys; /** * Return the sorted list of keys of this keyboard. * The keys are sorted from top-left to bottom-right order. * The list may contain {@link Spacer} object as well. * @return the sorted unmodifiable list of {@link Key}s of this keyboard. */ public List<Key> getSortedKeys() { return mSortedKeys; } public Key getKeyFromOutputText(final String outputText) { for (final Key key : getKeys()) { for (final Key key : getSortedKeys()) { if (outputText.equals(key.getOutputText())) { return key; } Loading @@ -177,7 +185,7 @@ public class Keyboard { return mKeyCache.valueAt(index); } for (final Key key : getKeys()) { for (final Key key : getSortedKeys()) { if (key.getCode() == code) { mKeyCache.put(code, key); return key; Loading @@ -193,7 +201,7 @@ public class Keyboard { return true; } for (final Key key : getKeys()) { for (final Key key : getSortedKeys()) { if (key == aKey) { mKeyCache.put(key.getCode(), key); return true; Loading
java/src/com/android/inputmethod/keyboard/KeyboardView.java +1 −1 Original line number Diff line number Diff line Loading @@ -289,7 +289,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.getKeys()) { for (final Key key : mKeyboard.getSortedKeys()) { onDrawKey(key, canvas, paint); } } else { Loading
java/src/com/android/inputmethod/keyboard/MoreKeysDetector.java +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ public final class MoreKeysDetector extends KeyDetector { Key nearestKey = null; int nearestDist = (y < 0) ? mSlideAllowanceSquareTop : mSlideAllowanceSquare; for (final Key key : keyboard.getKeys()) { for (final Key key : keyboard.getSortedKeys()) { final int dist = key.squaredDistanceToEdge(touchX, touchY); if (dist < nearestDist) { nearestKey = key; Loading