|
39 | 39 | import android.graphics.Shader; |
40 | 40 | import android.graphics.drawable.ColorDrawable; |
41 | 41 | import android.graphics.drawable.Drawable; |
42 | | -import android.hardware.display.DisplayManager; |
43 | 42 | import android.hardware.display.DisplayManagerGlobal; |
44 | 43 | import android.os.Bundle; |
45 | 44 | import android.os.Handler; |
@@ -4275,25 +4274,42 @@ public boolean requestRectangleOnScreen(Rect rectangle) { |
4275 | 4274 | * @return Whether any parent scrolled. |
4276 | 4275 | */ |
4277 | 4276 | public boolean requestRectangleOnScreen(Rect rectangle, boolean immediate) { |
| 4277 | + if (mAttachInfo == null) { |
| 4278 | + return false; |
| 4279 | + } |
| 4280 | + |
4278 | 4281 | View child = this; |
| 4282 | + |
| 4283 | + RectF position = mAttachInfo.mTmpTransformRect; |
| 4284 | + position.set(rectangle); |
| 4285 | + |
4279 | 4286 | ViewParent parent = mParent; |
4280 | 4287 | boolean scrolled = false; |
4281 | 4288 | while (parent != null) { |
| 4289 | + rectangle.set((int) position.left, (int) position.top, |
| 4290 | + (int) position.right, (int) position.bottom); |
| 4291 | + |
4282 | 4292 | scrolled |= parent.requestChildRectangleOnScreen(child, |
4283 | 4293 | rectangle, immediate); |
4284 | 4294 |
|
4285 | | - // offset rect so next call has the rectangle in the |
4286 | | - // coordinate system of its direct child. |
4287 | | - rectangle.offset(child.getLeft(), child.getTop()); |
4288 | | - rectangle.offset(-child.getScrollX(), -child.getScrollY()); |
| 4295 | + if (!child.hasIdentityMatrix()) { |
| 4296 | + child.getMatrix().mapRect(position); |
| 4297 | + } |
| 4298 | + |
| 4299 | + position.offset(child.mLeft, child.mTop); |
4289 | 4300 |
|
4290 | 4301 | if (!(parent instanceof View)) { |
4291 | 4302 | break; |
4292 | 4303 | } |
4293 | 4304 |
|
4294 | | - child = (View) parent; |
| 4305 | + View parentView = (View) parent; |
| 4306 | + |
| 4307 | + position.offset(-parentView.getScrollX(), -parentView.getScrollY()); |
| 4308 | + |
| 4309 | + child = parentView; |
4295 | 4310 | parent = child.getParent(); |
4296 | 4311 | } |
| 4312 | + |
4297 | 4313 | return scrolled; |
4298 | 4314 | } |
4299 | 4315 |
|
|
0 commit comments