summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alan Viverette <alanv@google.com> 2013-05-24 10:03:24 -0700
committer Alan Viverette <alanv@google.com> 2013-05-24 10:03:24 -0700
commitdbed27e5e431d59142d11c552f7f13483658c35d (patch)
tree8762a3b3774826625ed0224b19a0a62612176563
parent366b97ba25de237c42c815c5e8ca36303ce104df (diff)
DO NOT MERGE. Fix number picker accessibility focus.
The node bounds populated by the child TextView were not consistent with the bounds manually populated for its parent NumberPicker. Bug: 9072003 Change-Id: Icbfa64f52cf11fd39c7243936227b8ba36280c3c
-rw-r--r--core/java/android/widget/NumberPicker.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 2ac5a128598e..4a98f66c1696 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -2185,7 +2185,10 @@ public class NumberPicker extends LinearLayout {
mScrollX + (mRight - mLeft),
mTopSelectionDividerTop + mSelectionDividerHeight);
case VIRTUAL_VIEW_ID_INPUT:
- return createAccessibiltyNodeInfoForInputText();
+ return createAccessibiltyNodeInfoForInputText(mScrollX,
+ mTopSelectionDividerTop + mSelectionDividerHeight,
+ mScrollX + (mRight - mLeft),
+ mBottomSelectionDividerBottom - mSelectionDividerHeight);
case VIRTUAL_VIEW_ID_INCREMENT:
return createAccessibilityNodeInfoForVirtualButton(VIRTUAL_VIEW_ID_INCREMENT,
getVirtualIncrementButtonText(), mScrollX,
@@ -2446,7 +2449,8 @@ public class NumberPicker extends LinearLayout {
}
}
- private AccessibilityNodeInfo createAccessibiltyNodeInfoForInputText() {
+ private AccessibilityNodeInfo createAccessibiltyNodeInfoForInputText(
+ int left, int top, int right, int bottom) {
AccessibilityNodeInfo info = mInputText.createAccessibilityNodeInfo();
info.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
if (mAccessibilityFocusedView != VIRTUAL_VIEW_ID_INPUT) {
@@ -2455,6 +2459,15 @@ public class NumberPicker extends LinearLayout {
if (mAccessibilityFocusedView == VIRTUAL_VIEW_ID_INPUT) {
info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
}
+ Rect boundsInParent = mTempRect;
+ boundsInParent.set(left, top, right, bottom);
+ info.setVisibleToUser(isVisibleToUser(boundsInParent));
+ info.setBoundsInParent(boundsInParent);
+ Rect boundsInScreen = boundsInParent;
+ int[] locationOnScreen = mTempArray;
+ getLocationOnScreen(locationOnScreen);
+ boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]);
+ info.setBoundsInScreen(boundsInScreen);
return info;
}