Do not sort special collections

It does not make sense to sort:

- random songs
- recently added albums
- recently played albums
- most played albums
- top rated albums
- random albums

As the order returned by the server is more relevant in these cases

Signed-off-by: lbonn <bonnans.l@gmail.com>
This commit is contained in:
lbonn 2020-12-21 23:32:50 +01:00
parent 0ce5a56051
commit f43c107269
No known key found for this signature in database
GPG Key ID: BF9070C03E67A72D
1 changed files with 20 additions and 1 deletions

View File

@ -806,6 +806,11 @@ public class SelectAlbumActivity extends SubsonicTabActivity
new LoadTask()
{
@Override
protected boolean sortableCollection() {
return false;
}
@Override
protected MusicDirectory load(MusicService service) throws Exception
{
@ -882,6 +887,16 @@ public class SelectAlbumActivity extends SubsonicTabActivity
new LoadTask()
{
@Override
protected boolean sortableCollection() {
if (albumListType.equals("newest") || albumListType.equals("random") ||
albumListType.equals("highest") || albumListType.equals("recent") ||
albumListType.equals("frequent")) {
return false;
}
return true;
}
@Override
protected MusicDirectory load(MusicService service) throws Exception
{
@ -1096,6 +1111,10 @@ public class SelectAlbumActivity extends SubsonicTabActivity
protected abstract MusicDirectory load(MusicService service) throws Exception;
protected boolean sortableCollection() {
return true;
}
@Override
protected Pair<MusicDirectory, Boolean> doInBackground() throws Throwable
{
@ -1111,7 +1130,7 @@ public class SelectAlbumActivity extends SubsonicTabActivity
MusicDirectory musicDirectory = result.getFirst();
List<MusicDirectory.Entry> entries = musicDirectory.getChildren();
if (Util.getShouldSortByDisc(SelectAlbumActivity.this))
if (sortableCollection() && Util.getShouldSortByDisc(SelectAlbumActivity.this))
{
Collections.sort(entries, new EntryByDiscAndTrackComparator());
}