diff options
author | 2012-05-10 11:58:18 -0700 | |
---|---|---|
committer | 2012-05-10 11:58:18 -0700 | |
commit | b427eabfdf7fd0e55e331b1e3004dc613f0c75a5 (patch) | |
tree | 9e8cfeb3c5b62e297650e036efd10b21826d71c0 /java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java | |
parent | f5a2399300f7420115695985a43e4fe489555eba (diff) | |
parent | 7c23ad92fcbeb64623c7deda7c603ec6c35e11a3 (diff) | |
download | latinime-b427eabfdf7fd0e55e331b1e3004dc613f0c75a5.tar.gz latinime-b427eabfdf7fd0e55e331b1e3004dc613f0c75a5.tar.xz latinime-b427eabfdf7fd0e55e331b1e3004dc613f0c75a5.zip |
am 7c23ad92: Merge "Use key index as virtual view ID." into jb-dev
* commit '7c23ad92fcbeb64623c7deda7c603ec6c35e11a3':
Use key index as virtual view ID.
Diffstat (limited to 'java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java')
-rw-r--r-- | java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java index 812bbc881..d7cd8e23a 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java @@ -211,14 +211,17 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat } /** - * Generates a virtual view identifier for the specified key. + * Generates a virtual view identifier for the given key. Returned + * identifiers are valid until the next global layout state change. * * @param key The key to identify. * @return A virtual view identifier. */ private static int generateVirtualViewIdForKey(Key key) { - // The key code is unique within an instance of a Keyboard. - return key.mCode; + // The key x- and y-coordinates are stable between layout changes. + // Generate an identifier by bit-shifting the x-coordinate to the + // left-half of the integer and OR'ing with the y-coordinate. + return ((0xFFFF & key.mX) << (Integer.SIZE / 2)) | (0xFFFF & key.mY); } private final OnGlobalLayoutListener mGlobalLayoutListener = new OnGlobalLayoutListener() { |