-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to parse SpotifyProfile info into object (#5)
* Added ability to parse SpotifyProfile info into object * Added parsing for top tracks and top artists
- Loading branch information
1 parent
72e565e
commit 16ebe09
Showing
15 changed files
with
560 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/src/main/java/com/t1r2340/spotifystats/models/api/Album.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.t1r2340.spotifystats.models.api; | ||
|
||
|
||
/** | ||
* Class holding album information | ||
*/ | ||
public class Album { | ||
|
||
/** The Spotify ID for the album */ | ||
private String id; | ||
/** The type of the album */ | ||
private String albumType; | ||
/** The images of the album */ | ||
private ImageObject[] images; | ||
/** The name of the album */ | ||
private String name; | ||
|
||
|
||
/** | ||
* Constructor for Album | ||
*/ | ||
public Album(String id, String albumType, ImageObject[] images, String name) { | ||
this.id = id; | ||
this.albumType = albumType; | ||
this.images = images; | ||
this.name = name; | ||
} | ||
|
||
/** | ||
* Gets the Spotify ID for the album | ||
* @return the Spotify ID for the album | ||
*/ | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* Gets the type of the album | ||
* @return the type of the album | ||
*/ | ||
public String getAlbumType() { | ||
return albumType; | ||
} | ||
|
||
/** | ||
* Gets the images of the album | ||
* @return the images of the album | ||
*/ | ||
public ImageObject[] getImages() { | ||
return images; | ||
} | ||
|
||
/** | ||
* Gets the name of the album | ||
* @return the name of the album | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/t1r2340/spotifystats/models/api/Artist.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.t1r2340.spotifystats.models.api; | ||
|
||
/** | ||
* Class holding artist information | ||
*/ | ||
public class Artist { | ||
|
||
/** The Spotify ID for the artist */ | ||
private String id; | ||
/** The name of the artist */ | ||
private String name; | ||
|
||
/** | ||
* Constructor for Artist | ||
*/ | ||
public Artist(String id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
/** | ||
* Gets the Spotify ID for the artist | ||
* @return the Spotify ID for the artist | ||
*/ | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* Gets the name of the artist | ||
* @return the name of the artist | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/t1r2340/spotifystats/models/api/ArtistObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.t1r2340.spotifystats.models.api; | ||
|
||
/** | ||
* Class holding more specific artist information | ||
*/ | ||
public class ArtistObject extends Artist { | ||
|
||
/** Genres of the artist */ | ||
private String[] genres; | ||
/** Images of the artist */ | ||
private ImageObject[] images; | ||
|
||
/** | ||
* Constructor for ArtistObject | ||
*/ | ||
public ArtistObject(String id, String name, String[] genres, ImageObject[] images) { | ||
super(id, name); | ||
this.genres = genres; | ||
this.images = images; | ||
} | ||
|
||
/** | ||
* Gets the genres of the artist | ||
* @return the genres of the artist | ||
*/ | ||
public String[] getGenres() { | ||
return genres; | ||
} | ||
|
||
/** | ||
* Gets the images of the artist | ||
* @return the images of the artist | ||
*/ | ||
public ImageObject[] getImages() { | ||
return images; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
app/src/main/java/com/t1r2340/spotifystats/models/api/ImageObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.t1r2340.spotifystats.models.api; | ||
|
||
import org.json.JSONObject; | ||
|
||
/** | ||
* Represents an image object. | ||
*/ | ||
public class ImageObject { | ||
/** | ||
* The height of the image in pixels. | ||
*/ | ||
private int height; | ||
/** | ||
* The width of the image in pixels. | ||
*/ | ||
private int width; | ||
/** | ||
* The URL of the image. | ||
*/ | ||
private String url; | ||
|
||
/** | ||
* Creates an image object from JSON. | ||
*/ | ||
public ImageObject(int height, int width, String url) { | ||
this.height = height; | ||
this.width = width; | ||
this.url = url; | ||
} | ||
|
||
/** | ||
* Gets the height of the image. | ||
* @return the height of the image | ||
*/ | ||
public int getHeight() { | ||
return height; | ||
} | ||
|
||
/** | ||
* Gets the width of the image. | ||
* @return the width of the image | ||
*/ | ||
public int getWidth() { | ||
return width; | ||
} | ||
|
||
/** | ||
* Gets the URL of the image. | ||
* @return the URL of the image | ||
*/ | ||
public String getUrl() { | ||
return url; | ||
} | ||
} |
Oops, something went wrong.