Ejemplo n.º 1
0
  @Override
  public void onBindViewHolder(final ItemHolder itemHolder, int i) {
    final Artist localItem = arraylist.get(i);

    itemHolder.name.setText(localItem.name);
    String albumNmber = TimberUtils.makeLabel(mContext, R.plurals.Nalbums, localItem.albumCount);
    String songCount = TimberUtils.makeLabel(mContext, R.plurals.Nsongs, localItem.songCount);
    itemHolder.albums.setText(TimberUtils.makeCombinedString(mContext, albumNmber, songCount));

    LastFmClient.getInstance(mContext)
        .getArtistInfo(
            new ArtistQuery(localItem.name),
            new ArtistInfoListener() {
              @Override
              public void artistInfoSucess(LastfmArtist artist) {
                ImageLoader.getInstance()
                    .displayImage(
                        artist.mArtwork.get(1).mUrl,
                        itemHolder.artistImage,
                        new DisplayImageOptions.Builder()
                            .cacheInMemory(true)
                            .cacheOnDisk(true)
                            .showImageOnFail(R.drawable.ic_empty_music2)
                            .resetViewBeforeLoading(true)
                            .displayer(new FadeInBitmapDisplayer(400))
                            .build());
              }

              @Override
              public void artistInfoFailed() {}
            });
  }
Ejemplo n.º 2
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_similar_artists, container, false);

    Artist artist = ArtistLoader.getArtist(getActivity(), artistID);

    LastFmClient.getInstance(getActivity())
        .getArtistInfo(
            new ArtistQuery(artist.name),
            new ArtistInfoListener() {
              @Override
              public void artistInfoSucess(LastfmArtist artist) {}

              @Override
              public void artistInfoFailed() {}
            });

    return rootView;
  }