Sort artists using case insensitive comparison when offline
Signed-off-by: Simão Mata <simao.mata@here.com>
This commit is contained in:
parent
ecdae8c6e3
commit
cfae0d30b5
|
@ -169,7 +169,7 @@ public class SelectArtistFragment extends SelectRecyclerFragment<Serializable> i
|
|||
String musicFolderId = Util.getSelectedMusicFolderId(context);
|
||||
|
||||
Indexes indexes = musicService.getIndexes(musicFolderId, refresh, context, listener);
|
||||
indexes.sortChildren(context);
|
||||
indexes.sortChildren();
|
||||
items = new ArrayList<>(indexes.getShortcuts().size() + indexes.getArtists().size());
|
||||
items.addAll(indexes.getShortcuts());
|
||||
items.addAll(indexes.getArtists());
|
||||
|
@ -184,8 +184,7 @@ public class SelectArtistFragment extends SelectRecyclerFragment<Serializable> i
|
|||
}
|
||||
|
||||
Indexes indexes = new Indexes();
|
||||
//indexes.setArtists = artists;
|
||||
indexes.sortChildren(context);
|
||||
indexes.sortChildren();
|
||||
items = new ArrayList<>(indexes.getArtists());
|
||||
|
||||
entries = dir.getChildren(false, true);
|
||||
|
|
|
@ -71,6 +71,7 @@ public class OfflineMusicService implements MusicService {
|
|||
public Indexes getIndexes(String musicFolderId, boolean refresh, Context context, ProgressListener progressListener) {
|
||||
List<Artist> artists = new ArrayList<>();
|
||||
List<Entry> entries = new ArrayList<>();
|
||||
|
||||
File root = FileUtil.getMusicDirectory(context);
|
||||
for (File file : FileUtil.listFiles(root)) {
|
||||
if (file.isDirectory()) {
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package net.nullsum.audinaut.domain
|
||||
|
||||
import android.content.Context
|
||||
import java.io.Serializable
|
||||
import java.util.*
|
||||
|
||||
class Indexes(var shortcuts: MutableList<Artist> = mutableListOf(),
|
||||
var artists: MutableList<Artist> = mutableListOf(),
|
||||
var entries: MutableList<MusicDirectory.Entry> = mutableListOf()) : Serializable {
|
||||
fun sortChildren(context: Context) {
|
||||
|
||||
fun sortChildren() {
|
||||
shortcuts.sortBy { s -> s.id.toLowerCase(Locale.ROOT) }
|
||||
artists.sortBy { a -> a.name.toLowerCase(Locale.ROOT) }
|
||||
entries.sortBy { e -> e.artist.toLowerCase(Locale.ROOT) }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue