From 2348ca0e769b3f8027f581426d9de1b401c58145 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Sun, 17 Oct 2010 20:46:01 +0900 Subject: Cleanup LatinKeyboard and LatinKeyboard.LatinKey classes Change-Id: I4c5a37315dea1c7545b77a8a6c93b930927a5a82 --- java/src/com/android/inputmethod/latin/BaseKeyboard.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/BaseKeyboard.java') diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index 0327006c9..bad1544e5 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -150,9 +150,9 @@ public class BaseKeyboard { /** The keyboard mode for this row */ public int mode; - private BaseKeyboard parent; + private final BaseKeyboard parent; - public Row(BaseKeyboard parent) { + private Row(BaseKeyboard parent) { this.parent = parent; } @@ -232,7 +232,7 @@ public class BaseKeyboard { /** Whether this is a modifier key, such as Shift or Alt */ public boolean modifier; /** The BaseKeyboard that this key belongs to */ - private BaseKeyboard keyboard; + protected final BaseKeyboard keyboard; /** * If this key pops up a mini keyboard, this is the resource id for the XML layout for that * keyboard. @@ -361,7 +361,7 @@ public class BaseKeyboard { } } - int[] parseCSV(String value) { + private int[] parseCSV(String value) { int count = 0; int lastIndex = 0; if (value.length() > 0) { @@ -413,8 +413,11 @@ public class BaseKeyboard { * @return the square of the distance of the point from the center of the key */ public int squaredDistanceFrom(int x, int y) { + // We should count vertical gap between rows to calculate the center of this Key. + // TODO: We should re-think how we define the center of the key. + final int verticalGap = keyboard.getVerticalGap(); int xDist = this.x + width / 2 - x; - int yDist = this.y + height / 2 - y; + int yDist = this.y + (height + verticalGap) / 2 - y; return xDist * xDist + yDist * yDist; } -- cgit v1.2.3-83-g751a