diff --git a/app/src/main/java/com/kabouzeid/gramophone/adapter/ArtistAdapter.java b/app/src/main/java/com/kabouzeid/gramophone/adapter/ArtistAdapter.java index db055c9b..c214585a 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/adapter/ArtistAdapter.java +++ b/app/src/main/java/com/kabouzeid/gramophone/adapter/ArtistAdapter.java @@ -72,6 +72,10 @@ public class ArtistAdapter extends AbsMultiSelectAdapter() { @Override public void success(ArtistInfo artistInfo, Response response) { @@ -88,24 +92,23 @@ public class ArtistAdapter extends AbsMultiSelectAdapter() { @Override public void success(ArtistInfo artistInfo, Response response) { @@ -140,21 +144,18 @@ public class SearchAdapter extends RecyclerView.Adapter tag = new ArrayList(); - - /** - * @return The tag - */ - public List getTag() { - return tag; - } - - /** - * @param tag The tag - */ - public void setTag(List tag) { - this.tag = tag; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/albuminfo/Track.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/albuminfo/Track.java deleted file mode 100644 index 27f53529..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/albuminfo/Track.java +++ /dev/null @@ -1,123 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.albuminfo; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -public class Track { - - @Expose - private String name; - @Expose - private String duration; - @Expose - private String mbid; - @Expose - private String url; - @Expose - private Streamable streamable; - @Expose - private Artist artist; - @SerializedName("@attr") - @Expose - private com.kabouzeid.gramophone.lastfm.rest.model.albuminfo.Attr Attr; - - /** - * @return The name - */ - public String getName() { - return name; - } - - /** - * @param name The name - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return The duration - */ - public String getDuration() { - return duration; - } - - /** - * @param duration The duration - */ - public void setDuration(String duration) { - this.duration = duration; - } - - /** - * @return The mbid - */ - public String getMbid() { - return mbid; - } - - /** - * @param mbid The mbid - */ - public void setMbid(String mbid) { - this.mbid = mbid; - } - - /** - * @return The url - */ - public String getUrl() { - return url; - } - - /** - * @param url The url - */ - public void setUrl(String url) { - this.url = url; - } - - /** - * @return The streamable - */ - public Streamable getStreamable() { - return streamable; - } - - /** - * @param streamable The streamable - */ - public void setStreamable(Streamable streamable) { - this.streamable = streamable; - } - - /** - * @return The artist - */ - public Artist getArtist() { - return artist; - } - - /** - * @param artist The artist - */ - public void setArtist(Artist artist) { - this.artist = artist; - } - - /** - * @return The Attr - */ - public com.kabouzeid.gramophone.lastfm.rest.model.albuminfo.Attr getAttr() { - return Attr; - } - - /** - * @param Attr The @attr - */ - public void setAttr(com.kabouzeid.gramophone.lastfm.rest.model.albuminfo.Attr Attr) { - this.Attr = Attr; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/albuminfo/Tracks.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/albuminfo/Tracks.java deleted file mode 100644 index 6e9ecbe5..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/albuminfo/Tracks.java +++ /dev/null @@ -1,28 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.albuminfo; - -import com.google.gson.annotations.Expose; - -import java.util.ArrayList; -import java.util.List; - -public class Tracks { - - @Expose - private List track = new ArrayList(); - - /** - * @return The track - */ - public List getTrack() { - return track; - } - - /** - * @param track The track - */ - public void setTrack(List track) { - this.track = track; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Artist.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Artist.java index 7b4eb6bf..692d75b5 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Artist.java +++ b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Artist.java @@ -17,16 +17,10 @@ public class Artist { @Expose private List image = new ArrayList(); @Expose - private String streamable; - @Expose private String ontour; @Expose private Stats stats; @Expose - private Similar similar; - @Expose - private Tags tags; - @Expose private Bio bio; /** @@ -85,20 +79,6 @@ public class Artist { this.image = image; } - /** - * @return The streamable - */ - public String getStreamable() { - return streamable; - } - - /** - * @param streamable The streamable - */ - public void setStreamable(String streamable) { - this.streamable = streamable; - } - /** * @return The ontour */ @@ -127,34 +107,6 @@ public class Artist { this.stats = stats; } - /** - * @return The similar - */ - public Similar getSimilar() { - return similar; - } - - /** - * @param similar The similar - */ - public void setSimilar(Similar similar) { - this.similar = similar; - } - - /** - * @return The tags - */ - public Tags getTags() { - return tags; - } - - /** - * @param tags The tags - */ - public void setTags(Tags tags) { - this.tags = tags; - } - /** * @return The bio */ diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Artist_.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Artist_.java deleted file mode 100644 index 9ce2676a..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Artist_.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.artistinfo; - -import com.google.gson.annotations.Expose; - -import java.util.ArrayList; -import java.util.List; - -public class Artist_ { - - @Expose - private String name; - @Expose - private String url; - @Expose - private List image = new ArrayList(); - - /** - * @return The name - */ - public String getName() { - return name; - } - - /** - * @param name The name - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return The url - */ - public String getUrl() { - return url; - } - - /** - * @param url The url - */ - public void setUrl(String url) { - this.url = url; - } - - /** - * @return The image - */ - public List getImage() { - return image; - } - - /** - * @param image The image - */ - public void setImage(List image) { - this.image = image; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Bio.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Bio.java index 7c9c4caa..54d51eec 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Bio.java +++ b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Bio.java @@ -5,8 +5,6 @@ import com.google.gson.annotations.Expose; public class Bio { - @Expose - private Links links; @Expose private String published; @Expose @@ -14,23 +12,9 @@ public class Bio { @Expose private String content; @Expose - private String yearformed; + private String placeformed; @Expose - private Formationlist formationlist; - - /** - * @return The links - */ - public Links getLinks() { - return links; - } - - /** - * @param links The links - */ - public void setLinks(Links links) { - this.links = links; - } + private String yearformed; /** * @return The published @@ -74,6 +58,20 @@ public class Bio { this.content = content; } + /** + * @return The placeformed + */ + public String getPlaceformed() { + return placeformed; + } + + /** + * @param placeformed The placeformed + */ + public void setPlaceformed(String placeformed) { + this.placeformed = placeformed; + } + /** * @return The yearformed */ @@ -88,18 +86,4 @@ public class Bio { this.yearformed = yearformed; } - /** - * @return The formationlist - */ - public Formationlist getFormationlist() { - return formationlist; - } - - /** - * @param formationlist The formationlist - */ - public void setFormationlist(Formationlist formationlist) { - this.formationlist = formationlist; - } - } diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Formation.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Formation.java deleted file mode 100644 index e3720767..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Formation.java +++ /dev/null @@ -1,41 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.artistinfo; - -import com.google.gson.annotations.Expose; - -public class Formation { - - @Expose - private String yearfrom; - @Expose - private String yearto; - - /** - * @return The yearfrom - */ - public String getYearfrom() { - return yearfrom; - } - - /** - * @param yearfrom The yearfrom - */ - public void setYearfrom(String yearfrom) { - this.yearfrom = yearfrom; - } - - /** - * @return The yearto - */ - public String getYearto() { - return yearto; - } - - /** - * @param yearto The yearto - */ - public void setYearto(String yearto) { - this.yearto = yearto; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Formationlist.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Formationlist.java deleted file mode 100644 index ebc28369..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Formationlist.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.artistinfo; - -import com.google.gson.annotations.Expose; - -public class Formationlist { - - @Expose - private Formation formation; - - /** - * @return The formation - */ - public Formation getFormation() { - return formation; - } - - /** - * @param formation The formation - */ - public void setFormation(Formation formation) { - this.formation = formation; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Image_.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Image_.java deleted file mode 100644 index 4972461d..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Image_.java +++ /dev/null @@ -1,43 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.artistinfo; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -public class Image_ { - - @SerializedName("#text") - @Expose - private String Text; - @Expose - private String size; - - /** - * @return The Text - */ - public String getText() { - return Text; - } - - /** - * @param Text The #text - */ - public void setText(String Text) { - this.Text = Text; - } - - /** - * @return The size - */ - public String getSize() { - return size; - } - - /** - * @param size The size - */ - public void setSize(String size) { - this.size = size; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Link.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Link.java deleted file mode 100644 index 1cc1e58d..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Link.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.artistinfo; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; - -public class Link { - - @SerializedName("#text") - @Expose - private String Text; - @Expose - private String rel; - @Expose - private String href; - - /** - * @return The Text - */ - public String getText() { - return Text; - } - - /** - * @param Text The #text - */ - public void setText(String Text) { - this.Text = Text; - } - - /** - * @return The rel - */ - public String getRel() { - return rel; - } - - /** - * @param rel The rel - */ - public void setRel(String rel) { - this.rel = rel; - } - - /** - * @return The href - */ - public String getHref() { - return href; - } - - /** - * @param href The href - */ - public void setHref(String href) { - this.href = href; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Links.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Links.java deleted file mode 100644 index a412b3dc..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Links.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.artistinfo; - -import com.google.gson.annotations.Expose; - -public class Links { - - @Expose - private Link link; - - /** - * @return The link - */ - public Link getLink() { - return link; - } - - /** - * @param link The link - */ - public void setLink(Link link) { - this.link = link; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Similar.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Similar.java deleted file mode 100644 index 3cd5083f..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Similar.java +++ /dev/null @@ -1,28 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.artistinfo; - -import com.google.gson.annotations.Expose; - -import java.util.ArrayList; -import java.util.List; - -public class Similar { - - @Expose - private List artist = new ArrayList(); - - /** - * @return The artist - */ - public List getArtist() { - return artist; - } - - /** - * @param artist The artist - */ - public void setArtist(List artist) { - this.artist = artist; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Tag.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Tag.java deleted file mode 100644 index 97e30274..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Tag.java +++ /dev/null @@ -1,41 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.artistinfo; - -import com.google.gson.annotations.Expose; - -public class Tag { - - @Expose - private String name; - @Expose - private String url; - - /** - * @return The name - */ - public String getName() { - return name; - } - - /** - * @param name The name - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return The url - */ - public String getUrl() { - return url; - } - - /** - * @param url The url - */ - public void setUrl(String url) { - this.url = url; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Tags.java b/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Tags.java deleted file mode 100644 index b145e344..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/lastfm/rest/model/artistinfo/Tags.java +++ /dev/null @@ -1,28 +0,0 @@ - -package com.kabouzeid.gramophone.lastfm.rest.model.artistinfo; - -import com.google.gson.annotations.Expose; - -import java.util.ArrayList; -import java.util.List; - -public class Tags { - - @Expose - private List tag = new ArrayList(); - - /** - * @return The tag - */ - public List getTag() { - return tag; - } - - /** - * @param tag The tag - */ - public void setTag(List tag) { - this.tag = tag; - } - -} diff --git a/app/src/main/java/com/kabouzeid/gramophone/ui/activities/ArtistDetailActivity.java b/app/src/main/java/com/kabouzeid/gramophone/ui/activities/ArtistDetailActivity.java index 4f6ed337..cae01b4d 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/ui/activities/ArtistDetailActivity.java +++ b/app/src/main/java/com/kabouzeid/gramophone/ui/activities/ArtistDetailActivity.java @@ -51,6 +51,7 @@ import com.kabouzeid.gramophone.model.DataBaseChangedEvent; import com.kabouzeid.gramophone.model.Song; import com.kabouzeid.gramophone.model.UIPreferenceChangedEvent; import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity; +import com.kabouzeid.gramophone.util.MusicUtil; import com.kabouzeid.gramophone.util.NavigationUtil; import com.kabouzeid.gramophone.util.PreferenceUtils; import com.kabouzeid.gramophone.util.Util; @@ -67,7 +68,6 @@ import java.util.List; import butterknife.ButterKnife; import butterknife.InjectView; -import hugo.weaving.DebugLog; import retrofit.Callback; import retrofit.RetrofitError; import retrofit.client.Response; @@ -276,12 +276,14 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor lastFMRestClient.getApiService().getArtistInfo(artist.name, null, new Callback() { @Override public void success(ArtistInfo artistInfo, Response response) { - String bio = artistInfo.getArtist().getBio().getContent(); - if (bio != null && !bio.trim().equals("")) { - biography = Html.fromHtml(bio); - } else { - biography = null; + if (artistInfo.getArtist() != null) { + String bio = artistInfo.getArtist().getBio().getContent(); + if (bio != null && !bio.trim().equals("")) { + biography = Html.fromHtml(bio); + return; + } } + biography = null; } @Override @@ -305,8 +307,12 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor if (defaultArtistImageBlurManager == null) { defaultArtistImageBlurManager = new StackBlurManager(BitmapFactory.decodeResource(getResources(), R.drawable.default_artist_image, options)); } + if (MusicUtil.isArtistNameUnknown(artist.name)) { + artistImage.setImageResource(R.drawable.default_artist_image); + resetPaletteAndArtistImageBackground(); + return; + } lastFMRestClient.getApiService().getArtistInfo(artist.name, forceDownload ? "no-cache" : null, new Callback() { - @DebugLog @Override public void success(ArtistInfo artistInfo, Response response) { if (artistInfo.getArtist() != null) { @@ -318,21 +324,24 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor .cacheInMemory(true) .cacheOnDisk(true) .showImageOnFail(R.drawable.default_artist_image) + .showImageForEmptyUri(R.drawable.default_artist_image) .resetViewBeforeLoading(true) .build(), new SimpleImageLoadingListener() { - @DebugLog @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { resetPaletteAndArtistImageBackground(); toastUpdatedArtistImageIfDownloadWasForced(); } - @DebugLog @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { - applyPalette(loadedImage); - artistImageBackground.setImageBitmap(new StackBlurManager(loadedImage).process(10)); + if (loadedImage != null) { + applyPalette(loadedImage); + artistImageBackground.setImageBitmap(new StackBlurManager(loadedImage).process(10)); + } else { + resetPaletteAndArtistImageBackground(); + } toastUpdatedArtistImageIfDownloadWasForced(); } @@ -346,7 +355,6 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor } } - @DebugLog @Override public void failure(RetrofitError error) { if (forceDownload) { diff --git a/app/src/main/java/com/kabouzeid/gramophone/util/MusicUtil.java b/app/src/main/java/com/kabouzeid/gramophone/util/MusicUtil.java index 86f340f9..7b85bf7a 100644 --- a/app/src/main/java/com/kabouzeid/gramophone/util/MusicUtil.java +++ b/app/src/main/java/com/kabouzeid/gramophone/util/MusicUtil.java @@ -212,4 +212,8 @@ public class MusicUtil { PlaylistsUtil.addToPlaylist(context, song, getOrCreateFavoritesPlaylist(context).id, false); } } + + public static boolean isArtistNameUnknown(final String artistName) { + return artistName.trim().toLowerCase().equals("unknown") || artistName.trim().toLowerCase().equals(""); + } }