Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #40 from schilit/SortOrder
Browse files Browse the repository at this point in the history
Sort NEAREST above all else
  • Loading branch information
schilit committed Nov 23, 2014
2 parents 7607e84 + e92195d commit 6a184f4
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ public int compareTo(@NonNull DeviceSighting other) {
final String otherAddress = other.scanResult.getDevice().getAddress();
// Sort by the stabilized region of the device, unless
// they are the same, in which case sort by distance.
final String nearest = mRegionResolver.getNearestAddress();
if (address.equals(nearest)) {
return -1;
}
if (otherAddress.equals(nearest)) {
return 1;
}
int r1 = mRegionResolver.getRegion(address);
int r2 = mRegionResolver.getRegion(otherAddress);
if (r1 != r2) {
Expand Down

0 comments on commit 6a184f4

Please sign in to comment.