mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
fix: set placeholder if track number is null
This commit is contained in:
parent
db76494525
commit
17345372a2
2 changed files with 10 additions and 1 deletions
|
|
@ -48,7 +48,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
|
|||
|
||||
holder.item.searchResultSongTitleTextView.setText(MusicUtil.getReadableString(song.getTitle()));
|
||||
holder.item.searchResultSongSubtitleTextView.setText(holder.itemView.getContext().getString(R.string.song_subtitle_formatter, MusicUtil.getReadableString(song.getArtist()), MusicUtil.getReadableDurationString(song.getDuration() != null ? song.getDuration() : 0, false)));
|
||||
holder.item.trackNumberTextView.setText(String.valueOf(song.getTrack()));
|
||||
holder.item.trackNumberTextView.setText(MusicUtil.getReadableTrackNumber(holder.itemView.getContext(), song.getTrack()));
|
||||
|
||||
if (DownloadUtil.getDownloadTracker(holder.itemView.getContext()).isDownloaded(song.getId())) {
|
||||
holder.item.searchResultDowanloadIndicatorImageView.setVisibility(View.VISIBLE);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import android.text.Html;
|
|||
import android.util.Log;
|
||||
|
||||
import com.cappielloantonio.tempo.App;
|
||||
import com.cappielloantonio.tempo.R;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -122,6 +123,14 @@ public class MusicUtil {
|
|||
return "";
|
||||
}
|
||||
|
||||
public static String getReadableTrackNumber(Context context, Integer trackNumber) {
|
||||
if (trackNumber != null) {
|
||||
return String.valueOf(trackNumber);
|
||||
}
|
||||
|
||||
return context.getString(R.string.label_placeholder);
|
||||
}
|
||||
|
||||
public static String forceReadableString(String string) {
|
||||
if (string != null) {
|
||||
return getReadableString(string)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue