mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 02:13:33 +00:00
Changed the sort order of the songs in the playlist and added a download button
This commit is contained in:
parent
a466574e08
commit
91fd7a5b29
10 changed files with 106 additions and 12 deletions
|
|
@ -293,6 +293,23 @@ public class SongRepository {
|
|||
return sample;
|
||||
}
|
||||
|
||||
public List<Song> getPlaylistSong(String playlistID) {
|
||||
List<Song> songs = new ArrayList<>();
|
||||
|
||||
GetSongsByPlaylistIDThreadSafe playlistThread = new GetSongsByPlaylistIDThreadSafe(songDao, playlistID);
|
||||
Thread thread = new Thread(playlistThread);
|
||||
thread.start();
|
||||
|
||||
try {
|
||||
thread.join();
|
||||
songs = playlistThread.getSongs();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return songs;
|
||||
}
|
||||
|
||||
private static class GetRandomSongsByArtistIDThreadSafe implements Runnable {
|
||||
private SongDao songDao;
|
||||
private String artistID;
|
||||
|
|
@ -509,4 +526,24 @@ public class SongRepository {
|
|||
return sample;
|
||||
}
|
||||
}
|
||||
|
||||
private static class GetSongsByPlaylistIDThreadSafe implements Runnable {
|
||||
private SongDao songDao;
|
||||
private String playlistID;
|
||||
private List<Song> songs = new ArrayList<>();
|
||||
|
||||
public GetSongsByPlaylistIDThreadSafe(SongDao songDao, String playlistID) {
|
||||
this.songDao = songDao;
|
||||
this.playlistID = playlistID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
songs = songDao.getPlaylistSong(playlistID);
|
||||
}
|
||||
|
||||
public List<Song> getSongs() {
|
||||
return songs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue