コード例 #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));
   }
 }
コード例 #2
0
 public void fillView(final Album album, Collection collection) {
   if (collection == null) {
     collection = CollectionManager.getInstance().getCollection(TomahawkApp.PLUGINNAME_HATCHET);
   }
   TextView textView1 = (TextView) findViewById(R.id.textview1);
   textView1.setText(album.getPrettyName());
   TextView textView2 = (TextView) findViewById(R.id.textview2);
   textView2.setText(album.getArtist().getPrettyName());
   ImageView imageView1 = (ImageView) findViewById(R.id.imageview1);
   TomahawkUtils.loadImageIntoImageView(
       TomahawkApp.getContext(), imageView1, album.getImage(), Image.getSmallImageSize(), false);
   final TextView textView3 = (TextView) findViewById(R.id.textview3);
   textView3.setVisibility(View.INVISIBLE);
   collection
       .getAlbumTracks(album)
       .done(
           new DoneCallback<CollectionCursor<Query>>() {
             @Override
             public void onDone(CollectionCursor<Query> cursor) {
               int size = 0;
               if (cursor != null) {
                 size = cursor.size();
                 cursor.close();
               }
               textView3.setVisibility(View.VISIBLE);
               textView3.setText(
                   TomahawkApp.getContext()
                       .getResources()
                       .getQuantityString(R.plurals.songs_with_count, size, size));
             }
           });
 }
コード例 #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));
   }
 }