Merge "Replace Long.compare() with implementation." into ub-launcher3-burnaby-polish

This commit is contained in:
Winson Chung
2015-10-01 22:53:15 +00:00
committed by Android (Google) Code Review
3 changed files with 10 additions and 3 deletions

View File

@@ -2387,7 +2387,7 @@ public class LauncherModel extends BroadcastReceiver
Collections.sort(allWorkspaceItems, new Comparator<ItemInfo>() {
@Override
public int compare(ItemInfo lhs, ItemInfo rhs) {
return Long.compare(lhs.container, rhs.container);
return Utilities.longCompare(lhs.container, rhs.container);
}
});
for (ItemInfo info : allWorkspaceItems) {
@@ -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 Long.compare(lr, rr);
return Utilities.longCompare(lr, rr);
}
});
}

View File

@@ -747,4 +747,11 @@ public final class Utilities {
return msg;
}
}
/**
* Replacement for Long.compare() which was added in API level 19.
*/
public static int longCompare(long lhs, long rhs) {
return lhs < rhs ? -1 : (lhs == rhs ? 0 : 1);
}
}

View File

@@ -156,7 +156,7 @@ public class ManagedProfileHeuristic {
@Override
public int compare(ShortcutInfo lhs, ShortcutInfo rhs) {
return Long.compare(lhs.firstInstallTime, rhs.firstInstallTime);
return Utilities.longCompare(lhs.firstInstallTime, rhs.firstInstallTime);
}
});