mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
feat: added optional information about audio quality for horizontal track adapters
This commit is contained in:
parent
733102a8a4
commit
7488346804
9 changed files with 44 additions and 6 deletions
|
|
@ -49,7 +49,20 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
|
|||
Child song = songs.get(position);
|
||||
|
||||
holder.item.searchResultSongTitleTextView.setText(MusicUtil.getReadableString(song.getTitle()));
|
||||
holder.item.searchResultSongSubtitleTextView.setText(holder.itemView.getContext().getString(R.string.song_subtitle_formatter, MusicUtil.getReadableString(this.showAlbum ? song.getAlbum() : song.getArtist()), MusicUtil.getReadableDurationString(song.getDuration(), false)));
|
||||
|
||||
holder.item.searchResultSongSubtitleTextView.setText(
|
||||
holder.itemView.getContext().getString(
|
||||
R.string.song_subtitle_formatter,
|
||||
MusicUtil.getReadableString(
|
||||
this.showAlbum ?
|
||||
song.getAlbum() :
|
||||
song.getArtist()
|
||||
),
|
||||
MusicUtil.getReadableDurationString(song.getDuration(), false),
|
||||
MusicUtil.getReadableAudioQualityString(song)
|
||||
)
|
||||
);
|
||||
|
||||
holder.item.trackNumberTextView.setText(MusicUtil.getReadableTrackNumber(holder.itemView.getContext(), song.getTrack()));
|
||||
|
||||
if (DownloadUtil.getDownloadTracker(holder.itemView.getContext()).isDownloaded(song.getId())) {
|
||||
|
|
|
|||
|
|
@ -156,6 +156,17 @@ public class MusicUtil {
|
|||
return getReadableDurationString(lenght, millis);
|
||||
}
|
||||
|
||||
public static String getReadableAudioQualityString(Child child) {
|
||||
if (!Preferences.showAudioQuality()) return "";
|
||||
|
||||
return "•" +
|
||||
" " +
|
||||
child.getBitrate() +
|
||||
"kbps" +
|
||||
" " +
|
||||
child.getSuffix();
|
||||
}
|
||||
|
||||
public static String getReadablePodcastDurationString(long duration) {
|
||||
long minutes = duration / 60;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ object Preferences {
|
|||
private const val MIN_STAR_RATING = "min_star_rating"
|
||||
private const val ARTIST_ALBUM_LAYOUT = "artist_album_layout"
|
||||
private const val ALWAYS_ON_DISPLAY = "always_on_display"
|
||||
private const val AUDIO_QUALITY_PER_ITEM = "audio_quality_per_item"
|
||||
|
||||
|
||||
@JvmStatic
|
||||
|
|
@ -390,4 +391,9 @@ object Preferences {
|
|||
fun isDisplayAlwaysOn(): Boolean {
|
||||
return App.getInstance().preferences.getBoolean(ALWAYS_ON_DISPLAY, false)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showAudioQuality(): Boolean {
|
||||
return App.getInstance().preferences.getBoolean(AUDIO_QUALITY_PER_ITEM, false)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue