summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kristian Monsen <kristianm@google.com> 2014-06-09 17:38:01 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2014-06-09 17:38:02 +0000
commitab4bb06bec572d7533c4d3db15a277a5a1d4642f (patch)
tree3b5976f1e95812ea239342d47a860d980389daa1
parent03f5ff482e58474e9da7a2213fb96d0e0a877a4b (diff)
parent2c35d03cc0f82eef88772cd61e4457b695168418 (diff)
Merge "Update ViewLocationHolder#compareTo to properly implement Comparable"
-rw-r--r--core/java/android/view/ViewGroup.java15
1 files changed, 3 insertions, 12 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 02011e0f306b..290585198135 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -6939,13 +6939,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
if (getClass() != another.getClass()) {
return 1;
}
- // First is above second.
- if (mLocation.bottom - another.mLocation.top <= 0) {
- return -1;
- }
- // First is below second.
- if (mLocation.top - another.mLocation.bottom >= 0) {
- return 1;
+ final int topDiference = mLocation.top - another.mLocation.top;
+ if (topDiference != 0) {
+ return topDiference;
}
// LTR
if (mLayoutDirection == LAYOUT_DIRECTION_LTR) {
@@ -6961,11 +6957,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
return -rightDifference;
}
}
- // Break tie by top.
- final int topDiference = mLocation.top - another.mLocation.top;
- if (topDiference != 0) {
- return topDiference;
- }
// Break tie by height.
final int heightDiference = mLocation.height() - another.mLocation.height();
if (heightDiference != 0) {