change application id for release

This commit is contained in:
dkanada 2020-05-09 04:43:09 +09:00
commit 9d08253655
159 changed files with 801 additions and 801 deletions

View file

@ -0,0 +1,142 @@
package com.dkanada.gramophone.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.dkanada.gramophone.App;
import org.jellyfin.apiclient.model.dto.BaseItemDto;
import org.jellyfin.apiclient.model.dto.ImageOptions;
import org.jellyfin.apiclient.model.entities.ImageType;
import java.util.ArrayList;
import java.util.List;
public class Album implements Parcelable {
public List<Song> songs;
public String id;
public String title;
public int year;
public String artistId;
public String artistName;
public String primary;
public Album(BaseItemDto itemDto) {
this.id = itemDto.getId();
this.title = itemDto.getName();
this.year = itemDto.getProductionYear() != null ? itemDto.getProductionYear() : 0;
if (itemDto.getAlbumArtists().size() != 0) {
this.artistId = itemDto.getAlbumArtists().get(0).getId();
this.artistName = itemDto.getAlbumArtists().get(0).getName();
} else if (itemDto.getArtistItems().size() != 0) {
this.artistId = itemDto.getArtistItems().get(0).getId();
this.artistName = itemDto.getArtistItems().get(0).getName();
}
this.primary = itemDto.getImageTags().containsKey(ImageType.Primary) ? id : null;
this.songs = new ArrayList<>();
}
public Album(Song song) {
this.id = song.albumId;
this.title = song.albumName;
this.year = song.year;
this.artistId = song.artistId;
this.artistName = song.artistName;
this.primary = song.primary;
}
public Album() {
this.songs = new ArrayList<>();
}
public String getId() {
return id;
}
public String getTitle() {
return title;
}
public String getArtistId() {
return artistId;
}
public String getArtistName() {
return artistName;
}
public int getYear() {
return year;
}
public int getSongCount() {
return songs.size();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Album album = (Album) o;
return id.equals(album.id);
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public String toString() {
return id;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(title);
dest.writeInt(year);
dest.writeString(artistId);
dest.writeString(artistName);
dest.writeString(primary);
}
protected Album(Parcel in) {
this.songs = new ArrayList<>();
this.id = in.readString();
this.title = in.readString();
this.year = in.readInt();
this.artistId = in.readString();
this.artistName = in.readString();
this.primary = in.readString();
}
public static final Creator<Album> CREATOR = new Creator<Album>() {
public Album createFromParcel(Parcel source) {
return new Album(source);
}
public Album[] newArray(int size) {
return new Album[size];
}
};
}

View file

@ -0,0 +1,129 @@
package com.dkanada.gramophone.model;
import android.os.Parcel;
import android.os.Parcelable;
import org.jellyfin.apiclient.model.dto.BaseItemDto;
import org.jellyfin.apiclient.model.dto.GenreDto;
import org.jellyfin.apiclient.model.entities.ImageType;
import java.util.ArrayList;
import java.util.List;
public class Artist implements Parcelable {
public List<Genre> genres;
public List<Album> albums;
public List<Song> songs;
public String id;
public String name;
public String primary;
public Artist(BaseItemDto itemDto) {
this.id = itemDto.getId();
this.name = itemDto.getName();
this.primary = itemDto.getImageTags().containsKey(ImageType.Primary) ? id : null;
this.genres = new ArrayList<>();
this.albums = new ArrayList<>();
this.songs = new ArrayList<>();
if (itemDto.getGenreItems() != null) {
for (GenreDto genre : itemDto.getGenreItems()) {
genres.add(new Genre(genre));
}
}
}
public Artist(Album album) {
this.id = album.artistId;
this.name = album.artistName;
}
public Artist(Song song) {
this.id = song.artistId;
this.name = song.artistName;
}
public Artist() {
this.albums = new ArrayList<>();
this.songs = new ArrayList<>();
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public int getSongCount() {
return songs.size();
}
public int getAlbumCount() {
return albums.size();
}
public List<Song> getSongs() {
return songs;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Artist artist = (Artist) o;
return id.equals(artist.getId());
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public String toString() {
return id;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(name);
dest.writeString(primary);
}
protected Artist(Parcel in) {
this.genres = new ArrayList<>();
this.albums = new ArrayList<>();
this.songs = new ArrayList<>();
this.id = in.readString();
this.name = in.readString();
this.primary = in.readString();
}
public static final Parcelable.Creator<Artist> CREATOR = new Parcelable.Creator<Artist>() {
@Override
public Artist createFromParcel(Parcel source) {
return new Artist(source);
}
@Override
public Artist[] newArray(int size) {
return new Artist[size];
}
};
}

View file

@ -0,0 +1,55 @@
package com.dkanada.gramophone.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.dkanada.gramophone.R;
public class CategoryInfo implements Parcelable {
public Category category;
public boolean visible;
public CategoryInfo(Category category, boolean visible) {
this.category = category;
this.visible = visible;
}
private CategoryInfo(Parcel source) {
category = (Category) source.readSerializable();
visible = source.readInt() == 1;
}
@Override
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeSerializable(category);
dest.writeInt(visible ? 1 : 0);
}
public static final Parcelable.Creator<CategoryInfo> CREATOR = new Parcelable.Creator<CategoryInfo>() {
public CategoryInfo createFromParcel(Parcel source) {
return new CategoryInfo(source);
}
public CategoryInfo[] newArray(int size) {
return new CategoryInfo[size];
}
};
public enum Category {
SONGS(R.string.songs),
ALBUMS(R.string.albums),
ARTISTS(R.string.artists),
GENRES(R.string.genres),
PLAYLISTS(R.string.playlists);
public final int stringRes;
Category(int stringRes) {
this.stringRes = stringRes;
}
}
}

View file

@ -0,0 +1,72 @@
package com.dkanada.gramophone.model;
import android.os.Parcel;
import android.os.Parcelable;
import org.jellyfin.apiclient.model.dto.BaseItemDto;
import org.jellyfin.apiclient.model.dto.GenreDto;
public class Genre implements Parcelable {
public final String id;
public final String name;
public final int songCount;
public Genre(GenreDto genreDto) {
this.id = genreDto.getId();
this.name = genreDto.getName();
this.songCount = 0;
}
public Genre(BaseItemDto itemDto) {
this.id = itemDto.getId();
this.name = itemDto.getName();
this.songCount = itemDto.getSongCount() != null ? itemDto.getSongCount() : 0;
}
@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();
}
@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];
}
};
}

View file

@ -0,0 +1,71 @@
package com.dkanada.gramophone.model;
import android.os.Parcel;
import android.os.Parcelable;
import org.jellyfin.apiclient.model.dto.BaseItemDto;
public class Playlist implements Parcelable {
public final String id;
public final String name;
public Playlist(BaseItemDto itemDto) {
this.id = itemDto.getId();
this.name = itemDto.getName();
}
public Playlist(final int id, final String name) {
this.id = Integer.toString(id);
this.name = name;
}
public Playlist() {
this.id = "";
this.name = "";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Playlist playlist = (Playlist) o;
return id.equals(playlist.id);
}
@Override
public int hashCode() {
return id.hashCode();
}
@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);
}
protected Playlist(Parcel in) {
this.id = in.readString();
this.name = in.readString();
}
public static final Creator<Playlist> CREATOR = new Creator<Playlist>() {
public Playlist createFromParcel(Parcel source) {
return new Playlist(source);
}
public Playlist[] newArray(int size) {
return new Playlist[size];
}
};
}

View file

@ -0,0 +1,42 @@
package com.dkanada.gramophone.model;
import android.os.Parcel;
import org.jellyfin.apiclient.model.dto.BaseItemDto;
public class PlaylistSong extends Song {
public final String playlistId;
public final String indexId;
public PlaylistSong(BaseItemDto itemDto, String playlist) {
super(itemDto);
this.playlistId = playlist;
this.indexId = itemDto.getPlaylistItemId();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeString(this.playlistId);
dest.writeString(this.indexId);
}
protected PlaylistSong(Parcel in) {
super(in);
this.playlistId = in.readString();
this.indexId = in.readString();
}
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];
}
};
}

View file

@ -0,0 +1,133 @@
package com.dkanada.gramophone.model;
import android.os.Parcel;
import android.os.Parcelable;
import org.jellyfin.apiclient.model.dto.BaseItemDto;
public class Song implements Parcelable {
public static final Song EMPTY_SONG = new Song(null, "", -1, -1, -1, null, "", null, "", null, false);
public final String id;
public final String title;
public final int trackNumber;
public final int year;
public final long duration;
public final String albumId;
public final String albumName;
public String artistId;
public String artistName;
public String primary;
public boolean favorite;
public Song(BaseItemDto itemDto) {
this.id = itemDto.getId();
this.title = itemDto.getName();
this.trackNumber = itemDto.getIndexNumber() != null ? itemDto.getIndexNumber() : 0;
this.year = itemDto.getProductionYear() != null ? itemDto.getProductionYear() : 0;
this.duration = itemDto.getRunTimeTicks() != null ? itemDto.getRunTimeTicks() / 10000 : 0;
this.albumId = itemDto.getAlbumId();
this.albumName = itemDto.getAlbum();
if (itemDto.getAlbumArtists().size() != 0) {
this.artistId = itemDto.getAlbumArtists().get(0).getId();
this.artistName = itemDto.getAlbumArtists().get(0).getName();
} else if (itemDto.getArtistItems().size() != 0) {
this.artistId = itemDto.getArtistItems().get(0).getId();
this.artistName = itemDto.getArtistItems().get(0).getName();
}
this.primary = itemDto.getAlbumPrimaryImageTag() != null ? albumId : null;
this.favorite = itemDto.getUserData() != null && itemDto.getUserData().getIsFavorite();
}
public Song(String id, String title, int trackNumber, int year, long duration, String albumId, String albumName, String artistId, String artistName, String primary, boolean favorite) {
this.id = id;
this.title = title;
this.trackNumber = trackNumber;
this.year = year;
this.duration = duration;
this.albumId = albumId;
this.albumName = albumName;
this.artistId = artistId;
this.artistName = artistName;
this.primary = primary;
this.favorite = favorite;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Song song = (Song) o;
return id.equals(song.id);
}
@Override
public int hashCode() {
return id.hashCode();
}
@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.title);
dest.writeInt(this.trackNumber);
dest.writeInt(this.year);
dest.writeLong(this.duration);
dest.writeString(this.albumId);
dest.writeString(this.albumName);
dest.writeString(this.artistId);
dest.writeString(this.artistName);
dest.writeString(this.primary);
dest.writeString(Boolean.toString(favorite));
}
protected Song(Parcel in) {
this.id = in.readString();
this.title = in.readString();
this.trackNumber = in.readInt();
this.year = in.readInt();
this.duration = in.readLong();
this.albumId = in.readString();
this.albumName = in.readString();
this.artistId = in.readString();
this.artistName = in.readString();
this.primary = in.readString();
this.favorite = Boolean.valueOf(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];
}
};
}