mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
Build song subtitle string via android getString() parameters
This commit is contained in:
parent
159562f9e3
commit
d108c1b6a5
6 changed files with 35 additions and 58 deletions
|
|
@ -21,9 +21,6 @@ import com.cappielloantonio.play.util.MusicUtil;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Adapter per i brani ritrovati nella ricerca
|
||||
*/
|
||||
public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueueAdapter.ViewHolder> {
|
||||
private static final String TAG = "SongResultSearchAdapter";
|
||||
|
||||
|
|
@ -52,7 +49,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
|||
Song song = songs.get(position);
|
||||
|
||||
holder.songTitle.setText(MusicUtil.getReadableString(song.getTitle()));
|
||||
holder.songArtist.setText(MusicUtil.getReadableString(song.getArtistName()));
|
||||
holder.songSubtitle.setText(context.getString(R.string.song_subtitle_formatter, MusicUtil.getReadableString(song.getArtistName()), MusicUtil.getReadableDurationString(song.getDuration(), false)));
|
||||
|
||||
CustomGlideRequest.Builder
|
||||
.from(context, song.getPrimary(), CustomGlideRequest.SONG_PIC, null)
|
||||
|
|
@ -62,7 +59,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
|||
|
||||
if (position < MusicPlayerRemote.getPosition()) {
|
||||
holder.songTitle.setTextColor(context.getResources().getColor(R.color.songToPlayTextColor, null));
|
||||
holder.songArtist.setTextColor(context.getResources().getColor(R.color.songToPlayTextColor, null));
|
||||
holder.songSubtitle.setTextColor(context.getResources().getColor(R.color.songToPlayTextColor, null));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,19 +83,20 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
|||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
TextView songTitle;
|
||||
TextView songArtist;
|
||||
TextView songSubtitle;
|
||||
ImageView cover;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
songTitle = itemView.findViewById(R.id.queue_song_title_text_view);
|
||||
songArtist = itemView.findViewById(R.id.queue_song_artist_text_view);
|
||||
songSubtitle = itemView.findViewById(R.id.queue_song_subtitle_text_view);
|
||||
cover = itemView.findViewById(R.id.queue_song_cover_image_view);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
|
||||
songTitle.setSelected(true);
|
||||
songSubtitle.setSelected(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -56,8 +56,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
|
|||
Song song = songs.get(position);
|
||||
|
||||
holder.songTitle.setText(MusicUtil.getReadableString(song.getTitle()));
|
||||
holder.songArtist.setText(MusicUtil.getReadableString(song.getArtistName()));
|
||||
holder.songDuration.setText(MusicUtil.getReadableDurationString(song.getDuration(), false));
|
||||
holder.songSubtitle.setText(context.getString(R.string.song_subtitle_formatter, MusicUtil.getReadableString(song.getArtistName()), MusicUtil.getReadableDurationString(song.getDuration(), false)));
|
||||
holder.trackNumber.setText(String.valueOf(song.getTrackNumber()));
|
||||
|
||||
if (DownloadUtil.getDownloadTracker(context).isDownloaded(song)) {
|
||||
|
|
@ -93,8 +92,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
|
|||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
TextView songTitle;
|
||||
TextView songArtist;
|
||||
TextView songDuration;
|
||||
TextView songSubtitle;
|
||||
TextView trackNumber;
|
||||
View downloadIndicator;
|
||||
View coverSeparator;
|
||||
|
|
@ -105,8 +103,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
|
|||
super(itemView);
|
||||
|
||||
songTitle = itemView.findViewById(R.id.search_result_song_title_text_view);
|
||||
songArtist = itemView.findViewById(R.id.album_artist_text_view);
|
||||
songDuration = itemView.findViewById(R.id.search_result_song_duration_text_view);
|
||||
songSubtitle = itemView.findViewById(R.id.search_result_song_subtitle_text_view);
|
||||
trackNumber = itemView.findViewById(R.id.track_number_text_view);
|
||||
downloadIndicator = itemView.findViewById(R.id.search_result_dowanload_indicator_image_view);
|
||||
more = itemView.findViewById(R.id.search_result_song_more_button);
|
||||
|
|
@ -119,6 +116,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
|
|||
more.setOnClickListener(this::openMore);
|
||||
|
||||
songTitle.setSelected(true);
|
||||
songSubtitle.setSelected(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue