Beispiel #1
0
 /**
  * Used to set the header image for playlists and genres.
  *
  * @param context The {@link Context} to use.
  * @param profileName The key used to fetch the image.
  */
 public void setPlaylistOrGenrePhoto(final Activity context, final String profileName) {
   if (!TextUtils.isEmpty(profileName)) {
     final Bitmap image = mFetcher.getCachedBitmap(profileName);
     if (image != null) {
       mPhoto.setImageBitmap(image);
     } else {
       setDefault(context);
     }
   } else {
     setDefault(context);
   }
 }
Beispiel #2
0
  /**
   * Used to blur the artist image in the album profile.
   *
   * @param context The {@link Context} to use.
   * @param artist The artist nmae used to fetch the cached artist image.
   * @param album The album name used to fetch the album art in case the artist image is missing.
   */
  public void blurPhoto(final Activity context, final String artist, final String album) {
    // FIXME: this should go into an AsyncTask

    // First check for the artist image
    Bitmap artistImage = mFetcher.getCachedBitmap(artist);
    // Second check for cached artwork
    if (artistImage == null) {
      artistImage = mFetcher.getCachedArtwork(album);
    }
    // If all else, use the default image
    if (artistImage == null) {
      artistImage = BitmapFactory.decodeResource(getResources(), R.drawable.theme_preview);
    }
    final Bitmap blur = BitmapUtils.createBlurredBitmap(artistImage);
    mPhoto.setImageBitmap(blur);
  }