Ejemplo n.º 1
0
 private void setupPlaybackTextViews(View view, PlaybackPanel playbackPanel) {
   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.view_album_button_stub, R.id.view_album_button);
     TextView viewAlbumButtonText = (TextView) v.findViewById(R.id.textview);
     viewAlbumButtonText.setText(
         TomahawkApp.getContext().getString(R.string.view_album).toUpperCase());
     String cacheKey;
     if (mAlbum != null) {
       cacheKey = mAlbum.getCacheKey();
     } else if (mQuery != null) {
       cacheKey = mQuery.getAlbum().getCacheKey();
     } else {
       cacheKey = mPlaylistEntry.getAlbum().getCacheKey();
     }
     v.setOnClickListener(constructAlbumNameClickListener(cacheKey));
   }
   if (mAlbum != null || mQuery != null || mPlaylistEntry != null || mArtist != null) {
     View artistNameButton = playbackPanel.findViewById(R.id.artist_name_button);
     String cacheKey;
     if (mAlbum != null) {
       cacheKey = mAlbum.getArtist().getCacheKey();
     } else if (mQuery != null) {
       cacheKey = mQuery.getArtist().getCacheKey();
     } else if (mPlaylistEntry != null) {
       cacheKey = mPlaylistEntry.getArtist().getCacheKey();
     } else {
       cacheKey = mArtist.getCacheKey();
     }
     artistNameButton.setOnClickListener(constructArtistNameClickListener(cacheKey));
   }
 }
Ejemplo n.º 2
0
  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));
    }
  }
Ejemplo n.º 3
0
 private void setupTextViews(View view) {
   if (mAlbum != null) {
     View v = ViewUtils.ensureInflation(view, R.id.album_name_button_stub, R.id.album_name_button);
     TextView textView = (TextView) v.findViewById(R.id.textview);
     textView.setText(mAlbum.getName());
     v.setOnClickListener(constructAlbumNameClickListener(mAlbum.getCacheKey()));
   } else if (mQuery != null || mPlaylistEntry != null || mPlaylist != null) {
     View v = ViewUtils.ensureInflation(view, R.id.track_name_stub, R.id.track_name);
     TextView textView = (TextView) v;
     if (mQuery != null) {
       textView.setText(mQuery.getName());
     } else if (mPlaylistEntry != null) {
       textView.setText(mPlaylistEntry.getName());
     } else if (mPlaylist != null) {
       textView.setText(mPlaylist.getName());
     }
   }
   if (mAlbum != null || mQuery != null || mPlaylistEntry != null || mArtist != null) {
     View v =
         ViewUtils.ensureInflation(view, R.id.artist_name_button_stub, R.id.artist_name_button);
     TextView textView = (TextView) v.findViewById(R.id.textview);
     String cacheKey;
     if (mQuery != null) {
       textView.setText(mQuery.getArtist().getPrettyName());
       cacheKey = mQuery.getArtist().getCacheKey();
     } else if (mAlbum != null) {
       textView.setText(mAlbum.getArtist().getPrettyName());
       cacheKey = mAlbum.getArtist().getCacheKey();
     } else if (mPlaylistEntry != null) {
       textView.setText(mPlaylistEntry.getArtist().getPrettyName());
       cacheKey = mPlaylistEntry.getArtist().getCacheKey();
     } else {
       textView.setText(mArtist.getPrettyName());
       cacheKey = mArtist.getCacheKey();
     }
     v.setOnClickListener(constructArtistNameClickListener(cacheKey));
   }
 }