aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/BaseKeyboard.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-10-17 20:46:01 +0900
committerTadashi G. Takaoka <takaoka@google.com>2010-10-18 16:06:05 +0900
commit2348ca0e769b3f8027f581426d9de1b401c58145 (patch)
tree608d2c312d7b4a5ae3fd09b2700b367631e49f13 /java/src/com/android/inputmethod/latin/BaseKeyboard.java
parent4571fff019cc1749cea9a7c5fd219db1784a60f2 (diff)
downloadlatinime-2348ca0e769b3f8027f581426d9de1b401c58145.tar.gz
latinime-2348ca0e769b3f8027f581426d9de1b401c58145.tar.xz
latinime-2348ca0e769b3f8027f581426d9de1b401c58145.zip
Cleanup LatinKeyboard and LatinKeyboard.LatinKey classes
Change-Id: I4c5a37315dea1c7545b77a8a6c93b930927a5a82
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BaseKeyboard.java')
-rw-r--r--java/src/com/android/inputmethod/latin/BaseKeyboard.java13
1 files changed, 8 insertions, 5 deletions
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;
}