mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Implemented download service
This commit is contained in:
parent
f09d3b774d
commit
0e41cc20bd
9 changed files with 332 additions and 10 deletions
121
app/src/main/java/com/cappielloantonio/play/model/Download.java
Normal file
121
app/src/main/java/com/cappielloantonio/play/model/Download.java
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
package com.cappielloantonio.play.model;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity(tableName = "download")
|
||||
public class Download {
|
||||
@NonNull
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "id")
|
||||
private String songID;
|
||||
|
||||
@ColumnInfo(name = "title")
|
||||
private String title;
|
||||
|
||||
@ColumnInfo(name = "albumId")
|
||||
private String albumId;
|
||||
|
||||
@ColumnInfo(name = "albumName")
|
||||
private String albumName;
|
||||
|
||||
@ColumnInfo(name = "artistId")
|
||||
private String artistId;
|
||||
|
||||
@ColumnInfo(name = "artistName")
|
||||
private String artistName;
|
||||
|
||||
@ColumnInfo(name = "primary")
|
||||
private String primary;
|
||||
|
||||
@ColumnInfo(name = "duration")
|
||||
private long duration;
|
||||
|
||||
public Download(String songID, String title, String albumId, String albumName, String artistId, String artistName, String primary, long duration) {
|
||||
this.songID = songID;
|
||||
this.title = title;
|
||||
this.albumId = albumId;
|
||||
this.albumName = albumName;
|
||||
this.artistId = artistId;
|
||||
this.artistName = artistName;
|
||||
this.primary = primary;
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Download(Song song) {
|
||||
this.songID = song.getId();
|
||||
this.title = song.getTitle();
|
||||
this.albumId = song.getAlbumId();
|
||||
this.albumName = song.getAlbumName();
|
||||
this.artistId = song.getArtistId();
|
||||
this.artistName = song.getArtistName();
|
||||
this.primary = song.getPrimary();
|
||||
this.duration = song.getDuration();
|
||||
}
|
||||
|
||||
public String getSongID() {
|
||||
return songID;
|
||||
}
|
||||
|
||||
public void setSongID(String songID) {
|
||||
this.songID = songID;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getAlbumId() {
|
||||
return albumId;
|
||||
}
|
||||
|
||||
public void setAlbumId(String albumId) {
|
||||
this.albumId = albumId;
|
||||
}
|
||||
|
||||
public String getAlbumName() {
|
||||
return albumName;
|
||||
}
|
||||
|
||||
public void setAlbumName(String albumName) {
|
||||
this.albumName = albumName;
|
||||
}
|
||||
|
||||
public String getArtistId() {
|
||||
return artistId;
|
||||
}
|
||||
|
||||
public void setArtistId(String artistId) {
|
||||
this.artistId = artistId;
|
||||
}
|
||||
|
||||
public String getArtistName() {
|
||||
return artistName;
|
||||
}
|
||||
|
||||
public void setArtistName(String artistName) {
|
||||
this.artistName = artistName;
|
||||
}
|
||||
|
||||
public String getPrimary() {
|
||||
return primary;
|
||||
}
|
||||
|
||||
public void setPrimary(String primary) {
|
||||
this.primary = primary;
|
||||
}
|
||||
|
||||
public long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(long duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
}
|
||||
|
|
@ -89,6 +89,17 @@ public class Song implements Parcelable {
|
|||
this.duration = queue.getDuration();
|
||||
}
|
||||
|
||||
public Song(Download download) {
|
||||
this.id = download.getSongID();
|
||||
this.title = download.getTitle();
|
||||
this.albumId = download.getAlbumId();
|
||||
this.albumName = download.getAlbumName();
|
||||
this.artistId = download.getArtistId();
|
||||
this.artistName = download.getArtistName();
|
||||
this.primary = download.getPrimary();
|
||||
this.duration = download.getDuration();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue