Merge "Fixing other missing cases of truncated sorts." into ub-launcher3-burnaby-polish

This commit is contained in:
Winson Chung
2015-09-30 00:06:55 +00:00
committed by Android (Google) Code Review
2 changed files with 3 additions and 3 deletions

View File

@@ -252,8 +252,8 @@ public class InvariantDeviceProfile {
ArrayList<InvariantDeviceProfile> pointsByNearness = points;
Collections.sort(pointsByNearness, new Comparator<InvariantDeviceProfile>() {
public int compare(InvariantDeviceProfile a, InvariantDeviceProfile b) {
return (int) (dist(width, height, a.minWidthDps, a.minHeightDps)
- dist(width, height, b.minWidthDps, b.minHeightDps));
return Float.compare(dist(width, height, a.minWidthDps, a.minHeightDps),
dist(width, height, b.minWidthDps, b.minHeightDps));
}
});

View File

@@ -2469,7 +2469,7 @@ public class LauncherModel extends BroadcastReceiver
lhs.cellY * cellCountX + lhs.cellX);
long rr = (rhs.container * containerOffset + rhs.screenId * screenOffset +
rhs.cellY * cellCountX + rhs.cellX);
return (int) (lr - rr);
return Long.compare(lr, rr);
}
});
}