diff options
| author | Guang Zhu <guangzhu@google.com> | 2012-05-11 19:34:56 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-12 19:09:34 -0700 |
| commit | 0d607fbe546ac943de38dad33ae681b09efec6ea (patch) | |
| tree | 7236772a5bff5388c5425c5291b6793a53b9a13a /core/java/android/widget | |
| parent | 15e8439905cfae4605d101ae96a2694e69fb5017 (diff) | |
| download | frameworks_base-0d607fbe546ac943de38dad33ae681b09efec6ea.zip frameworks_base-0d607fbe546ac943de38dad33ae681b09efec6ea.tar.gz frameworks_base-0d607fbe546ac943de38dad33ae681b09efec6ea.tar.bz2 | |
accessibility bug fix in NumberPicker
* moved View#isVisibleToUser to protected with @hide
* added a new View#isVisibleToUser(Rect), so that a portion of
the view can be tested for visibility
* NumberPicker will report its concrete class name
* code to append virtual children was at wrong place
* boundInScreen for increment and decrement buttons are reported
wrong
Change-Id: Ic5d644b3e1efa15b1f0537907c8cdd4ce43a97c1
Diffstat (limited to 'core/java/android/widget')
| -rw-r--r-- | core/java/android/widget/NumberPicker.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java index 6ff924b..7c809b3 100644 --- a/core/java/android/widget/NumberPicker.java +++ b/core/java/android/widget/NumberPicker.java @@ -2239,20 +2239,17 @@ public class NumberPicker extends LinearLayout { info.setPackageName(mContext.getPackageName()); info.setSource(NumberPicker.this, virtualViewId); info.setParent(NumberPicker.this); - info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_DECREMENT); - info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT); - info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INCREMENT); info.setText(text); info.setClickable(true); info.setLongClickable(true); info.setEnabled(NumberPicker.this.isEnabled()); 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.offsetTo(0, 0); boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]); info.setBoundsInScreen(boundsInScreen); return info; @@ -2261,19 +2258,22 @@ public class NumberPicker extends LinearLayout { private AccessibilityNodeInfo createAccessibilityNodeInfoForNumberPicker(int left, int top, int right, int bottom) { AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(); - info.setClassName(Button.class.getName()); + info.setClassName(NumberPicker.class.getName()); info.setPackageName(mContext.getPackageName()); info.setSource(NumberPicker.this); + info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_DECREMENT); + info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT); + info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INCREMENT); info.setParent((View) getParent()); info.setEnabled(NumberPicker.this.isEnabled()); info.setScrollable(true); Rect boundsInParent = mTempRect; boundsInParent.set(left, top, right, bottom); info.setBoundsInParent(boundsInParent); + info.setVisibleToUser(isVisibleToUser()); Rect boundsInScreen = boundsInParent; int[] locationOnScreen = mTempArray; getLocationOnScreen(locationOnScreen); - boundsInScreen.offsetTo(0, 0); boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]); info.setBoundsInScreen(boundsInScreen); return info; |
