mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Fix artist cover visualization
This commit is contained in:
parent
80f30aa41a
commit
c55f639368
21 changed files with 157 additions and 334 deletions
|
|
@ -11,44 +11,17 @@ import androidx.room.PrimaryKey;
|
|||
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumID3;
|
||||
|
||||
@Entity(tableName = "album")
|
||||
public class Album implements Parcelable {
|
||||
private static final String TAG = "Album";
|
||||
|
||||
@NonNull
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "id")
|
||||
public String id;
|
||||
|
||||
@ColumnInfo(name = "title")
|
||||
public String title;
|
||||
|
||||
@ColumnInfo(name = "year")
|
||||
public int year;
|
||||
|
||||
@ColumnInfo(name = "artistId")
|
||||
public String artistId;
|
||||
|
||||
@ColumnInfo(name = "artistName")
|
||||
public String artistName;
|
||||
|
||||
@ColumnInfo(name = "primary")
|
||||
public String primary;
|
||||
|
||||
@ColumnInfo(name = "blurHash")
|
||||
public String blurHash;
|
||||
|
||||
public Album(@NonNull String id, String title, int year, String artistId, String artistName, String primary, String blurHash) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.year = year;
|
||||
this.artistId = artistId;
|
||||
this.artistName = artistName;
|
||||
this.primary = primary;
|
||||
this.blurHash = blurHash;
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public Album(AlbumID3 albumID3) {
|
||||
this.id = albumID3.getId();
|
||||
this.title = albumID3.getName();
|
||||
|
|
@ -57,13 +30,11 @@ public class Album implements Parcelable {
|
|||
this.artistName = albumID3.getArtist();
|
||||
this.primary = albumID3.getCoverArtId();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(@NonNull String id) {
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,61 +0,0 @@
|
|||
package com.cappielloantonio.play.model;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity(tableName = "album_artist_cross")
|
||||
public class AlbumArtistCross {
|
||||
@NonNull
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "id")
|
||||
private int id;
|
||||
|
||||
@ColumnInfo(name = "album_id")
|
||||
private String albumId;
|
||||
|
||||
@ColumnInfo(name = "artist_id")
|
||||
private String artistId;
|
||||
|
||||
@ColumnInfo(name = "is_producer")
|
||||
private boolean isProducer;
|
||||
|
||||
public AlbumArtistCross(String albumId, String artistId, boolean isProducer) {
|
||||
this.albumId = albumId;
|
||||
this.artistId = artistId;
|
||||
this.isProducer = isProducer;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAlbumId() {
|
||||
return albumId;
|
||||
}
|
||||
|
||||
public void setAlbumId(String albumId) {
|
||||
this.albumId = albumId;
|
||||
}
|
||||
|
||||
public String getArtistId() {
|
||||
return artistId;
|
||||
}
|
||||
|
||||
public void setArtistId(String artistId) {
|
||||
this.artistId = artistId;
|
||||
}
|
||||
|
||||
public boolean isProducer() {
|
||||
return isProducer;
|
||||
}
|
||||
|
||||
public void setProducer(boolean producer) {
|
||||
isProducer = producer;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.cappielloantonio.play.model;
|
|||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.Html;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
|
|
@ -10,11 +11,12 @@ import androidx.room.Ignore;
|
|||
import androidx.room.PrimaryKey;
|
||||
|
||||
import com.cappielloantonio.play.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.play.subsonic.models.ArtistWithAlbumsID3;
|
||||
import com.cappielloantonio.play.util.MappingUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity(tableName = "artist")
|
||||
public class Artist implements Parcelable {
|
||||
private static final String TAG = "Artist";
|
||||
|
||||
|
|
@ -33,11 +35,20 @@ public class Artist implements Parcelable {
|
|||
public Artist(ArtistID3 artistID3) {
|
||||
this.id = artistID3.getId();
|
||||
this.name = artistID3.getName();
|
||||
this.primary = artistID3.getCoverArtId() != null ? artistID3.getCoverArtId() : artistID3.getId();
|
||||
this.primary = artistID3.getCoverArtId();
|
||||
this.backdrop = artistID3.getCoverArtId();
|
||||
this.albumCount = artistID3.getAlbumCount();
|
||||
}
|
||||
|
||||
public Artist(ArtistWithAlbumsID3 artistWithAlbumsID3) {
|
||||
this.id = artistWithAlbumsID3.getId();
|
||||
this.name = artistWithAlbumsID3.getName();
|
||||
this.primary = artistWithAlbumsID3.getCoverArtId();
|
||||
this.backdrop = artistWithAlbumsID3.getCoverArtId();
|
||||
this.albumCount = artistWithAlbumsID3.getAlbumCount();
|
||||
this.albums = MappingUtil.mapAlbum(artistWithAlbumsID3.getAlbums());
|
||||
}
|
||||
|
||||
public Artist(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
|
@ -99,6 +110,14 @@ public class Artist implements Parcelable {
|
|||
this.albumCount = albumCount;
|
||||
}
|
||||
|
||||
public List<Album> getAlbums() {
|
||||
return albums;
|
||||
}
|
||||
|
||||
public void setAlbums(List<Album> albums) {
|
||||
this.albums = albums;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
package com.cappielloantonio.play.model;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity(tableName = "playlist_song_cross", primaryKeys = {"playlist_id","song_id"})
|
||||
public class PlaylistSongCross {
|
||||
@NonNull
|
||||
@ColumnInfo(name = "playlist_id")
|
||||
private String playlistId;
|
||||
|
||||
@NonNull
|
||||
@ColumnInfo(name = "song_id")
|
||||
private String songId;
|
||||
|
||||
@ColumnInfo(name = "item_number")
|
||||
private int itemNumber;
|
||||
|
||||
public PlaylistSongCross(String playlistId, String songId, int itemNumber) {
|
||||
this.playlistId = playlistId;
|
||||
this.songId = songId;
|
||||
this.itemNumber = itemNumber;
|
||||
}
|
||||
|
||||
public String getPlaylistId() {
|
||||
return playlistId;
|
||||
}
|
||||
|
||||
public void setPlaylistId(String playlistId) {
|
||||
this.playlistId = playlistId;
|
||||
}
|
||||
|
||||
public String getSongId() {
|
||||
return songId;
|
||||
}
|
||||
|
||||
public void setSongId(String songId) {
|
||||
this.songId = songId;
|
||||
}
|
||||
|
||||
public int getItemNumber() { return itemNumber; }
|
||||
|
||||
public void setItemNumber(int itemNumber) { this.itemNumber = itemNumber; }
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package com.cappielloantonio.play.model;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity(tableName = "song_artist_cross")
|
||||
public class SongArtistCross {
|
||||
@NonNull
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "id")
|
||||
private int id;
|
||||
|
||||
@ColumnInfo(name = "song_id")
|
||||
private String songId;
|
||||
|
||||
@ColumnInfo(name = "artist_id")
|
||||
private String artistId;
|
||||
|
||||
public SongArtistCross(String songId, String artistId) {
|
||||
this.songId = songId;
|
||||
this.artistId = artistId;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSongId() {
|
||||
return songId;
|
||||
}
|
||||
|
||||
public void setSongId(String songId) {
|
||||
this.songId = songId;
|
||||
}
|
||||
|
||||
public String getArtistId() {
|
||||
return artistId;
|
||||
}
|
||||
|
||||
public void setArtistId(String artistId) {
|
||||
this.artistId = artistId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
package com.cappielloantonio.play.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity(tableName = "song_genre_cross")
|
||||
public class SongGenreCross implements Parcelable {
|
||||
@NonNull
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "id")
|
||||
private int id;
|
||||
|
||||
@ColumnInfo(name = "song_id")
|
||||
private String songId;
|
||||
|
||||
@ColumnInfo(name = "genre_id")
|
||||
private String genreId;
|
||||
|
||||
public SongGenreCross(String songId, String genreId) {
|
||||
this.songId = songId;
|
||||
this.genreId = genreId;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSongId() {
|
||||
return songId;
|
||||
}
|
||||
|
||||
public void setSongId(String songId) {
|
||||
this.songId = songId;
|
||||
}
|
||||
|
||||
public String getGenreId() {
|
||||
return genreId;
|
||||
}
|
||||
|
||||
public void setGenreId(String genreId) {
|
||||
this.genreId = genreId;
|
||||
}
|
||||
|
||||
protected SongGenreCross(Parcel in) {
|
||||
id = in.readInt();
|
||||
songId = in.readString();
|
||||
genreId = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(id);
|
||||
dest.writeString(songId);
|
||||
dest.writeString(genreId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<SongGenreCross> CREATOR = new Creator<SongGenreCross>() {
|
||||
@Override
|
||||
public SongGenreCross createFromParcel(Parcel in) {
|
||||
return new SongGenreCross(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SongGenreCross[] newArray(int size) {
|
||||
return new SongGenreCross[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue