Search in sources :

Example 6 with Album

use of com.kabouzeid.gramophone.model.Album in project Phonograph by kabouzeid.

the class ArtistGlideRequest method createBaseRequest.

public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Artist artist, boolean noCustomImage) {
    boolean hasCustomImage = CustomArtistImageUtil.getInstance(App.getInstance()).hasCustomArtistImage(artist);
    if (noCustomImage || !hasCustomImage) {
        final List<AlbumCover> songs = new ArrayList<>();
        for (final Album album : artist.albums) {
            final Song song = album.safeGetFirstSong();
            songs.add(new AlbumCover(album.getYear(), song.data));
        }
        return requestManager.load(new ArtistImage(artist.getName(), songs));
    } else {
        return requestManager.load(CustomArtistImageUtil.getFile(artist));
    }
}
Also used : Song(com.kabouzeid.gramophone.model.Song) ArrayList(java.util.ArrayList) Album(com.kabouzeid.gramophone.model.Album) AlbumCover(com.kabouzeid.gramophone.glide.artistimage.AlbumCover) ArtistImage(com.kabouzeid.gramophone.glide.artistimage.ArtistImage)

Example 7 with Album

use of com.kabouzeid.gramophone.model.Album in project Phonograph by kabouzeid.

the class AlbumLoader method getOrCreateAlbum.

private static Album getOrCreateAlbum(List<Album> albums, long albumId) {
    for (Album album : albums) {
        if (!album.songs.isEmpty() && album.songs.get(0).albumId == albumId) {
            return album;
        }
    }
    Album album = new Album();
    albums.add(album);
    return album;
}
Also used : Album(com.kabouzeid.gramophone.model.Album)

Aggregations

Album (com.kabouzeid.gramophone.model.Album)7 Song (com.kabouzeid.gramophone.model.Song)3 NonNull (androidx.annotation.NonNull)1 AlbumCover (com.kabouzeid.gramophone.glide.artistimage.AlbumCover)1 ArtistImage (com.kabouzeid.gramophone.glide.artistimage.ArtistImage)1 LastFmAlbum (com.kabouzeid.gramophone.lastfm.rest.model.LastFmAlbum)1 Artist (com.kabouzeid.gramophone.model.Artist)1 ArrayList (java.util.ArrayList)1