File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -324,19 +324,27 @@ private static boolean isOnTop(View view, View comparedWith) {
324324 final ArrayList <View > preorderedList = parent .buildOrderedChildList ();
325325 final boolean customOrder = preorderedList == null
326326 && parent .isChildrenDrawingOrderEnabled ();
327+
328+ // This default value shouldn't be used because both view and comparedWith
329+ // should be in the list. If there is an error, then just return an arbitrary
330+ // view is on top.
331+ boolean isOnTop = true ;
327332 for (int i = 0 ; i < childrenCount ; i ++) {
328333 int childIndex = customOrder ? parent .getChildDrawingOrder (childrenCount , i ) : i ;
329334 final View child = (preorderedList == null )
330335 ? parent .getChildAt (childIndex ) : preorderedList .get (childIndex );
331336 if (child == view ) {
332- return false ;
337+ isOnTop = false ;
338+ break ;
333339 } else if (child == comparedWith ) {
334- return true ;
340+ isOnTop = true ;
341+ break ;
335342 }
336343 }
337344
338- // Shouldn't get here. Neither of the children is in the parent.
339- // Just return an arbitrary one.
340- return true ;
345+ if (preorderedList != null ) {
346+ preorderedList .clear ();
347+ }
348+ return isOnTop ;
341349 }
342350}
You can’t perform that action at this time.
0 commit comments