add empty constructor for song model
This commit is contained in:
parent
295df08a46
commit
632061bb7f
7 changed files with 21 additions and 15 deletions
|
|
@ -90,7 +90,7 @@ public abstract class AbsOffsetSongAdapter extends SongAdapter {
|
|||
@Override
|
||||
protected Song getSong() {
|
||||
// return empty song just to be safe
|
||||
if (getItemViewType() == OFFSET_ITEM) return Song.EMPTY_SONG;
|
||||
if (getItemViewType() == OFFSET_ITEM) return Song.EMPTY;
|
||||
return dataSet.get(getAdapterPosition() - 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public class MusicPlayerRemote {
|
|||
return musicService.getCurrentSong();
|
||||
}
|
||||
|
||||
return Song.EMPTY_SONG;
|
||||
return Song.EMPTY;
|
||||
}
|
||||
|
||||
public static int getPosition() {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class SongLoader {
|
|||
if (cursor != null && cursor.moveToFirst()) {
|
||||
song = getSongFromCursorImpl(cursor);
|
||||
} else {
|
||||
song = Song.EMPTY_SONG;
|
||||
song = Song.EMPTY;
|
||||
}
|
||||
|
||||
if (cursor != null) {
|
||||
|
|
|
|||
|
|
@ -10,18 +10,20 @@ import org.jellyfin.apiclient.model.dto.MediaSourceInfo;
|
|||
import org.jellyfin.apiclient.model.entities.ImageType;
|
||||
import org.jellyfin.apiclient.model.entities.MediaStream;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Song implements Parcelable {
|
||||
public static final Song EMPTY_SONG = new Song(null, "", -1, -1, -1, -1, null, "", null, "", null, false);
|
||||
public static final Song EMPTY = new Song();
|
||||
|
||||
public final String id;
|
||||
public final String title;
|
||||
public final int trackNumber;
|
||||
public final int discNumber;
|
||||
public final int year;
|
||||
public final long duration;
|
||||
public String id;
|
||||
public String title;
|
||||
public int trackNumber;
|
||||
public int discNumber;
|
||||
public int year;
|
||||
public long duration;
|
||||
|
||||
public final String albumId;
|
||||
public final String albumName;
|
||||
public String albumId;
|
||||
public String albumName;
|
||||
|
||||
public String artistId;
|
||||
public String artistName;
|
||||
|
|
@ -41,6 +43,10 @@ public class Song implements Parcelable {
|
|||
public int bitDepth;
|
||||
public int channels;
|
||||
|
||||
public Song() {
|
||||
this.id = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public Song(BaseItemDto itemDto) {
|
||||
this.id = itemDto.getId();
|
||||
this.title = itemDto.getName();
|
||||
|
|
|
|||
|
|
@ -623,7 +623,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
|||
if (position >= 0 && position < getPlayingQueue().size()) {
|
||||
return getPlayingQueue().get(position);
|
||||
} else {
|
||||
return Song.EMPTY_SONG;
|
||||
return Song.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
|||
@SuppressWarnings("ConstantConditions")
|
||||
private static class PortraitImpl extends BaseImpl {
|
||||
MediaEntryViewHolder currentSongViewHolder;
|
||||
Song currentSong = Song.EMPTY_SONG;
|
||||
Song currentSong = Song.EMPTY;
|
||||
|
||||
public PortraitImpl(CardPlayerFragment fragment, FragmentCardPlayerBinding binding) {
|
||||
super(fragment, binding);
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
|||
@SuppressWarnings("ConstantConditions")
|
||||
private static class PortraitImpl extends BaseImpl {
|
||||
MediaEntryViewHolder currentSongViewHolder;
|
||||
Song currentSong = Song.EMPTY_SONG;
|
||||
Song currentSong = Song.EMPTY;
|
||||
|
||||
public PortraitImpl(FlatPlayerFragment fragment, FragmentFlatPlayerBinding binding) {
|
||||
super(fragment, binding);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue