Skip to content

Commit

Permalink
Added Spotify ID to ArtistModel
Browse files Browse the repository at this point in the history
  • Loading branch information
williamwong committed Jun 19, 2015
1 parent 4e08908 commit df061e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private void updateArtists(ArtistsPager artistsPager) {
for (Artist artist : artistsPager.artists.items) {
ArtistModel artistModel = new ArtistModel();
artistModel.setName(artist.name);
artistModel.setSpotifyId(artist.id);

List<Image> images = artist.images;
if(images != null && !images.isEmpty()) {
Expand Down Expand Up @@ -143,4 +144,8 @@ public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelableArrayList(ARTIST_MODELS_KEY, mArtistModels);
}

public interface Callbacks {
void onArtistSelected(String id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class ArtistModel implements Parcelable {

private String name;
private String imageUrl;
private String spotifyId;

public String getName() {
return name;
Expand All @@ -27,6 +28,17 @@ public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}

public String getSpotifyId() {
return spotifyId;
}

public void setSpotifyId(String spotifyId) {
this.spotifyId = spotifyId;
}

public ArtistModel() {
}

@Override
public int describeContents() {
return 0;
Expand All @@ -36,17 +48,16 @@ public int describeContents() {
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.name);
dest.writeString(this.imageUrl);
}

public ArtistModel() {
dest.writeString(this.spotifyId);
}

protected ArtistModel(Parcel in) {
this.name = in.readString();
this.imageUrl = in.readString();
this.spotifyId = in.readString();
}

public static final Parcelable.Creator<ArtistModel> CREATOR = new Parcelable.Creator<ArtistModel>() {
public static final Creator<ArtistModel> CREATOR = new Creator<ArtistModel>() {
public ArtistModel createFromParcel(Parcel source) {
return new ArtistModel(source);
}
Expand Down

0 comments on commit df061e0

Please sign in to comment.