@Override protected void update() { starButton.setVisibility( (Util.isOffline(getContext()) || !song.isStarred()) ? View.GONE : View.VISIBLE); DownloadService downloadService = DownloadServiceImpl.getInstance(); if (downloadService == null) { return; } DownloadFile downloadFile = downloadService.forSong(song); File partialFile = downloadFile.getPartialFile(); int leftImage = 0; int rightImage = 0; if (downloadFile.isWorkDone()) { leftImage = downloadFile.shouldSave() ? R.drawable.saved : R.drawable.downloaded; } if (downloadFile.isDownloading() && !downloadFile.isDownloadCancelled() && partialFile.exists()) { statusTextView.setText(Util.formatLocalizedBytes(partialFile.length(), getContext())); rightImage = R.drawable.downloading; } else { statusTextView.setText(null); } statusTextView.setCompoundDrawablesWithIntrinsicBounds(leftImage, 0, rightImage, 0); boolean playing = downloadService.getCurrentPlaying() == downloadFile; if (playing) { titleTextView.setCompoundDrawablesWithIntrinsicBounds( R.drawable.stat_notify_playing, 0, 0, 0); } else { titleTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } }