From d0835c3a0c6ee973b690664bc2a565c489a2a43e Mon Sep 17 00:00:00 2001 From: OxygenCobalt Date: Sun, 3 Oct 2021 18:39:49 -0600 Subject: [PATCH] detail: fix genre sort issue Fix a problem where GenreDetailFragment would apply ASCENDING when ARTIST was selected in the sort menu. Turns out it was a bad constant match. --- .../org/oxycblt/auxio/detail/GenreDetailFragment.kt | 1 + .../java/org/oxycblt/auxio/music/MusicLoader.kt | 13 ++++++------- app/src/main/java/org/oxycblt/auxio/ui/SortMode.kt | 2 +- app/src/main/res/layout/item_song.xml | 2 -- app/src/main/res/values/styles_ui.xml | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/oxycblt/auxio/detail/GenreDetailFragment.kt b/app/src/main/java/org/oxycblt/auxio/detail/GenreDetailFragment.kt index 3aab76b95..f6e75915d 100644 --- a/app/src/main/java/org/oxycblt/auxio/detail/GenreDetailFragment.kt +++ b/app/src/main/java/org/oxycblt/auxio/detail/GenreDetailFragment.kt @@ -38,6 +38,7 @@ import org.oxycblt.auxio.util.logD /** * The [DetailFragment] for a genre. + * TODO: Fix issue where ARTIST order defaults to ASCENDING for some reason. * @author OxygenCobalt */ class GenreDetailFragment : DetailFragment() { diff --git a/app/src/main/java/org/oxycblt/auxio/music/MusicLoader.kt b/app/src/main/java/org/oxycblt/auxio/music/MusicLoader.kt index 480c161aa..cb94d5c7d 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/MusicLoader.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/MusicLoader.kt @@ -40,14 +40,13 @@ import org.oxycblt.auxio.util.logD * * You think that if you wanted to query a song's genre from a media database, you could just * put "genre" in the query and it would return it, right? But not with MediaStore! No, that's - * too straightfoward for this SDK that was dropped on it's head as a baby. So instead, you + * too straightfoward for this class that was dropped on it's head as a baby. So instead, you * have to query for each genre, query all the songs in each genre, and then iterate through those - * songs to link every song with their genre. This is not documented anywhere in MediaStore's - * documentation, and the O(mom im scared) algorithm you have to run to get it working - * single-handedly DOUBLES Auxio's loading times. At no point have the devs considered that this - * column is absolutely busted, and instead focused on adding infuriat- I mean nice proprietary - * extensions to MediaStore for their own Google Play Music, and we all know how great that worked - * out! + * songs to link every song with their genre. This is not documented anywhere, and the + * O(mom im scared) algorithm you have to run to get it working single-handedly DOUBLES Auxio's + * loading times. At no point have the devs considered that this column is absolutely busted, and + * instead focused on adding infuriat- I mean nice proprietary extensions to MediaStore for their + * own Google Play Music, and we all know how great that worked out! * * It's not even ergonomics that makes this API bad. It's base implementation is completely borked * as well. Did you know that MediaStore doesn't accept dates that aren't from ID3v2.3 MP3 files? diff --git a/app/src/main/java/org/oxycblt/auxio/ui/SortMode.kt b/app/src/main/java/org/oxycblt/auxio/ui/SortMode.kt index bfff59f12..f50ab4fad 100644 --- a/app/src/main/java/org/oxycblt/auxio/ui/SortMode.kt +++ b/app/src/main/java/org/oxycblt/auxio/ui/SortMode.kt @@ -170,7 +170,7 @@ enum class SortMode(@IdRes val itemId: Int) { return when (value) { INT_ASCENDING -> ASCENDING INT_DESCENDING -> DESCENDING - INT_ARTIST -> ASCENDING + INT_ARTIST -> ARTIST INT_ALBUM -> ALBUM INT_YEAR -> YEAR else -> null diff --git a/app/src/main/res/layout/item_song.xml b/app/src/main/res/layout/item_song.xml index 4e1c2daa8..78a2f875c 100644 --- a/app/src/main/res/layout/item_song.xml +++ b/app/src/main/res/layout/item_song.xml @@ -29,7 +29,6 @@ style="@style/Widget.Auxio.TextView.Item.Primary" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/spacing_medium" android:text="@{song.name}" app:layout_constraintBottom_toTopOf="@+id/song_info" app:layout_constraintEnd_toEndOf="parent" @@ -43,7 +42,6 @@ style="@style/Widget.Auxio.TextView.Item.Secondary" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/spacing_medium" android:text="@{@string/fmt_two(song.album.artist.name, song.album.name)}" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/values/styles_ui.xml b/app/src/main/res/values/styles_ui.xml index 20fd5f73d..61c611c3e 100644 --- a/app/src/main/res/values/styles_ui.xml +++ b/app/src/main/res/values/styles_ui.xml @@ -64,7 +64,6 @@