@@ -1723,8 +1723,10 @@ protected boolean dispatchGenericPointerEvent(MotionEvent event) {
17231723 final float x = event .getX ();
17241724 final float y = event .getY ();
17251725
1726+ final boolean customOrder = isChildrenDrawingOrderEnabled ();
17261727 for (int i = childrenCount - 1 ; i >= 0 ; i --) {
1727- final View child = children [i ];
1728+ final int childIndex = customOrder ? getChildDrawingOrder (childrenCount , i ) : i ;
1729+ final View child = children [childIndex ];
17281730 if (!canViewReceivePointerEvents (child )
17291731 || !isTransformedTouchPointInView (x , y , child , null )) {
17301732 continue ;
@@ -1851,8 +1853,11 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
18511853 final float x = ev .getX (actionIndex );
18521854 final float y = ev .getY (actionIndex );
18531855
1856+ final boolean customOrder = isChildrenDrawingOrderEnabled ();
18541857 for (int i = childrenCount - 1 ; i >= 0 ; i --) {
1855- final View child = children [i ];
1858+ final int childIndex = customOrder ?
1859+ getChildDrawingOrder (childrenCount , i ) : i ;
1860+ final View child = children [childIndex ];
18561861 if (!canViewReceivePointerEvents (child )
18571862 || !isTransformedTouchPointInView (x , y , child , null )) {
18581863 continue ;
@@ -1870,7 +1875,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
18701875 if (dispatchTransformedTouchEvent (ev , false , child , idBitsToAssign )) {
18711876 // Child wants to receive touch within its bounds.
18721877 mLastTouchDownTime = ev .getDownTime ();
1873- mLastTouchDownIndex = i ;
1878+ mLastTouchDownIndex = childIndex ;
18741879 mLastTouchDownX = ev .getX ();
18751880 mLastTouchDownY = ev .getY ();
18761881 newTouchTarget = addTouchTarget (child , idBitsToAssign );
0 commit comments