From b17f6a4ab67247045a6de59c21f8c6983c7691c5 Mon Sep 17 00:00:00 2001 From: mvn23 Date: Mon, 27 Jun 2022 16:08:00 +0200 Subject: Fix album sort with duplicate track numbers --- .../java/github/daneren2005/dsub/domain/MusicDirectory.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java b/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java index bd7928fd..bba969e4 100644 --- a/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java @@ -715,15 +715,16 @@ public class MusicDirectory implements Serializable { Integer lhsTrack = lhs.getTrack(); Integer rhsTrack = rhs.getTrack(); - if(lhsTrack != null && rhsTrack != null && lhsTrack != rhsTrack) { + if(lhsTrack == rhsTrack) { + return collator.compare(lhs.getTitle(), rhs.getTitle()); + } + if(lhsTrack != null && rhsTrack != null) { return lhsTrack.compareTo(rhsTrack); - } else if(lhsTrack != null) { + } + if(lhsTrack != null) { return -1; - } else if(rhsTrack != null) { - return 1; } - - return collator.compare(lhs.getTitle(), rhs.getTitle()); + return 1; } public static void sort(List entries) { -- cgit v1.2.3