Merge branch 'dkanadt push origin mastera-phonograph'
This commit is contained in:
commit
69df5ee0a0
6 changed files with 11 additions and 9 deletions
|
|
@ -198,7 +198,7 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
sectionName = dataSet.get(position).getArtistName();
|
||||
break;
|
||||
case SortOrder.AlbumSortOrder.ALBUM_YEAR:
|
||||
return Integer.toString(dataSet.get(position).getYear());
|
||||
return MusicUtil.getYearString(dataSet.get(position).getYear());
|
||||
}
|
||||
|
||||
return MusicUtil.getSectionName(sectionName);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.kabouzeid.gramophone.glide.SongGlideRequest;
|
|||
import com.kabouzeid.gramophone.helper.HorizontalAdapterHelper;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.model.Album;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
|
@ -76,11 +77,7 @@ public class HorizontalAlbumAdapter extends AlbumAdapter {
|
|||
|
||||
@Override
|
||||
protected String getAlbumText(Album album) {
|
||||
int year = album.getYear();
|
||||
if(year > 0) {
|
||||
return String.valueOf(year);
|
||||
}
|
||||
return "-";
|
||||
return MusicUtil.getYearString(album.getYear());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
sectionName = dataSet.get(position).artistName;
|
||||
break;
|
||||
case SortOrder.SongSortOrder.SONG_YEAR:
|
||||
return Integer.toString(dataSet.get(position).year);
|
||||
return MusicUtil.getYearString(dataSet.get(position).year);
|
||||
}
|
||||
|
||||
return MusicUtil.getSectionName(sectionName);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class AudioFileCoverFetcher implements DataFetcher<InputStream> {
|
|||
}
|
||||
}
|
||||
|
||||
private static final String[] FALLBACKS = {"cover.jpg", "album.jpg", "folder.jpg"};
|
||||
private static final String[] FALLBACKS = {"cover.jpg", "album.jpg", "folder.jpg", "cover.png", "album.png", "folder.png"};
|
||||
|
||||
private InputStream fallback(String path) throws FileNotFoundException {
|
||||
File parent = new File(path).getParentFile();
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
|||
artistTextView.setText(album.getArtistName());
|
||||
songCountTextView.setText(MusicUtil.getSongCountString(this, album.getSongCount()));
|
||||
durationTextView.setText(MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, album.songs)));
|
||||
albumYearTextView.setText(album.getYear() > 0 ? String.valueOf(album.getYear()) : "-");
|
||||
albumYearTextView.setText(MusicUtil.getYearString(album.getYear()));
|
||||
|
||||
adapter.swapDataSet(album.songs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,6 +139,11 @@ public class MusicUtil {
|
|||
return albumCount + " " + albumString;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static String getYearString(int year) {
|
||||
return year > 0 ? String.valueOf(year) : "-";
|
||||
}
|
||||
|
||||
public static long getTotalDuration(@NonNull final Context context, @NonNull List<Song> songs) {
|
||||
long duration = 0;
|
||||
for (int i = 0; i < songs.size(); i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue