use of com.naman14.timber.models.Song in project Timber by naman14.
the class SearchAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final ItemHolder itemHolder, int i) {
switch(getItemViewType(i)) {
case 0:
Song song = (Song) searchResults.get(i);
itemHolder.title.setText(song.title);
itemHolder.songartist.setText(song.albumName);
ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(song.albumId).toString(), itemHolder.albumArt, new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).displayer(new FadeInBitmapDisplayer(400)).build());
setOnPopupMenuListener(itemHolder, i);
break;
case 1:
Album album = (Album) searchResults.get(i);
itemHolder.albumtitle.setText(album.title);
itemHolder.albumartist.setText(album.artistName);
ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(album.id).toString(), itemHolder.albumArt, new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).displayer(new FadeInBitmapDisplayer(400)).build());
break;
case 2:
Artist artist = (Artist) searchResults.get(i);
itemHolder.artisttitle.setText(artist.name);
String albumNmber = TimberUtils.makeLabel(mContext, R.plurals.Nalbums, artist.albumCount);
String songCount = TimberUtils.makeLabel(mContext, R.plurals.Nsongs, artist.songCount);
itemHolder.albumsongcount.setText(TimberUtils.makeCombinedString(mContext, albumNmber, songCount));
LastFmClient.getInstance(mContext).getArtistInfo(new ArtistQuery(artist.name), new ArtistInfoListener() {
@Override
public void artistInfoSucess(LastfmArtist artist) {
if (artist != null && itemHolder.artistImage != null) {
ImageLoader.getInstance().displayImage(artist.mArtwork.get(1).mUrl, itemHolder.artistImage, new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).displayer(new FadeInBitmapDisplayer(400)).build());
}
}
@Override
public void artistInfoFailed() {
}
});
break;
case 10:
itemHolder.sectionHeader.setText((String) searchResults.get(i));
case 3:
break;
}
}
use of com.naman14.timber.models.Song in project Timber by naman14.
the class ArtistMusicFragment method setUpSongs.
private void setUpSongs() {
songsRecyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
ArrayList<Song> songList;
songList = ArtistSongLoader.getSongsForArtist(getActivity(), artistID);
// adding one dummy song to top of arraylist
//there will be albums header at this position in recyclerview
songList.add(0, new Song(-1, -1, -1, "dummy", "dummy", "dummy", -1, -1));
mSongAdapter = new ArtistSongAdapter(getActivity(), songList, artistID);
songsRecyclerview.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
songsRecyclerview.setAdapter(mSongAdapter);
}
use of com.naman14.timber.models.Song in project Timber by naman14.
the class ArtistSongAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ItemHolder itemHolder, int i) {
if (getItemViewType(i) == 0) {
//nothing
setUpAlbums(itemHolder.albumsRecyclerView);
} else {
Song localItem = arraylist.get(i);
itemHolder.title.setText(localItem.title);
itemHolder.album.setText(localItem.albumName);
ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(localItem.albumId).toString(), itemHolder.albumArt, new DisplayImageOptions.Builder().cacheInMemory(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).build());
setOnPopupMenuListener(itemHolder, i - 1);
}
}
use of com.naman14.timber.models.Song in project Timber by naman14.
the class BaseQueueAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ItemHolder itemHolder, int i) {
Song localItem = arraylist.get(i);
itemHolder.title.setText(localItem.title);
itemHolder.artist.setText(localItem.artistName);
if (MusicPlayer.getCurrentAudioId() == localItem.id) {
itemHolder.title.setTextColor(Config.accentColor(mContext, ateKey));
if (MusicPlayer.isPlaying()) {
itemHolder.visualizer.setColor(Config.accentColor(mContext, ateKey));
itemHolder.visualizer.setVisibility(View.VISIBLE);
}
} else {
itemHolder.title.setTextColor(Config.textColorPrimary(mContext, ateKey));
itemHolder.visualizer.setVisibility(View.GONE);
}
ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(localItem.albumId).toString(), itemHolder.albumArt, new DisplayImageOptions.Builder().cacheInMemory(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).build());
setOnPopupMenuListener(itemHolder, i);
}
use of com.naman14.timber.models.Song in project Timber by naman14.
the class PlayingQueueAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ItemHolder itemHolder, int i) {
Song localItem = arraylist.get(i);
itemHolder.title.setText(localItem.title);
itemHolder.artist.setText(localItem.artistName);
if (MusicPlayer.getCurrentAudioId() == localItem.id) {
itemHolder.title.setTextColor(Config.accentColor(mContext, ateKey));
if (MusicPlayer.isPlaying()) {
itemHolder.visualizer.setColor(Config.accentColor(mContext, ateKey));
itemHolder.visualizer.setVisibility(View.VISIBLE);
}
} else {
itemHolder.title.setTextColor(Config.textColorPrimary(mContext, ateKey));
itemHolder.visualizer.setVisibility(View.GONE);
}
ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(localItem.albumId).toString(), itemHolder.albumArt, new DisplayImageOptions.Builder().cacheInMemory(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).build());
setOnPopupMenuListener(itemHolder, i);
}
Aggregations