/** 获取歌手的所有专辑 */ public static ArrayList<Album> getArtistAlbums(Artist artist) { ArrayList<Album> albums = new ArrayList<>(); for (Album a : mAlbumLib) { if (a.getmArtistId() == artist.getmArtistId()) { albums.add(a); } } return albums; }
/** 获取歌曲的专辑,每首歌只有一个专辑 */ public static ArrayList<Album> getSongAlbum(Song song) { ArrayList<Album> albums = new ArrayList<>(); for (Album a : mAlbumLib) { if (a.getmAlbumId() == song.getmAlbumId()) { albums.add(a); break; } } return albums; }
/** * 获取专辑下的所有歌曲 * * @return 同一专辑的所有歌 */ public static ArrayList<Song> getAlbumSongs(Album album) { ArrayList<Song> songs = new ArrayList<>(); for (Song s : mSongLib) { if (s.getmAlbumId() == album.getmAlbumId()) { songs.add(s); } } return songs; }