Search in sources :

Example 1 with ArtistImage

use of com.kabouzeid.gramophone.glide.artistimage.ArtistImage 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)

Aggregations

AlbumCover (com.kabouzeid.gramophone.glide.artistimage.AlbumCover)1 ArtistImage (com.kabouzeid.gramophone.glide.artistimage.ArtistImage)1 Album (com.kabouzeid.gramophone.model.Album)1 Song (com.kabouzeid.gramophone.model.Song)1 ArrayList (java.util.ArrayList)1