Skip to content

Commit 58bff81

Browse files
committed
add missing piece for file path sort
1 parent b15a76e commit 58bff81

File tree

1 file changed

+6
-0
lines changed
  • app/src/main/kotlin/org/akanework/gramophone/ui/adapters

1 file changed

+6
-0
lines changed

app/src/main/kotlin/org/akanework/gramophone/ui/adapters/SongAdapter.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import androidx.appcompat.app.AlertDialog
2525
import androidx.appcompat.widget.PopupMenu
2626
import androidx.core.app.ShareCompat
2727
import androidx.core.content.FileProvider
28+
import androidx.core.net.toFile
2829
import androidx.fragment.app.Fragment
2930
import androidx.fragment.app.activityViewModels
3031
import androidx.media3.common.C
@@ -319,13 +320,18 @@ class SongAdapter(
319320
Sorter.Type.ByAddDateDescending, Sorter.Type.ByAddDateAscending,
320321
Sorter.Type.ByReleaseDateDescending, Sorter.Type.ByReleaseDateAscending,
321322
Sorter.Type.ByModifiedDateDescending, Sorter.Type.ByModifiedDateAscending,
323+
Sorter.Type.ByFilePathDescending, Sorter.Type.ByFilePathAscending,
322324
Sorter.Type.ByDiscAndTrack
323325
)
324326
) : Sorter.Helper<MediaItem>(types) {
325327
override fun getId(item: MediaItem): String {
326328
return item.mediaId
327329
}
328330

331+
override fun getFile(item: MediaItem): File {
332+
return item.localConfiguration!!.uri.toFile()
333+
}
334+
329335
override fun getTitle(item: MediaItem): String {
330336
return item.mediaMetadata.title.toString()
331337
}

0 commit comments

Comments
 (0)