mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-02 23:43:37 +00:00
fix: set placeholder if track number is null
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user