Fixed some artist images not showing up and a crash when the artist image url was empty
This commit is contained in:
parent
50460a6653
commit
c1437283aa
24 changed files with 54 additions and 830 deletions
|
|
@ -72,6 +72,10 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
holder.artistInfo.setText(MusicUtil.getArtistInfoString(activity, artist));
|
||||
holder.view.setActivated(isChecked(artist));
|
||||
|
||||
if (MusicUtil.isArtistNameUnknown(artist.name)) {
|
||||
holder.artistImage.setImageResource(R.drawable.default_artist_image);
|
||||
return;
|
||||
}
|
||||
lastFMRestClient.getApiService().getArtistInfo(artist.name, null, new Callback<ArtistInfo>() {
|
||||
@Override
|
||||
public void success(ArtistInfo artistInfo, Response response) {
|
||||
|
|
@ -88,24 +92,23 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
new DisplayImageOptions.Builder()
|
||||
.cacheInMemory(true)
|
||||
.cacheOnDisk(true)
|
||||
.resetViewBeforeLoading(true)
|
||||
.showImageOnFail(R.drawable.default_artist_image)
|
||||
.showImageForEmptyUri(R.drawable.default_artist_image)
|
||||
.build()
|
||||
);
|
||||
} else {
|
||||
setDefaultArtistImage(holder);
|
||||
holder.artistImage.setImageResource(R.drawable.default_artist_image);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(RetrofitError error) {
|
||||
setDefaultArtistImage(holder);
|
||||
holder.artistImage.setImageResource(R.drawable.default_artist_image);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setDefaultArtistImage(ViewHolder holder) {
|
||||
holder.artistImage.setImageResource(R.drawable.default_artist_image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataSet.size();
|
||||
|
|
|
|||
|
|
@ -124,6 +124,10 @@ public class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.ViewHolder
|
|||
final Artist artist = (Artist) results.get(position);
|
||||
holder.title.setText(artist.name);
|
||||
holder.subTitle.setText(MusicUtil.getArtistInfoString(activity, artist));
|
||||
if (MusicUtil.isArtistNameUnknown(artist.name)) {
|
||||
holder.image.setImageResource(R.drawable.default_artist_image);
|
||||
break;
|
||||
}
|
||||
lastFMRestClient.getApiService().getArtistInfo(artist.name, null, new Callback<ArtistInfo>() {
|
||||
@Override
|
||||
public void success(ArtistInfo artistInfo, Response response) {
|
||||
|
|
@ -140,21 +144,18 @@ public class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.ViewHolder
|
|||
new DisplayImageOptions.Builder()
|
||||
.cacheInMemory(true)
|
||||
.cacheOnDisk(true)
|
||||
.showImageOnFail(R.drawable.default_artist_image)
|
||||
.resetViewBeforeLoading(true)
|
||||
.showImageOnFail(R.drawable.default_artist_image)
|
||||
.showImageForEmptyUri(R.drawable.default_artist_image)
|
||||
.build()
|
||||
);
|
||||
} else {
|
||||
setDefaultArtistImage();
|
||||
holder.image.setImageResource(R.drawable.default_artist_image);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(RetrofitError error) {
|
||||
setDefaultArtistImage();
|
||||
}
|
||||
|
||||
private void setDefaultArtistImage() {
|
||||
holder.image.setImageResource(R.drawable.default_artist_image);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ public class LastFMRestClient {
|
|||
}
|
||||
|
||||
RestAdapter restAdapter = new RestAdapter.Builder()
|
||||
.setLogLevel(RestAdapter.LogLevel.FULL)
|
||||
.setEndpoint(BASE_URL)
|
||||
.setClient(new OkClient(okHttpClient))
|
||||
.setRequestInterceptor(new RequestInterceptor() {
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@ public class Album {
|
|||
@Expose
|
||||
private String playcount;
|
||||
@Expose
|
||||
private Tracks tracks;
|
||||
@Expose
|
||||
private Toptags toptags;
|
||||
@Expose
|
||||
private Wiki wiki;
|
||||
|
||||
/**
|
||||
|
|
@ -159,34 +155,6 @@ public class Album {
|
|||
this.playcount = playcount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The tracks
|
||||
*/
|
||||
public Tracks getTracks() {
|
||||
return tracks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tracks The tracks
|
||||
*/
|
||||
public void setTracks(Tracks tracks) {
|
||||
this.tracks = tracks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The toptags
|
||||
*/
|
||||
public Toptags getToptags() {
|
||||
return toptags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param toptags The toptags
|
||||
*/
|
||||
public void setToptags(Toptags toptags) {
|
||||
this.toptags = toptags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The wiki
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
|
||||
package com.kabouzeid.gramophone.lastfm.rest.model.albuminfo;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
public class Artist {
|
||||
|
||||
@Expose
|
||||
private String name;
|
||||
@Expose
|
||||
private String mbid;
|
||||
@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 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
package com.kabouzeid.gramophone.lastfm.rest.model.albuminfo;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
public class Attr {
|
||||
|
||||
@Expose
|
||||
private String rank;
|
||||
|
||||
/**
|
||||
* @return The rank
|
||||
*/
|
||||
public String getRank() {
|
||||
return rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rank The rank
|
||||
*/
|
||||
public void setRank(String rank) {
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
|
||||
package com.kabouzeid.gramophone.lastfm.rest.model.albuminfo;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Streamable {
|
||||
|
||||
@SerializedName("#text")
|
||||
@Expose
|
||||
private String Text;
|
||||
@Expose
|
||||
private String fulltrack;
|
||||
|
||||
/**
|
||||
* @return The Text
|
||||
*/
|
||||
public String getText() {
|
||||
return Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Text The #text
|
||||
*/
|
||||
public void setText(String Text) {
|
||||
this.Text = Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The fulltrack
|
||||
*/
|
||||
public String getFulltrack() {
|
||||
return fulltrack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fulltrack The fulltrack
|
||||
*/
|
||||
public void setFulltrack(String fulltrack) {
|
||||
this.fulltrack = fulltrack;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
|
||||
package com.kabouzeid.gramophone.lastfm.rest.model.albuminfo;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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 Toptags {
|
||||
|
||||
@Expose
|
||||
private List<Tag> tag = new ArrayList<Tag>();
|
||||
|
||||
/**
|
||||
* @return The tag
|
||||
*/
|
||||
public List<Tag> getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tag The tag
|
||||
*/
|
||||
public void setTag(List<Tag> tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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> track = new ArrayList<Track>();
|
||||
|
||||
/**
|
||||
* @return The track
|
||||
*/
|
||||
public List<Track> getTrack() {
|
||||
return track;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param track The track
|
||||
*/
|
||||
public void setTrack(List<Track> track) {
|
||||
this.track = track;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -17,16 +17,10 @@ public class Artist {
|
|||
@Expose
|
||||
private List<Image> image = new ArrayList<Image>();
|
||||
@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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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_> image = new ArrayList<Image_>();
|
||||
|
||||
/**
|
||||
* @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<Image_> getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param image The image
|
||||
*/
|
||||
public void setImage(List<Image_> image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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_> artist = new ArrayList<Artist_>();
|
||||
|
||||
/**
|
||||
* @return The artist
|
||||
*/
|
||||
public List<Artist_> getArtist() {
|
||||
return artist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param artist The artist
|
||||
*/
|
||||
public void setArtist(List<Artist_> artist) {
|
||||
this.artist = artist;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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> tag = new ArrayList<Tag>();
|
||||
|
||||
/**
|
||||
* @return The tag
|
||||
*/
|
||||
public List<Tag> getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tag The tag
|
||||
*/
|
||||
public void setTag(List<Tag> tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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<ArtistInfo>() {
|
||||
@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<ArtistInfo>() {
|
||||
@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) {
|
||||
|
|
|
|||
|
|
@ -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("<unknown>");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue