public void setUp() throws Exception { super.setUp(); setupService(); Collection coll = new LocalCollection(getContext()); tstTrack = coll.getQueries().get(0); Intent startIntent = new Intent(getContext(), PlaybackService.class); Assert.assertNotNull(tstTrack); startIntent.putExtra( PlaybackFragment.PLAYLIST_EXTRA, AlbumPlaylist.fromAlbum(tstTrack.getAlbum(), tstTrack)); startService(startIntent); }
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)); } }); }