private void setupAlbumArt(View view) {
    if (mAlbum != null
        || (mQuery != null && !TextUtils.isEmpty(mQuery.getAlbum().getName()))
        || (mPlaylistEntry != null
            && !TextUtils.isEmpty(mPlaylistEntry.getQuery().getAlbum().getName()))) {
      View v =
          ViewUtils.ensureInflation(
              view, R.id.context_menu_albumart_stub, R.id.context_menu_albumart);

      // load albumart image
      ImageView albumImageView = (ImageView) v.findViewById(R.id.album_imageview);
      Album album;
      String cacheKey;
      if (mAlbum != null) {
        album = mAlbum;
        cacheKey = mAlbum.getCacheKey();
      } else if (mQuery != null) {
        album = mQuery.getAlbum();
        cacheKey = mQuery.getAlbum().getCacheKey();
      } else {
        album = mPlaylistEntry.getAlbum();
        cacheKey = mPlaylistEntry.getAlbum().getCacheKey();
      }
      if (album.getImage() != null) {
        ImageUtils.loadImageIntoImageView(
            TomahawkApp.getContext(),
            albumImageView,
            album.getImage(),
            Image.getLargeImageSize(),
            true,
            false);
      } else {
        String requestId = InfoSystem.get().resolve(album);
        if (requestId != null) {
          mCorrespondingRequestIds.add(requestId);
        }
      }

      // set text on "view album"-button and set up click listener
      View viewAlbumButton = view.findViewById(R.id.view_album_button);
      TextView viewAlbumButtonText = (TextView) viewAlbumButton.findViewById(R.id.textview);
      viewAlbumButtonText.setText(
          TomahawkApp.getContext().getString(R.string.view_album).toUpperCase());
      viewAlbumButton.setOnClickListener(constructAlbumNameClickListener(cacheKey));
    }
  }
 @SuppressWarnings("unused")
 public void onEventMainThread(InfoSystem.ResultsEvent event) {
   if (mCorrespondingRequestIds.contains(event.mInfoRequestData.getRequestId())
       && getView() != null) {
     ImageView albumImageView = (ImageView) getView().findViewById(R.id.album_imageview);
     Album album;
     if (mAlbum != null) {
       album = mAlbum;
     } else if (mQuery != null) {
       album = mQuery.getAlbum();
     } else {
       album = mPlaylistEntry.getAlbum();
     }
     ImageUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         albumImageView,
         album.getImage(),
         Image.getLargeImageSize(),
         true,
         false);
   }
 }
 private static void fillView(
     View view, List<Image> artistImages, int height, boolean isPagerFragment) {
   View v;
   int gridOneResId = isPagerFragment ? R.id.imageview_grid_one_pager : R.id.imageview_grid_one;
   int gridTwoResId = isPagerFragment ? R.id.imageview_grid_two_pager : R.id.imageview_grid_two;
   int gridThreeResId =
       isPagerFragment ? R.id.imageview_grid_three_pager : R.id.imageview_grid_three;
   int gridOneStubId =
       isPagerFragment ? R.id.imageview_grid_one_pager_stub : R.id.imageview_grid_one_stub;
   int gridTwoStubId =
       isPagerFragment ? R.id.imageview_grid_two_pager_stub : R.id.imageview_grid_two_stub;
   int gridThreeStubId =
       isPagerFragment ? R.id.imageview_grid_three_pager_stub : R.id.imageview_grid_three_stub;
   if (artistImages.size() > 2) {
     v = view.findViewById(gridOneResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = view.findViewById(gridTwoResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = TomahawkUtils.ensureInflation(view, gridThreeStubId, gridThreeResId);
     v.setVisibility(View.VISIBLE);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview1),
         artistImages.get(0),
         Image.getLargeImageSize(),
         false);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview2),
         artistImages.get(1),
         Image.getSmallImageSize(),
         false);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview3),
         artistImages.get(2),
         Image.getSmallImageSize(),
         false);
   } else if (artistImages.size() > 1) {
     v = view.findViewById(gridOneResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = view.findViewById(gridThreeResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = TomahawkUtils.ensureInflation(view, gridTwoStubId, gridTwoResId);
     v.setVisibility(View.VISIBLE);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview1),
         artistImages.get(0),
         Image.getLargeImageSize(),
         false);
     TomahawkUtils.loadImageIntoImageView(
         TomahawkApp.getContext(),
         (ImageView) v.findViewById(R.id.imageview2),
         artistImages.get(1),
         Image.getSmallImageSize(),
         false);
   } else {
     v = view.findViewById(gridTwoResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = view.findViewById(gridThreeResId);
     if (v != null) {
       v.setVisibility(View.GONE);
     }
     v = TomahawkUtils.ensureInflation(view, gridOneStubId, gridOneResId);
     v.setVisibility(View.VISIBLE);
     if (artistImages.size() > 0) {
       TomahawkUtils.loadImageIntoImageView(
           TomahawkApp.getContext(),
           (ImageView) v.findViewById(R.id.imageview1),
           artistImages.get(0),
           Image.getLargeImageSize(),
           false);
     } else {
       TomahawkUtils.loadDrawableIntoImageView(
           TomahawkApp.getContext(),
           (ImageView) v.findViewById(R.id.imageview1),
           R.drawable.album_placeholder_grid);
     }
   }
   if (height > 0) {
     v.getLayoutParams().height = height;
   }
 }