コード例 #1
0
 /**
  * Used to set the album art in the album profile.
  *
  * @param context The {@link Context} to use.
  * @param album The name of the album in the profile the user is viewing.
  */
 public void setAlbumPhoto(final Activity context, final String album, final String artist) {
   if (!TextUtils.isEmpty(album)) {
     mAlbumArt.setVisibility(View.VISIBLE);
     mFetcher.loadAlbumImage(
         artist, album, MusicUtils.getIdForAlbum(context, album, artist), mAlbumArt);
   } else {
     setDefault(context);
   }
 }
コード例 #2
0
  /**
   * Used to set the album art in the artist profile.
   *
   * @param context The {@link Context} to use.
   * @param artist The name of the artist in the profile the user is viewing.
   */
  public void setArtistAlbumPhoto(final Activity context, final String artist) {
    final String lastAlbum = MusicUtils.getLastAlbumForArtist(context, artist);
    if (!TextUtils.isEmpty(lastAlbum)) {
      // Set the last album the artist played
      mFetcher.loadAlbumImage(
          artist, lastAlbum, MusicUtils.getIdForAlbum(context, lastAlbum, artist), mPhoto);
      // Play the album
      mPhoto.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(final View v) {
              final long[] albumList =
                  MusicUtils.getSongListForAlbum(
                      getContext(), MusicUtils.getIdForAlbum(context, lastAlbum, artist));
              MusicUtils.playAll(getContext(), albumList, 0, false);
            }
          });
    } else {
      setDefault(context);
    }
  }