Only show genres with songs

This commit is contained in:
Eugene Cheung 2017-12-26 14:06:58 -05:00
commit 0738961a59
No known key found for this signature in database
GPG key ID: E1FD745328866B0A

View file

@ -64,10 +64,15 @@ public class GenreLoader {
Genres.NAME
};
// Genres that actually have songs
final String selection = Genres._ID + " IN" +
" (SELECT " + Genres.Members.GENRE_ID + " FROM audio_genres_map WHERE " + Genres.Members.AUDIO_ID + " IN" +
" (SELECT " + Genres._ID + " FROM audio_meta WHERE " + SongLoader.BASE_SELECTION + "))";
try {
return context.getContentResolver().query(
Genres.EXTERNAL_CONTENT_URI,
projection, null, null, PreferenceUtil.getInstance(context).getGenreSortOrder());
projection, selection, null, PreferenceUtil.getInstance(context).getGenreSortOrder());
} catch (SecurityException e) {
return null;
}