Added new dark icon
This commit is contained in:
parent
0456914e2a
commit
9ea7735261
68 changed files with 306 additions and 249 deletions
|
@ -36,6 +36,6 @@ class Album {
|
|||
}
|
||||
|
||||
fun safeGetFirstSong(): Song {
|
||||
return if (songs!!.isEmpty()) Song.emptySong else songs[0]
|
||||
return if (songs!!.isEmpty()) Song.EMPTY_SONG else songs[0]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
package code.name.monkey.retromusic.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class PlaylistSong extends Song {
|
||||
public static final Parcelable.Creator<PlaylistSong> CREATOR = new Parcelable.Creator<PlaylistSong>() {
|
||||
public PlaylistSong createFromParcel(Parcel source) {
|
||||
return new PlaylistSong(source);
|
||||
}
|
||||
public static PlaylistSong EMPTY_PLAYLIST_SONG = new PlaylistSong(-1, "", -1, -1, -1, "", -1, -1, "", -1, "", -1, -1);
|
||||
|
||||
public PlaylistSong[] newArray(int size) {
|
||||
return new PlaylistSong[size];
|
||||
}
|
||||
};
|
||||
public final int playlistId;
|
||||
public final int idInPlayList;
|
||||
|
||||
|
@ -22,12 +14,6 @@ public class PlaylistSong extends Song {
|
|||
this.idInPlayList = idInPlayList;
|
||||
}
|
||||
|
||||
protected PlaylistSong(Parcel in) {
|
||||
super(in);
|
||||
this.playlistId = in.readInt();
|
||||
this.idInPlayList = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
@ -58,6 +44,7 @@ public class PlaylistSong extends Song {
|
|||
'}';
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
@ -69,4 +56,20 @@ public class PlaylistSong extends Song {
|
|||
dest.writeInt(this.playlistId);
|
||||
dest.writeInt(this.idInPlayList);
|
||||
}
|
||||
|
||||
protected PlaylistSong(Parcel in) {
|
||||
super(in);
|
||||
this.playlistId = in.readInt();
|
||||
this.idInPlayList = in.readInt();
|
||||
}
|
||||
|
||||
public static final Creator<PlaylistSong> CREATOR = new Creator<PlaylistSong>() {
|
||||
public PlaylistSong createFromParcel(Parcel source) {
|
||||
return new PlaylistSong(source);
|
||||
}
|
||||
|
||||
public PlaylistSong[] newArray(int size) {
|
||||
return new PlaylistSong[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
137
app/src/main/java/code/name/monkey/retromusic/model/Song.java
Normal file
137
app/src/main/java/code/name/monkey/retromusic/model/Song.java
Normal file
|
@ -0,0 +1,137 @@
|
|||
package code.name.monkey.retromusic.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class Song implements Parcelable {
|
||||
public static final Song EMPTY_SONG = new Song(-1, "", -1, -1, -1, "", -1, -1, "", -1, "");
|
||||
|
||||
public final int id;
|
||||
public final String title;
|
||||
public final int trackNumber;
|
||||
public final int year;
|
||||
public final long duration;
|
||||
public final String data;
|
||||
public final long dateModified;
|
||||
public final int albumId;
|
||||
public final String albumName;
|
||||
public final int artistId;
|
||||
public final String artistName;
|
||||
|
||||
public Song(int id, String title, int trackNumber, int year, long duration, String data, long dateModified, int albumId, String albumName, int artistId, String artistName) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.trackNumber = trackNumber;
|
||||
this.year = year;
|
||||
this.duration = duration;
|
||||
this.data = data;
|
||||
this.dateModified = dateModified;
|
||||
this.albumId = albumId;
|
||||
this.albumName = albumName;
|
||||
this.artistId = artistId;
|
||||
this.artistName = artistName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Song song = (Song) o;
|
||||
|
||||
if (id != song.id) return false;
|
||||
if (trackNumber != song.trackNumber) return false;
|
||||
if (year != song.year) return false;
|
||||
if (duration != song.duration) return false;
|
||||
if (dateModified != song.dateModified) return false;
|
||||
if (albumId != song.albumId) return false;
|
||||
if (artistId != song.artistId) return false;
|
||||
if (title != null ? !title.equals(song.title) : song.title != null) return false;
|
||||
if (data != null ? !data.equals(song.data) : song.data != null) return false;
|
||||
if (albumName != null ? !albumName.equals(song.albumName) : song.albumName != null)
|
||||
return false;
|
||||
return artistName != null ? artistName.equals(song.artistName) : song.artistName == null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id;
|
||||
result = 31 * result + (title != null ? title.hashCode() : 0);
|
||||
result = 31 * result + trackNumber;
|
||||
result = 31 * result + year;
|
||||
result = 31 * result + (int) (duration ^ (duration >>> 32));
|
||||
result = 31 * result + (data != null ? data.hashCode() : 0);
|
||||
result = 31 * result + (int) (dateModified ^ (dateModified >>> 32));
|
||||
result = 31 * result + albumId;
|
||||
result = 31 * result + (albumName != null ? albumName.hashCode() : 0);
|
||||
result = 31 * result + artistId;
|
||||
result = 31 * result + (artistName != null ? artistName.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Song{" +
|
||||
"id=" + id +
|
||||
", title='" + title + '\'' +
|
||||
", trackNumber=" + trackNumber +
|
||||
", year=" + year +
|
||||
", duration=" + duration +
|
||||
", data='" + data + '\'' +
|
||||
", dateModified=" + dateModified +
|
||||
", albumId=" + albumId +
|
||||
", albumName='" + albumName + '\'' +
|
||||
", artistId=" + artistId +
|
||||
", artistName='" + artistName + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(this.id);
|
||||
dest.writeString(this.title);
|
||||
dest.writeInt(this.trackNumber);
|
||||
dest.writeInt(this.year);
|
||||
dest.writeLong(this.duration);
|
||||
dest.writeString(this.data);
|
||||
dest.writeLong(this.dateModified);
|
||||
dest.writeInt(this.albumId);
|
||||
dest.writeString(this.albumName);
|
||||
dest.writeInt(this.artistId);
|
||||
dest.writeString(this.artistName);
|
||||
}
|
||||
|
||||
protected Song(Parcel in) {
|
||||
this.id = in.readInt();
|
||||
this.title = in.readString();
|
||||
this.trackNumber = in.readInt();
|
||||
this.year = in.readInt();
|
||||
this.duration = in.readLong();
|
||||
this.data = in.readString();
|
||||
this.dateModified = in.readLong();
|
||||
this.albumId = in.readInt();
|
||||
this.albumName = in.readString();
|
||||
this.artistId = in.readInt();
|
||||
this.artistName = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<Song> CREATOR = new Creator<Song>() {
|
||||
public Song createFromParcel(Parcel source) {
|
||||
return new Song(source);
|
||||
}
|
||||
|
||||
public Song[] newArray(int size) {
|
||||
return new Song[size];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
package code.name.monkey.retromusic.model
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
|
||||
|
||||
open class Song : Parcelable {
|
||||
val id: Int
|
||||
val title: String?
|
||||
val trackNumber: Int
|
||||
val year: Int
|
||||
val duration: Long
|
||||
val data: String?
|
||||
val dateModified: Long
|
||||
val albumId: Int
|
||||
val albumName: String?
|
||||
val artistId: Int
|
||||
val artistName: String?
|
||||
|
||||
constructor(id: Int, title: String, trackNumber: Int, year: Int, duration: Long, data: String, dateModified: Long, albumId: Int, albumName: String, artistId: Int, artistName: String) {
|
||||
this.id = id
|
||||
this.title = title
|
||||
this.trackNumber = trackNumber
|
||||
this.year = year
|
||||
this.duration = duration
|
||||
this.data = data
|
||||
this.dateModified = dateModified
|
||||
this.albumId = albumId
|
||||
this.albumName = albumName
|
||||
this.artistId = artistId
|
||||
this.artistName = artistName
|
||||
}
|
||||
|
||||
protected constructor(`in`: Parcel) {
|
||||
this.id = `in`.readInt()
|
||||
this.title = `in`.readString()
|
||||
this.trackNumber = `in`.readInt()
|
||||
this.year = `in`.readInt()
|
||||
this.duration = `in`.readLong()
|
||||
this.data = `in`.readString()
|
||||
this.dateModified = `in`.readLong()
|
||||
this.albumId = `in`.readInt()
|
||||
this.albumName = `in`.readString()
|
||||
this.artistId = `in`.readInt()
|
||||
this.artistName = `in`.readString()
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun writeToParcel(dest: Parcel, flags: Int) {
|
||||
dest.writeInt(this.id)
|
||||
dest.writeString(this.title)
|
||||
dest.writeInt(this.trackNumber)
|
||||
dest.writeInt(this.year)
|
||||
dest.writeLong(this.duration)
|
||||
dest.writeString(this.data)
|
||||
dest.writeLong(this.dateModified)
|
||||
dest.writeInt(this.albumId)
|
||||
dest.writeString(this.albumName)
|
||||
dest.writeInt(this.artistId)
|
||||
dest.writeString(this.artistName)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
var emptySong = Song(-1, "", -1, -1, -1, "", -1, -1, "", -1, "")
|
||||
|
||||
@JvmField
|
||||
val CREATOR: Parcelable.Creator<Song> = object : Parcelable.Creator<Song> {
|
||||
override fun createFromParcel(source: Parcel): Song {
|
||||
return Song(source)
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Song> {
|
||||
return emptyArray()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue