Loading core/java/android/view/View.java +36 −7 Original line number Diff line number Diff line Loading @@ -4801,17 +4801,46 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * entirely by its predecessors, and has an alpha greater than zero. * * @return Whether the view is visible on the screen. * * @hide */ private boolean isVisibleToUser() { protected boolean isVisibleToUser() { return isVisibleToUser(null); } /** * Computes whether the given portion of this view is visible to the user. Such a view is * attached, visible, all its predecessors are visible, has an alpha greater than zero, and * the specified portion is not clipped entirely by its predecessors. * * @param boundInView the portion of the view to test; coordinates should be relative; may be * <code>null</code>, and the entire view will be tested in this case. * When <code>true</code> is returned by the function, the actual visible * region will be stored in this parameter; that is, if boundInView is fully * contained within the view, no modification will be made, otherwise regions * outside of the visible area of the view will be clipped. * * @return Whether the specified portion of the view is visible on the screen. * * @hide */ protected boolean isVisibleToUser(Rect boundInView) { Rect visibleRect = mAttachInfo.mTmpInvalRect; Point offset = mAttachInfo.mPoint; // The first two checks are made also made by isShown() which // however traverses the tree up to the parent to catch that. // Therefore, we do some fail fast check to minimize the up // tree traversal. return (mAttachInfo != null boolean isVisible = mAttachInfo != null && mAttachInfo.mWindowVisibility == View.VISIBLE && getAlpha() > 0 && isShown() && getGlobalVisibleRect(mAttachInfo.mTmpInvalRect)); && getGlobalVisibleRect(visibleRect, offset); if (isVisible && boundInView != null) { visibleRect.offset(-offset.x, -offset.y); isVisible &= boundInView.intersect(visibleRect); } return isVisible; } /** Loading core/java/android/widget/NumberPicker.java +6 −6 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading
core/java/android/view/View.java +36 −7 Original line number Diff line number Diff line Loading @@ -4801,17 +4801,46 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * entirely by its predecessors, and has an alpha greater than zero. * * @return Whether the view is visible on the screen. * * @hide */ private boolean isVisibleToUser() { protected boolean isVisibleToUser() { return isVisibleToUser(null); } /** * Computes whether the given portion of this view is visible to the user. Such a view is * attached, visible, all its predecessors are visible, has an alpha greater than zero, and * the specified portion is not clipped entirely by its predecessors. * * @param boundInView the portion of the view to test; coordinates should be relative; may be * <code>null</code>, and the entire view will be tested in this case. * When <code>true</code> is returned by the function, the actual visible * region will be stored in this parameter; that is, if boundInView is fully * contained within the view, no modification will be made, otherwise regions * outside of the visible area of the view will be clipped. * * @return Whether the specified portion of the view is visible on the screen. * * @hide */ protected boolean isVisibleToUser(Rect boundInView) { Rect visibleRect = mAttachInfo.mTmpInvalRect; Point offset = mAttachInfo.mPoint; // The first two checks are made also made by isShown() which // however traverses the tree up to the parent to catch that. // Therefore, we do some fail fast check to minimize the up // tree traversal. return (mAttachInfo != null boolean isVisible = mAttachInfo != null && mAttachInfo.mWindowVisibility == View.VISIBLE && getAlpha() > 0 && isShown() && getGlobalVisibleRect(mAttachInfo.mTmpInvalRect)); && getGlobalVisibleRect(visibleRect, offset); if (isVisible && boundInView != null) { visibleRect.offset(-offset.x, -offset.y); isVisible &= boundInView.intersect(visibleRect); } return isVisible; } /** Loading
core/java/android/widget/NumberPicker.java +6 −6 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading