mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 09:33:33 +00:00
fix: sort genres alphabetically as server's default sorting could lead to unpredictable results
This commit is contained in:
parent
634de67d74
commit
279302737d
1 changed files with 3 additions and 1 deletions
|
|
@ -8,7 +8,9 @@ import com.cappielloantonio.tempo.subsonic.base.ApiResponse;
|
||||||
import com.cappielloantonio.tempo.subsonic.models.Genre;
|
import com.cappielloantonio.tempo.subsonic.models.Genre;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
|
@ -39,7 +41,7 @@ public class GenreRepository {
|
||||||
if (size != -1) {
|
if (size != -1) {
|
||||||
genres.setValue(genreList.subList(0, Math.min(size, genreList.size())));
|
genres.setValue(genreList.subList(0, Math.min(size, genreList.size())));
|
||||||
} else {
|
} else {
|
||||||
genres.setValue(genreList);
|
genres.setValue(genreList.stream().sorted(Comparator.comparing(Genre::getGenre)).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue