From fbe5ea4db99fe6e2baa2737b1e59fb48ad60e080 Mon Sep 17 00:00:00 2001 From: Antoine POPINEAU Date: Fri, 22 Nov 2019 20:24:08 +0100 Subject: [PATCH] Sort album view by track position. --- .../com/github/apognu/otter/repositories/TracksRepository.kt | 2 +- app/src/main/java/com/github/apognu/otter/utils/Models.kt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/apognu/otter/repositories/TracksRepository.kt b/app/src/main/java/com/github/apognu/otter/repositories/TracksRepository.kt index 6461969..53a4be2 100644 --- a/app/src/main/java/com/github/apognu/otter/repositories/TracksRepository.kt +++ b/app/src/main/java/com/github/apognu/otter/repositories/TracksRepository.kt @@ -25,6 +25,6 @@ class TracksRepository(override val context: Context?, albumId: Int) : Repositor data.map { track -> track.favorite = favorites.contains(track.id) track - } + }.sortedBy { it.position } } } \ No newline at end of file diff --git a/app/src/main/java/com/github/apognu/otter/utils/Models.kt b/app/src/main/java/com/github/apognu/otter/utils/Models.kt index 90362f5..63de201 100644 --- a/app/src/main/java/com/github/apognu/otter/utils/Models.kt +++ b/app/src/main/java/com/github/apognu/otter/utils/Models.kt @@ -75,6 +75,7 @@ data class Track( val title: String, val artist: Artist, val album: Album, + val position: Int, val uploads: List ) { var current: Boolean = false