Search in sources :

Example 1 with Artist

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

the class ArtistLoader method getOrCreateArtist.

private static Artist getOrCreateArtist(ArrayList<Artist> artists, int artistId) {
    for (Artist artist : artists) {
        if (!artist.albums.isEmpty() && !artist.albums.get(0).songs.isEmpty() && artist.albums.get(0).songs.get(0).artistId == artistId) {
            return artist;
        }
    }
    Artist album = new Artist();
    artists.add(album);
    return album;
}
Also used : Artist(com.kabouzeid.gramophone.model.Artist)

Example 2 with Artist

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

the class ArtistLoader method getOrCreateArtist.

private static Artist getOrCreateArtist(List<Artist> artists, long artistId) {
    for (Artist artist : artists) {
        if (!artist.albums.isEmpty() && !artist.albums.get(0).songs.isEmpty() && artist.albums.get(0).songs.get(0).artistId == artistId) {
            return artist;
        }
    }
    Artist artist = new Artist();
    artists.add(artist);
    return artist;
}
Also used : Artist(com.kabouzeid.gramophone.model.Artist)

Example 3 with Artist

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

the class ArtistDetailActivity method onLoaderReset.

@Override
public void onLoaderReset(Loader<Artist> loader) {
    this.artist = new Artist();
    songAdapter.swapDataSet(artist.getSongs());
    albumAdapter.swapDataSet(artist.albums);
}
Also used : Artist(com.kabouzeid.gramophone.model.Artist) LastFmArtist(com.kabouzeid.gramophone.lastfm.rest.model.LastFmArtist)

Example 4 with Artist

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

the class SearchAdapter method onBindViewHolder.

@SuppressWarnings("ConstantConditions")
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
    switch(getItemViewType(position)) {
        case ALBUM:
            final Album album = (Album) dataSet.get(position);
            holder.title.setText(album.getTitle());
            holder.text.setText(MusicUtil.getAlbumInfoString(activity, album));
            SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong()).checkIgnoreMediaStore(activity).build().into(holder.image);
            break;
        case ARTIST:
            final Artist artist = (Artist) dataSet.get(position);
            holder.title.setText(artist.getName());
            holder.text.setText(MusicUtil.getArtistInfoString(activity, artist));
            ArtistGlideRequest.Builder.from(Glide.with(activity), artist).build().into(holder.image);
            break;
        case SONG:
            final Song song = (Song) dataSet.get(position);
            holder.title.setText(song.title);
            holder.text.setText(MusicUtil.getSongInfoString(song));
            break;
        default:
            holder.title.setText(dataSet.get(position).toString());
            break;
    }
}
Also used : Artist(com.kabouzeid.gramophone.model.Artist) Song(com.kabouzeid.gramophone.model.Song) Album(com.kabouzeid.gramophone.model.Album)

Example 5 with Artist

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

the class ArtistAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
    final Artist artist = dataSet.get(position);
    boolean isChecked = isChecked(artist);
    holder.itemView.setActivated(isChecked);
    if (holder.getAdapterPosition() == getItemCount() - 1) {
        if (holder.shortSeparator != null) {
            holder.shortSeparator.setVisibility(View.GONE);
        }
    } else {
        if (holder.shortSeparator != null) {
            holder.shortSeparator.setVisibility(View.VISIBLE);
        }
    }
    if (holder.title != null) {
        holder.title.setText(artist.getName());
    }
    if (holder.text != null) {
        holder.text.setText(MusicUtil.getArtistInfoString(activity, artist));
    }
    holder.itemView.setActivated(isChecked(artist));
    loadArtistImage(artist, holder);
}
Also used : Artist(com.kabouzeid.gramophone.model.Artist)

Aggregations

Artist (com.kabouzeid.gramophone.model.Artist)5 LastFmArtist (com.kabouzeid.gramophone.lastfm.rest.model.LastFmArtist)1 Album (com.kabouzeid.gramophone.model.Album)1 Song (com.kabouzeid.gramophone.model.Song)1