tempus/app/src/main/java/com/cappielloantonio/play/model/Genre.java

81 lines
1.8 KiB
Java
Raw Normal View History

2020-11-20 15:38:08 +01:00
package com.cappielloantonio.play.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
public class Genre implements Parcelable {
private String id;
private String name;
private int songCount;
private int albumCount;
2020-11-20 15:38:08 +01:00
2021-07-31 18:43:40 +02:00
public Genre(com.cappielloantonio.play.subsonic.models.Genre genre) {
this.id = genre.getGenre();
this.name = genre.getGenre();
this.songCount = genre.getSongCount();
this.albumCount = genre.getAlbumCount();
2020-11-20 15:38:08 +01:00
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public int getSongCount() {
return songCount;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Genre genre = (Genre) o;
return id.equals(genre.id);
}
@Override
public int hashCode() {
return id.hashCode();
}
@NonNull
@Override
public String toString() {
return id;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.id);
dest.writeString(this.name);
dest.writeInt(this.songCount);
}
protected Genre(Parcel in) {
this.id = in.readString();
this.name = in.readString();
this.songCount = in.readInt();
}
public static final Creator<Genre> CREATOR = new Creator<Genre>() {
public Genre createFromParcel(Parcel source) {
return new Genre(source);
}
public Genre[] newArray(int size) {
return new Genre[size];
}
};
}