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;
}
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;
}
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);
}
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;
}
}
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);
}
Aggregations