Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show album year when listing albums of an artist #283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ public void onBindViewHolder(ItemHolder itemHolder, int i) {

itemHolder.title.setText(localItem.title);
String songCount = TimberUtils.makeLabel(mContext, R.plurals.Nsongs, localItem.songCount);
itemHolder.details.setText(songCount);
String albumYear = Integer.toString(localItem.year);

if (localItem.hasYear())
itemHolder.details.setText(albumYear + " - " + songCount);
else
itemHolder.details.setText(songCount);

ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(localItem.id).toString(), itemHolder.albumArt,
new DisplayImageOptions.Builder().cacheInMemory(true)
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/naman14/timber/models/Album.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package com.naman14.timber.models;

public class Album {
public static final int YEAR_UNDEFINED = 0;

public final long artistId;
public final String artistName;
public final long id;
Expand All @@ -41,4 +43,7 @@ public Album(long _id, String _title, String _artistName, long _artistId, int _s
}


public boolean hasYear() {
return year != Album.YEAR_UNDEFINED;
}
}