From adc80eef1533189ca2f3bcb08126d4db3f5bfbbd Mon Sep 17 00:00:00 2001
From: "Tadashi G. Takaoka" <takaoka@google.com>
Date: Wed, 4 Jul 2012 16:31:57 +0900
Subject: [PATCH] Use Keyboard.getKey

Change-Id: I722b9e981389f660db928b7fd5ced1b82371fbf3
---
 .../com/android/inputmethod/latin/WordComposer.java | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index 98282f9702..cf69376ee5 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -167,13 +167,12 @@ public class WordComposer {
      * Internal method to retrieve reasonable proximity info for a character.
      */
     private void addKeyInfo(final int codePoint, final Keyboard keyboard) {
-        for (final Key key : keyboard.mKeys) {
-            if (key.mCode == codePoint) {
-                final int x = key.mX + key.mWidth / 2;
-                final int y = key.mY + key.mHeight / 2;
-                add(codePoint, x, y);
-                return;
-            }
+        final Key key = keyboard.getKey(codePoint);
+        if (key != null) {
+            final int x = key.mX + key.mWidth / 2;
+            final int y = key.mY + key.mHeight / 2;
+            add(codePoint, x, y);
+            return;
         }
         add(codePoint, WordComposer.NOT_A_COORDINATE, WordComposer.NOT_A_COORDINATE);
     }
-- 
GitLab