mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-04 02:13:07 +02:00
ContentProvider can now lookup tracks via UUID.
This commit is contained in:
@@ -20,4 +20,19 @@ public class UUIDUtils {
|
||||
byteBuffer.putLong(uuid.getLeastSignificantBits());
|
||||
return byteBuffer.array();
|
||||
}
|
||||
|
||||
private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
|
||||
|
||||
public static String toHex(@NonNull UUID uuid) {
|
||||
byte[] bytes = toBytes(uuid);
|
||||
|
||||
char[] hexChars = new char[bytes.length * 2];
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
int v = bytes[i] & 0xFF;
|
||||
|
||||
hexChars[i * 2] = HEX_ARRAY[v >>> 4];
|
||||
hexChars[i * 2 + 1] = HEX_ARRAY[v & 0x0F];
|
||||
}
|
||||
return new String(hexChars);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user