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();
|
sectionName = dataSet.get(position).getArtistName();
|
||||||
break;
|
break;
|
||||||
case SortOrder.AlbumSortOrder.ALBUM_YEAR:
|
case SortOrder.AlbumSortOrder.ALBUM_YEAR:
|
||||||
return Integer.toString(dataSet.get(position).getYear());
|
return MusicUtil.getYearString(dataSet.get(position).getYear());
|
||||||
}
|
}
|
||||||
|
|
||||||
return MusicUtil.getSectionName(sectionName);
|
return MusicUtil.getSectionName(sectionName);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import com.kabouzeid.gramophone.glide.SongGlideRequest;
|
||||||
import com.kabouzeid.gramophone.helper.HorizontalAdapterHelper;
|
import com.kabouzeid.gramophone.helper.HorizontalAdapterHelper;
|
||||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||||
import com.kabouzeid.gramophone.model.Album;
|
import com.kabouzeid.gramophone.model.Album;
|
||||||
|
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
@ -76,11 +77,7 @@ public class HorizontalAlbumAdapter extends AlbumAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getAlbumText(Album album) {
|
protected String getAlbumText(Album album) {
|
||||||
int year = album.getYear();
|
return MusicUtil.getYearString(album.getYear());
|
||||||
if(year > 0) {
|
|
||||||
return String.valueOf(year);
|
|
||||||
}
|
|
||||||
return "-";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
||||||
sectionName = dataSet.get(position).artistName;
|
sectionName = dataSet.get(position).artistName;
|
||||||
break;
|
break;
|
||||||
case SortOrder.SongSortOrder.SONG_YEAR:
|
case SortOrder.SongSortOrder.SONG_YEAR:
|
||||||
return Integer.toString(dataSet.get(position).year);
|
return MusicUtil.getYearString(dataSet.get(position).year);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MusicUtil.getSectionName(sectionName);
|
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 {
|
private InputStream fallback(String path) throws FileNotFoundException {
|
||||||
File parent = new File(path).getParentFile();
|
File parent = new File(path).getParentFile();
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
artistTextView.setText(album.getArtistName());
|
artistTextView.setText(album.getArtistName());
|
||||||
songCountTextView.setText(MusicUtil.getSongCountString(this, album.getSongCount()));
|
songCountTextView.setText(MusicUtil.getSongCountString(this, album.getSongCount()));
|
||||||
durationTextView.setText(MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, album.songs)));
|
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);
|
adapter.swapDataSet(album.songs);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,11 @@ public class MusicUtil {
|
||||||
return albumCount + " " + albumString;
|
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) {
|
public static long getTotalDuration(@NonNull final Context context, @NonNull List<Song> songs) {
|
||||||
long duration = 0;
|
long duration = 0;
|
||||||
for (int i = 0; i < songs.size(); i++) {
|
for (int i = 0; i < songs.size(); i++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue